casacore
|
A base class for astronomical images. More...
#include <ImageFITSConverter.h>
Public Member Functions | |
ImageInterface () | |
ImageInterface (const RegionHandler ®ionHandler) | |
Construct for a specific region handler object. More... | |
ImageInterface (const ImageInterface &other) | |
Copy constructor (copy semantics). More... | |
virtual | ~ImageInterface () |
virtual MaskedLattice< T > * | cloneML () const |
Make a copy of the derived object (reference semantics). More... | |
virtual ImageInterface< T > * | cloneII () const =0 |
virtual String | imageType () const =0 |
Get the image type (returns name of derived class). More... | |
virtual void | resize (const TiledShape &newShape)=0 |
Function which changes the shape of the image (N.B. More... | |
virtual Bool | setUnits (const Unit &newUnits) |
Function which get and set the units associated with the image pixels (i.e. More... | |
virtual const Unit & | units () const |
virtual String | name (Bool stripPath=False) const =0 |
Return the name of the current ImageInterface object. More... | |
virtual Bool | setCoordinateInfo (const CoordinateSystem &coords) |
Functions to set or replace the coordinate information in the Image Returns False on failure, e.g. More... | |
const CoordinateSystem & | coordinates () const |
virtual LELCoordinates | lelCoordinates () const |
Function to get a LELCoordinate object containing the coordinates. More... | |
LoggerHolder & | logger () |
Get access to the LoggerHolder. More... | |
const LoggerHolder & | logger () const |
LogIO & | logSink () |
Allow messages to be logged to this ImageInterface. More... | |
const LogIO & | logSink () const |
void | appendLog (const LoggerHolder &other) |
Add the messages from the other image logger to this one. More... | |
const TableRecord & | miscInfo () const |
Often we have miscellaneous information we want to attach to an image. More... | |
virtual Bool | setMiscInfo (const RecordInterface &newInfo) |
const ImageInfo & | imageInfo () const |
The ImageInfo object contains some miscellaneous information about the image which unlike that stored in MiscInfo, has a standard list of things, such as the restoring beam. More... | |
ImageInfo & | rwImageInfo () |
Get non-const access to the ImageInfo. More... | |
virtual Bool | setImageInfo (const ImageInfo &info) |
virtual ImageAttrHandler & | attrHandler (Bool createHandler=False) |
Get access to the attribute handler. More... | |
ImageAttrHandler & | roAttrHandler () const |
Bool | canDefineRegion () const |
Can the image handle region definition? More... | |
virtual ImageRegion | makeMask (const String &name, Bool defineAsRegion=True, Bool setAsDefaultMask=True, Bool initialize=False, Bool value=True) |
Make a mask which is suitable for the type of image. More... | |
virtual void | defineRegion (const String &name, const ImageRegion ®ion, RegionHandler::GroupType, Bool overwrite=False) |
Define a region/mask belonging to the image. More... | |
virtual Bool | hasRegion (const String ®ionName, RegionHandler::GroupType=RegionHandler::Any) const |
Does the image have a region with the given name? More... | |
virtual ImageRegion * | getImageRegionPtr (const String &name, RegionHandler::GroupType=RegionHandler::Any, Bool throwIfUnknown=True) const |
Get a region/mask belonging to the image from the given group (which can be Any). More... | |
virtual void | renameRegion (const String &newName, const String &oldName, RegionHandler::GroupType=RegionHandler::Any, Bool overwrite=False) |
Rename a region. More... | |
virtual void | removeRegion (const String &name, RegionHandler::GroupType=RegionHandler::Any, Bool throwIfUnknown=True) |
Remove a region/mask belonging to the image from the given group (which can be Any). More... | |
virtual Vector< String > | regionNames (RegionHandler::GroupType=RegionHandler::Any) const |
Get the names of all regions/masks. More... | |
virtual void | useMask (MaskSpecifier=MaskSpecifier()) |
Use the mask as specified. More... | |
virtual void | setDefaultMask (const String ®ionName) |
Set the default pixelmask to the mask with the given name (which has to exist in the "masks" group). More... | |
virtual String | getDefaultMask () const |
Get the name of the default pixelmask. More... | |
ImageRegion | getRegion (const String ®ionName, RegionHandler::GroupType=RegionHandler::Any) const |
Get a region belonging to the image. More... | |
String | makeUniqueRegionName (const String &rootName, uInt startNumber=1) const |
Make a unique region name from the given root name, thus make it such that the name is not already in use for a region or mask. More... | |
virtual Bool | ok () const =0 |
Check class invariants. More... | |
Bool | toRecord (String &error, RecordInterface &outRec) |
Save and restore an ImageInterface object to or from a state Record. More... | |
Bool | fromRecord (String &error, const RecordInterface &inRec) |
Protected Member Functions | |
ImageInterface & | operator= (const ImageInterface &other) |
Assignment (copy semantics) is only useful for derived classes. More... | |
Bool | restoreImageInfo (const RecordInterface &rec) |
Restore the image info from the record. More... | |
void | setLogMember (const LoggerHolder &logger) |
Set the image logger variable. More... | |
void | setImageInfoMember (const ImageInfo &imageInfo) |
Set the image info variable. More... | |
void | setCoordsMember (const CoordinateSystem &coords) |
Set the coordinate system variable. More... | |
void | setUnitMember (const Unit &unit) |
Set the unit variable. More... | |
void | setMiscInfoMember (const RecordInterface &rec) |
Set the miscinfo variable. More... | |
RegionHandler * | getRegionHandler () |
Get access to the region handler. More... | |
Private Attributes | |
CoordinateSystem | coords_p |
It is the job of the derived class to make these variables valid. More... | |
LoggerHolder | log_p |
ImageInfo | imageInfo_p |
Unit | unit_p |
TableRecord | miscInfo_p |
RegionHandler * | regHandPtr_p |
The region handling object. More... | |
ImageAttrHandler | itsBaseAttrHandler |
The attribute handling object. More... | |
A base class for astronomical images.
Public interface
The ImageInterface class name is derived from its role as the cookie cutter Interface base class for Images.
The ImageInterface class is an abstract base class. All Image classes should derive from this class to ensure functions which operate on Images will work for all Image derivations.
An Image is currently defined as an Array of pixels, a Boolean mask, defining which pixels are valid and coordinates to define the reference frame. The only concrete class currently derived from this Interface is PagedImage, which allows the image to be stored on disk, and only reads specified portions of the image into memory.
As this is an abstract base class it is not possible to construct an instance of this object. It can however be used as a function argument.
eg 1. (used in dImageInterface.cc)
The main purpose of this class is for programming objects, the following example is of how one would derive from ImageInterface:
eg 2.
The use of abstract base classes to guide inheritance seemed appropriate for Images to ensure that CoordinateSystems and masking get handled uniformly.
Definition at line 48 of file ImageFITSConverter.h.
casacore::ImageInterface< T >::ImageInterface | ( | ) |
casacore::ImageInterface< T >::ImageInterface | ( | const RegionHandler & | regionHandler | ) |
Construct for a specific region handler object.
casacore::ImageInterface< T >::ImageInterface | ( | const ImageInterface< T > & | other | ) |
Copy constructor (copy semantics).
|
virtual |
|
inline |
Add the messages from the other image logger to this one.
Definition at line 219 of file ImageInterface.h.
|
virtual |
Get access to the attribute handler.
By default an empty handler is returned where no groups can be added to.
Reimplemented in casacore::HDF5Image< T >, casacore::CurvedImage2D< T >, casacore::SubImage< T >, casacore::RebinImage< T >, and casacore::ExtendImage< T >.
Referenced by casacore::ImageInterface< Complex >::roAttrHandler().
|
inline |
Can the image handle region definition?
Definition at line 257 of file ImageInterface.h.
|
pure virtual |
|
virtual |
Make a copy of the derived object (reference semantics).
|
inline |
Definition at line 195 of file ImageInterface.h.
|
virtual |
Define a region/mask belonging to the image.
The group type determines if it stored as a region or mask. If overwrite=False, an exception will be thrown if the region already exists.
An exception is thrown if canDefineRegion is False.
Bool casacore::ImageInterface< T >::fromRecord | ( | String & | error, |
const RecordInterface & | inRec | ||
) |
|
virtual |
Get the name of the default pixelmask.
An empty string is returned if no default pixelmask.
|
virtual |
Get a region/mask belonging to the image from the given group (which can be Any).
Optionally an exception is thrown if the region does not exist. A zero pointer is returned if the region does not exist. The caller has to delete the ImageRegion
object created.
ImageRegion casacore::ImageInterface< T >::getRegion | ( | const String & | regionName, |
RegionHandler::GroupType | = RegionHandler::Any |
||
) | const |
Get a region belonging to the image.
An exception is thrown if the region does not exist.
|
inlineprotected |
Get access to the region handler.
Definition at line 379 of file ImageInterface.h.
|
virtual |
Does the image have a region with the given name?
|
inline |
The ImageInfo object contains some miscellaneous information about the image which unlike that stored in MiscInfo, has a standard list of things, such as the restoring beam.
Note that setImageInfo REPLACES the information with the new information. It is up to the derived class to make the ImageInfo permanent.
Definition at line 240 of file ImageInterface.h.
|
pure virtual |
Get the image type (returns name of derived class).
Implemented in casacore::ImageConcat< T >, casacore::ImageExpr< T >, casacore::ImageExpr< Bool >, casacore::CurvedImage2D< T >, casacore::HDF5Image< T >, casacore::SubImage< T >, casacore::TempImage< T >, casacore::RebinImage< T >, and casacore::ExtendImage< T >.
|
virtual |
Function to get a LELCoordinate object containing the coordinates.
|
inline |
Get access to the LoggerHolder.
Definition at line 204 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::logSink(), and casacore::ImageInterface< Complex >::setLogMember().
|
inline |
Definition at line 206 of file ImageInterface.h.
|
inline |
Allow messages to be logged to this ImageInterface.
Definition at line 212 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::logSink().
|
inline |
Definition at line 214 of file ImageInterface.h.
|
virtual |
Make a mask which is suitable for the type of image.
Optionally the mask can be initialized with the given value (by default it will not).
Optionally the mask can be defined as an image region/mask and turned in the default mask for the image. By default it will.
String casacore::ImageInterface< T >::makeUniqueRegionName | ( | const String & | rootName, |
uInt | startNumber = 1 |
||
) | const |
Make a unique region name from the given root name, thus make it such that the name is not already in use for a region or mask.
The root name is returned if it is already unique. Otherwise a number is appended to the root name to make it unique. The number starts at the given number and is incremented until the name is unique.
|
inline |
Often we have miscellaneous information we want to attach to an image.
This is where it goes.
Note that setMiscInfo REPLACES the information with the new information. It can fail if, e.g., the underlying table is not writable.
Definition at line 228 of file ImageInterface.h.
|
pure virtual |
Return the name of the current ImageInterface object.
This will generally be a file name for images that have a persistent form. Any path before the actual file name can be optionally stripped off.
Implemented in casacore::ImageConcat< T >, casacore::SubImage< T >, casacore::TempImage< T >, casacore::MIRIADImage, casacore::FITSImage, casacore::CurvedImage2D< T >, casacore::ImageExpr< T >, casacore::ImageExpr< Bool >, casacore::FITSQualityImage, casacore::HDF5Image< T >, casacore::RebinImage< T >, and casacore::ExtendImage< T >.
|
pure virtual |
Check class invariants.
Implemented in casacore::TempImage< T >, casacore::ImageConcat< T >, casacore::SubImage< T >, casacore::CurvedImage2D< T >, casacore::ImageExpr< T >, casacore::ImageExpr< Bool >, casacore::HDF5Image< T >, casacore::RebinImage< T >, and casacore::ExtendImage< T >.
|
protected |
Assignment (copy semantics) is only useful for derived classes.
|
virtual |
Get the names of all regions/masks.
|
virtual |
Remove a region/mask belonging to the image from the given group (which can be Any).
Optionally an exception is thrown if the region does not exist.
Reimplemented in casacore::HDF5Image< T >, and casacore::TempImage< T >.
|
virtual |
Rename a region.
If a region with the new name already exists, it is deleted or an exception is thrown (depending on overwrite
). The region name is looked up in the given group(s).
An exception is thrown if the old region name does not exist.
|
pure virtual |
Function which changes the shape of the image (N.B.
the data is thrown away - the Image will be filled with nonsense afterwards)
Implemented in casacore::SubImage< T >, casacore::TempImage< T >, casacore::CurvedImage2D< T >, casacore::ImageExpr< T >, casacore::ImageExpr< Bool >, casacore::HDF5Image< T >, casacore::FITSImage, casacore::RebinImage< T >, casacore::ExtendImage< T >, casacore::MIRIADImage, casacore::FITSQualityImage, and casacore::ImageConcat< T >.
|
protected |
Restore the image info from the record.
|
inline |
Definition at line 252 of file ImageInterface.h.
|
inline |
Get non-const access to the ImageInfo.
Definition at line 243 of file ImageInterface.h.
|
virtual |
Functions to set or replace the coordinate information in the Image Returns False on failure, e.g.
if the number of axes do not match.
Reimplemented in casacore::HDF5Image< T >.
|
inlineprotected |
Set the coordinate system variable.
Definition at line 367 of file ImageInterface.h.
|
virtual |
Set the default pixelmask to the mask with the given name (which has to exist in the "masks" group).
If the image table is writable, the setting is persistent by writing the name as a keyword. If the given regionName is the empty string, the default pixelmask is unset.
Reimplemented in casacore::HDF5Image< T >, and casacore::TempImage< T >.
|
virtual |
Reimplemented in casacore::HDF5Image< T >, and casacore::ImageConcat< T >.
|
protected |
Set the image info variable.
|
inlineprotected |
Set the image logger variable.
Definition at line 360 of file ImageInterface.h.
|
virtual |
|
inlineprotected |
Set the miscinfo variable.
Definition at line 375 of file ImageInterface.h.
|
inlineprotected |
Set the unit variable.
Definition at line 371 of file ImageInterface.h.
|
virtual |
Function which get and set the units associated with the image pixels (i.e.
the "brightness" unit). setUnits()
returns False if it cannot set the unit for some reason (e.g. the underlying file is not writable).
Reimplemented in casacore::HDF5Image< T >.
Bool casacore::ImageInterface< T >::toRecord | ( | String & | error, |
RecordInterface & | outRec | ||
) |
Save and restore an ImageInterface object to or from a state Record.
|
inlinevirtual |
Definition at line 182 of file ImageInterface.h.
|
virtual |
Use the mask as specified.
If a mask was already in use, it is replaced by the new one.
Reimplemented in casacore::HDF5Image< T >, and casacore::TempImage< T >.
|
private |
It is the job of the derived class to make these variables valid.
Definition at line 384 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::coordinates(), and casacore::ImageInterface< Complex >::setCoordsMember().
|
private |
Definition at line 386 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::imageInfo(), and casacore::ImageInterface< Complex >::rwImageInfo().
|
private |
The attribute handling object.
Definition at line 394 of file ImageInterface.h.
|
private |
Definition at line 385 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::appendLog(), casacore::ImageInterface< Complex >::logger(), and casacore::ImageInterface< Complex >::setLogMember().
|
private |
Definition at line 388 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::miscInfo(), and casacore::ImageInterface< Complex >::setMiscInfoMember().
|
private |
The region handling object.
Definition at line 391 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::canDefineRegion(), and casacore::ImageInterface< Complex >::getRegionHandler().
|
private |
Definition at line 387 of file ImageInterface.h.
Referenced by casacore::ImageInterface< Complex >::setUnitMember(), and casacore::ImageInterface< Complex >::units().