casacore::ImageInterface< T > Class Template Reference

A base class for astronomical images. More...

#include <ImageInterface.h>

Inheritance diagram for casacore::ImageInterface< T >:
casacore::MaskedLattice< T > casacore::Lattice< T > casacore::LatticeBase casacore::CurvedImage2D< T > casacore::ExtendImage< T > casacore::HDF5Image< T > casacore::ImageConcat< T > casacore::ImageExpr< T > casacore::PagedImage< T > casacore::RebinImage< T > casacore::SubImage< T > casacore::TempImage< T >

List of all members.

Public Member Functions

 ImageInterface ()
 ImageInterface (const RegionHandler &regionHandler)
 Construct for a specific region handler object.
 ImageInterface (const ImageInterface &other)
 Copy constructor (copy semantics).
virtual ~ImageInterface ()
virtual MaskedLattice< T > * cloneML () const
 Make a copy of the derived object (reference semantics).
virtual ImageInterface< T > * cloneII () const =0
virtual String imageType () const =0
 Get the image type (returns name of derived class).
virtual void resize (const TiledShape &newShape)=0
 Function which changes the shape of the image (N.B.
virtual Bool setUnits (const Unit &newUnits)
 Function which get and set the units associated with the image pixels (i.e.
virtual const Unitunits () const
virtual String name (Bool stripPath=False) const =0
 Return the name of the current ImageInterface object.
virtual Bool setCoordinateInfo (const CoordinateSystem &coords)
 Functions to set or replace the coordinate information in the Image Returns False on failure, e.g.
const CoordinateSystemcoordinates () const
virtual LELCoordinates lelCoordinates () const
 Function to get a LELCoordinate object containing the coordinates.
LoggerHolderlogger ()
 Get access to the LoggerHolder.
const LoggerHolderlogger () const
LogIOlogSink ()
 Allow messages to be logged to this ImageInterface.
const LogIOlogSink () const
void appendLog (const LoggerHolder &other)
 Add the messages from the other image logger to this one.
const TableRecordmiscInfo () const
 Often we have miscellaneous information we want to attach to an image.
virtual Bool setMiscInfo (const RecordInterface &newInfo)
const ImageInfoimageInfo () 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.
virtual Bool setImageInfo (const ImageInfo &info)
virtual ImageAttrHandlerattrHandler (Bool createHandler=False)
 Get access to the attribute handler.
ImageAttrHandlerroAttrHandler () const
Bool canDefineRegion () const
 Can the image handle region definition?
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.
virtual void defineRegion (const String &name, const ImageRegion &region, RegionHandler::GroupType, Bool overwrite=False)
 Define a region/mask belonging to the image.
virtual Bool hasRegion (const String &regionName, RegionHandler::GroupType=RegionHandler::Any) const
 Does the image have a region with the given name?
virtual ImageRegiongetImageRegionPtr (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).
virtual void renameRegion (const String &newName, const String &oldName, RegionHandler::GroupType=RegionHandler::Any, Bool overwrite=False)
 Rename a region.
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).
virtual Vector< StringregionNames (RegionHandler::GroupType=RegionHandler::Any) const
 Get the names of all regions/masks.
virtual void useMask (MaskSpecifier=MaskSpecifier())
 Use the mask as specified.
virtual void setDefaultMask (const String &regionName)
 Set the default pixelmask to the mask with the given name (which has to exist in the "masks" group).
virtual String getDefaultMask () const
 Get the name of the default pixelmask.
ImageRegion getRegion (const String &regionName, RegionHandler::GroupType=RegionHandler::Any) const
 Get a region belonging to the image.
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.
virtual Bool ok () const =0
 Check class invariants.
Bool toRecord (String &error, RecordInterface &outRec)
 Save and restore an ImageInterface object to or from a state Record.
Bool fromRecord (String &error, const RecordInterface &inRec)

Protected Member Functions

ImageInterfaceoperator= (const ImageInterface &other)
 Assignment (copy semantics) is only useful for derived classes.
Bool restoreImageInfo (const RecordInterface &rec)
 Restore the image info from the record.
void setLogMember (const LoggerHolder &logger)
 Set the image logger variable.
void setImageInfoMember (const ImageInfo &imageInfo)
 Set the image info variable.
void setCoordsMember (const CoordinateSystem &coords)
 Set the coordinate system variable.
void setUnitMember (const Unit &unit)
 Set the unit variable.
void setMiscInfoMember (const RecordInterface &rec)
 Set the miscinfo variable.
RegionHandlergetRegionHandler ()
 Get access to the region handler.
ImageInforwImageInfo ()
 Get non-const access to the ImageInfo.

Private Attributes

CoordinateSystem coords_p
 It is the job of the derived class to make these variables valid.
LoggerHolder log_p
ImageInfo imageInfo_p
Unit unit_p
TableRecord miscInfo_p
RegionHandlerregHandPtr_p
 The region handling object.
ImageAttrHandler itsBaseAttrHandler
 The attribute handling object.

Detailed Description

template<class T>
class casacore::ImageInterface< T >

A base class for astronomical images.

Intended use:

Public interface

Prerequisite

Etymology

The ImageInterface class name is derived from its role as the cookie cutter Interface base class for Images.

Synopsis

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.

Example

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)

 Float sumPixels(const ImageInterface<Float>& image){
 uInt rowLength = image.shape()(0);
 IPosition rowShape(image.ndim());
 rowShape = 1; rowShape(0) = rowLength;
 Float sumPix = 0;
 RO_LatticeIterator<Float> iter(image, rowShape);
 while(!iter.atEnd()){
 sumPix += sum(iter.vectorCursor());
 iter++;
 }
 return sumPix;
 }

The main purpose of this class is for programming objects, the following example is of how one would derive from ImageInterface:
eg 2.

 template <class T> class myNewImage : public ImageInterface<T>
 {
 public:
 // default constructor
 myNewImage();
 
 // argumented constructor
 myNewImage(...);
 
 // destructor
 ~myNewImage
 
 // the shape function is forced upon us by the Lattice base class
 IPosition shape() const;
 
 // doGetSlice is another function required of all Lattice objects.
 Bool doGetSlice(<Array<T>& buffer, const Slicer& section);
 
 // etc..\.
 private:
 // put the actual map data down here.
 // etc..\.
 };

Motivation

The use of abstract base classes to guide inheritance seemed appropriate for Images to ensure that CoordinateSystems and masking get handled uniformly.

To Do

Definition at line 146 of file ImageInterface.h.


Constructor & Destructor Documentation

template<class T>
casacore::ImageInterface< T >::ImageInterface (  ) 
template<class T>
casacore::ImageInterface< T >::ImageInterface ( const RegionHandler regionHandler  ) 

Construct for a specific region handler object.

template<class T>
casacore::ImageInterface< T >::ImageInterface ( const ImageInterface< T > &  other  ) 

Copy constructor (copy semantics).

template<class T>
virtual casacore::ImageInterface< T >::~ImageInterface (  )  [virtual]

Member Function Documentation

template<class T>
void casacore::ImageInterface< T >::appendLog ( const LoggerHolder other  )  [inline]

Add the messages from the other image logger to this one.

Definition at line 219 of file ImageInterface.h.

template<class T>
virtual ImageAttrHandler& casacore::ImageInterface< T >::attrHandler ( Bool  createHandler = False  )  [virtual]

Get access to the attribute handler.

By default an empty handler is returned where no groups can be added to.

Reimplemented in casacore::CurvedImage2D< T >, casacore::ExtendImage< T >, casacore::HDF5Image< T >, casacore::PagedImage< T >, casacore::RebinImage< T >, and casacore::SubImage< T >.

Referenced by casacore::ImageInterface< Complex >::roAttrHandler().

template<class T>
Bool casacore::ImageInterface< T >::canDefineRegion (  )  const [inline]

Can the image handle region definition?

Definition at line 254 of file ImageInterface.h.

template<class T>
virtual ImageInterface<T>* casacore::ImageInterface< T >::cloneII (  )  const [pure virtual]
template<class T>
virtual MaskedLattice<T>* casacore::ImageInterface< T >::cloneML (  )  const [virtual]

Make a copy of the derived object (reference semantics).

Implements casacore::MaskedLattice< T >.

template<class T>
const CoordinateSystem& casacore::ImageInterface< T >::coordinates (  )  const [inline]

Definition at line 195 of file ImageInterface.h.

template<class T>
virtual void casacore::ImageInterface< T >::defineRegion ( const String name,
const ImageRegion region,
RegionHandler::GroupType  ,
Bool  overwrite = False 
) [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.

template<class T>
Bool casacore::ImageInterface< T >::fromRecord ( String error,
const RecordInterface inRec 
)
template<class T>
virtual String casacore::ImageInterface< T >::getDefaultMask (  )  const [virtual]

Get the name of the default pixelmask.

An empty string is returned if no default pixelmask.

template<class T>
virtual ImageRegion* casacore::ImageInterface< T >::getImageRegionPtr ( const String name,
RegionHandler::GroupType  = RegionHandler::Any,
Bool  throwIfUnknown = True 
) const [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.

template<class T>
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.

template<class T>
RegionHandler* casacore::ImageInterface< T >::getRegionHandler (  )  [inline, protected]

Get access to the region handler.

Definition at line 376 of file ImageInterface.h.

template<class T>
virtual Bool casacore::ImageInterface< T >::hasRegion ( const String regionName,
RegionHandler::GroupType  = RegionHandler::Any 
) const [virtual]

Does the image have a region with the given name?

template<class T>
const ImageInfo& casacore::ImageInterface< T >::imageInfo (  )  const [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.

template<class T>
virtual String casacore::ImageInterface< T >::imageType (  )  const [pure virtual]
template<class T>
virtual LELCoordinates casacore::ImageInterface< T >::lelCoordinates (  )  const [virtual]

Function to get a LELCoordinate object containing the coordinates.

Reimplemented from casacore::LatticeBase.

template<class T>
const LoggerHolder& casacore::ImageInterface< T >::logger (  )  const [inline]

Definition at line 206 of file ImageInterface.h.

template<class T>
LoggerHolder& casacore::ImageInterface< T >::logger (  )  [inline]

Get access to the LoggerHolder.

Definition at line 204 of file ImageInterface.h.

Referenced by casacore::ImageInterface< Complex >::logSink().

template<class T>
const LogIO& casacore::ImageInterface< T >::logSink (  )  const [inline]

Definition at line 214 of file ImageInterface.h.

Referenced by casacore::ImageInterface< Complex >::logSink().

template<class T>
LogIO& casacore::ImageInterface< T >::logSink (  )  [inline]

Allow messages to be logged to this ImageInterface.

Definition at line 212 of file ImageInterface.h.

template<class T>
virtual ImageRegion casacore::ImageInterface< T >::makeMask ( const String name,
Bool  defineAsRegion = True,
Bool  setAsDefaultMask = True,
Bool  initialize = False,
Bool  value = True 
) [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.

template<class T>
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.

template<class T>
const TableRecord& casacore::ImageInterface< T >::miscInfo (  )  const [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.

Reimplemented in casacore::MIRIADImage.

Definition at line 228 of file ImageInterface.h.

template<class T>
virtual String casacore::ImageInterface< T >::name ( Bool  stripPath = False  )  const [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.

Reimplemented from casacore::LatticeBase.

Implemented in casacore::CurvedImage2D< T >, casacore::ExtendImage< T >, casacore::FITSImage, casacore::FITSQualityImage, casacore::HDF5Image< T >, casacore::ImageConcat< T >, casacore::ImageExpr< T >, casacore::MIRIADImage, casacore::PagedImage< T >, casacore::RebinImage< T >, casacore::SubImage< T >, casacore::TempImage< T >, and casacore::ImageExpr< Bool >.

template<class T>
virtual Bool casacore::ImageInterface< T >::ok (  )  const [pure virtual]
template<class T>
ImageInterface& casacore::ImageInterface< T >::operator= ( const ImageInterface< T > &  other  )  [protected]
template<class T>
virtual Vector<String> casacore::ImageInterface< T >::regionNames ( RegionHandler::GroupType  = RegionHandler::Any  )  const [virtual]

Get the names of all regions/masks.

template<class T>
virtual void casacore::ImageInterface< T >::removeRegion ( const String name,
RegionHandler::GroupType  = RegionHandler::Any,
Bool  throwIfUnknown = True 
) [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 >, casacore::PagedImage< T >, and casacore::TempImage< T >.

template<class T>
virtual void casacore::ImageInterface< T >::renameRegion ( const String newName,
const String oldName,
RegionHandler::GroupType  = RegionHandler::Any,
Bool  overwrite = False 
) [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.

template<class T>
virtual void casacore::ImageInterface< T >::resize ( const TiledShape newShape  )  [pure virtual]
template<class T>
Bool casacore::ImageInterface< T >::restoreImageInfo ( const RecordInterface rec  )  [protected]

Restore the image info from the record.

Reimplemented in casacore::HDF5Image< T >.

template<class T>
ImageAttrHandler& casacore::ImageInterface< T >::roAttrHandler (  )  const [inline]

Definition at line 249 of file ImageInterface.h.

template<class T>
ImageInfo& casacore::ImageInterface< T >::rwImageInfo (  )  [inline, protected]

Get non-const access to the ImageInfo.

Definition at line 380 of file ImageInterface.h.

template<class T>
virtual Bool casacore::ImageInterface< T >::setCoordinateInfo ( const CoordinateSystem coords  )  [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 >, and casacore::PagedImage< T >.

template<class T>
void casacore::ImageInterface< T >::setCoordsMember ( const CoordinateSystem coords  )  [inline, protected]

Set the coordinate system variable.

Definition at line 364 of file ImageInterface.h.

template<class T>
virtual void casacore::ImageInterface< T >::setDefaultMask ( const String regionName  )  [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 >, casacore::PagedImage< T >, and casacore::TempImage< T >.

template<class T>
virtual Bool casacore::ImageInterface< T >::setImageInfo ( const ImageInfo info  )  [virtual]
template<class T>
void casacore::ImageInterface< T >::setImageInfoMember ( const ImageInfo imageInfo  )  [protected]

Set the image info variable.

template<class T>
void casacore::ImageInterface< T >::setLogMember ( const LoggerHolder logger  )  [inline, protected]

Set the image logger variable.

Definition at line 357 of file ImageInterface.h.

template<class T>
virtual Bool casacore::ImageInterface< T >::setMiscInfo ( const RecordInterface newInfo  )  [virtual]
template<class T>
void casacore::ImageInterface< T >::setMiscInfoMember ( const RecordInterface rec  )  [inline, protected]

Set the miscinfo variable.

Definition at line 372 of file ImageInterface.h.

template<class T>
void casacore::ImageInterface< T >::setUnitMember ( const Unit unit  )  [inline, protected]

Set the unit variable.

Definition at line 368 of file ImageInterface.h.

template<class T>
virtual Bool casacore::ImageInterface< T >::setUnits ( const Unit newUnits  )  [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 >, and casacore::PagedImage< T >.

template<class T>
Bool casacore::ImageInterface< T >::toRecord ( String error,
RecordInterface outRec 
)

Save and restore an ImageInterface object to or from a state Record.

template<class T>
virtual const Unit& casacore::ImageInterface< T >::units (  )  const [inline, virtual]

Definition at line 182 of file ImageInterface.h.

template<class T>
virtual void casacore::ImageInterface< T >::useMask ( MaskSpecifier  = MaskSpecifier()  )  [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 >, casacore::PagedImage< T >, and casacore::TempImage< T >.


Member Data Documentation

template<class T>
CoordinateSystem casacore::ImageInterface< T >::coords_p [private]

It is the job of the derived class to make these variables valid.

Definition at line 385 of file ImageInterface.h.

Referenced by casacore::ImageInterface< Complex >::coordinates(), and casacore::ImageInterface< Complex >::setCoordsMember().

template<class T>
ImageInfo casacore::ImageInterface< T >::imageInfo_p [private]

The attribute handling object.

Definition at line 395 of file ImageInterface.h.

template<class T>
LoggerHolder casacore::ImageInterface< T >::log_p [private]
template<class T>
TableRecord casacore::ImageInterface< T >::miscInfo_p [private]
template<class T>
RegionHandler* casacore::ImageInterface< T >::regHandPtr_p [private]
template<class T>
Unit casacore::ImageInterface< T >::unit_p [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1