casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::RegionHandlerHDF5 Class Reference

Class for keeping regions in an HDF5 file. More...

#include <RegionHandlerHDF5.h>

Inheritance diagram for casacore::RegionHandlerHDF5:
casacore::RegionHandler

Public Types

typedef const CountedPtr
< HDF5File > & 
GetCallback (void *objectPtr)
 
- Public Types inherited from casacore::RegionHandler
enum  GroupType {
  Regions,
  Masks,
  Any
}
 Define the possible group types (regions or masks). More...
 

Public Member Functions

 RegionHandlerHDF5 (GetCallback *callback, void *objectPtr)
 
 RegionHandlerHDF5 (const RegionHandlerHDF5 &)
 
virtual ~RegionHandlerHDF5 ()
 
RegionHandlerHDF5operator= (const RegionHandlerHDF5 &)
 
virtual RegionHandlerHDF5clone () const
 Make a copy of the object. More...
 
virtual void setObjectPtr (void *objectPtr)
 Set the object pointer (for RegionHandlerTable's callback). More...
 
virtual Bool canDefineRegion () const
 Can the class indeed define and handle regions? The default implementation returns False. More...
 
virtual void setDefaultMask (const String &maskName)
 Set the default mask to the mask with the given name. More...
 
virtual String getDefaultMask () const
 Get the name of the default mask. More...
 
virtual Bool defineRegion (const String &name, const ImageRegion &region, RegionHandler::GroupType, Bool overwrite=False)
 Define a region belonging to the table. More...
 
virtual Bool hasRegion (const String &name, RegionHandler::GroupType=RegionHandler::Any) const
 Does the table have a region with the given name? More...
 
virtual ImageRegiongetRegion (const String &name, RegionHandler::GroupType=Any, Bool throwIfUnknown=True) const
 Get a region belonging to the table. More...
 
virtual Bool renameRegion (const String &newName, const String &oldName, RegionHandler::GroupType=Any, Bool overwrite=False)
 Rename a region. More...
 
virtual Bool removeRegion (const String &name, RegionHandler::GroupType=Any, Bool throwIfUnknown=True)
 Remove a region belonging to the table. More...
 
virtual Vector< StringregionNames (RegionHandler::GroupType=Any) const
 Get the names of all regions/masks. More...
 
virtual ImageRegion makeMask (const LatticeBase &lattice, const String &name)
 Make a mask for a lattice (e.g. More...
 
void save (Bool always=False)
 
void restore ()
 
- Public Member Functions inherited from casacore::RegionHandler
virtual ~RegionHandler ()
 
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...
 

Private Member Functions

const CountedPtr< HDF5File > & file () const
 
virtual Int findRegionGroup (const String &regionName, RegionHandler::GroupType=Any, Bool throwIfUnknown=True) const
 

Private Attributes

TableRecord itsRecord
 
Bool itsChanged
 
GetCallbackitsCallback
 
void * itsObjectPtr
 

Detailed Description

Class for keeping regions in an HDF5 file.

Intended use:

Internal

Review Status

Test programs:
tHDF5Image2

Prerequisite

Synopsis

Persistent regions are stored as subrecords of the table keywords "regions" and "masks". The user can choose one of both keywords. Keyword "masks" is meant for true image masks, i.e. telling for each pixel if it is good or bad. Keyword "regions" is meant for true regions in an image.

This class handles defining, getting and removing such regions. It is used by class

Definition at line 86 of file RegionHandlerHDF5.h.

Member Typedef Documentation

typedef const CountedPtr<HDF5File>& casacore::RegionHandlerHDF5::GetCallback(void *objectPtr)

Definition at line 90 of file RegionHandlerHDF5.h.

Constructor & Destructor Documentation

casacore::RegionHandlerHDF5::RegionHandlerHDF5 ( GetCallback callback,
void *  objectPtr 
)
casacore::RegionHandlerHDF5::RegionHandlerHDF5 ( const RegionHandlerHDF5 )
virtual casacore::RegionHandlerHDF5::~RegionHandlerHDF5 ( )
virtual

Member Function Documentation

virtual Bool casacore::RegionHandlerHDF5::canDefineRegion ( ) const
virtual

Can the class indeed define and handle regions? The default implementation returns False.

Reimplemented from casacore::RegionHandler.

virtual RegionHandlerHDF5* casacore::RegionHandlerHDF5::clone ( ) const
virtual

Make a copy of the object.

Reimplemented from casacore::RegionHandler.

virtual Bool casacore::RegionHandlerHDF5::defineRegion ( const String name,
const ImageRegion region,
RegionHandler::GroupType  ,
Bool  overwrite = False 
)
virtual

Define a region belonging to the table.

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 in the "regions" or "masks" keyword. Otherwise the region will be removed first.
A False status is returned if the table is not writable

Reimplemented from casacore::RegionHandler.

const CountedPtr<HDF5File>& casacore::RegionHandlerHDF5::file ( ) const
inlineprivate

Definition at line 179 of file RegionHandlerHDF5.h.

References itsCallback, and itsObjectPtr.

virtual Int casacore::RegionHandlerHDF5::findRegionGroup ( const String regionName,
RegionHandler::GroupType  = Any,
Bool  throwIfUnknown = True 
) const
privatevirtual
virtual String casacore::RegionHandlerHDF5::getDefaultMask ( ) const
virtual

Get the name of the default mask.

An empty string is returned if no default mask.

Reimplemented from casacore::RegionHandler.

virtual ImageRegion* casacore::RegionHandlerHDF5::getRegion ( const String name,
RegionHandler::GroupType  = Any,
Bool  throwIfUnknown = True 
) const
virtual

Get a region belonging to the table.

A zero pointer is returned if the region does not exist. The caller has to delete the ImageRegion object created.
No exception is thrown if the region does not exist.

Reimplemented from casacore::RegionHandler.

virtual Bool casacore::RegionHandlerHDF5::hasRegion ( const String name,
RegionHandler::GroupType  = RegionHandler::Any 
) const
virtual

Does the table have a region with the given name?

Reimplemented from casacore::RegionHandler.

virtual ImageRegion casacore::RegionHandlerHDF5::makeMask ( const LatticeBase lattice,
const String name 
)
virtual

Make a mask for a lattice (e.g.

a PagedImage or TempImage). It creates it with the shape and tile shape of the lattice.

Reimplemented from casacore::RegionHandler.

RegionHandlerHDF5& casacore::RegionHandlerHDF5::operator= ( const RegionHandlerHDF5 )
virtual Vector<String> casacore::RegionHandlerHDF5::regionNames ( RegionHandler::GroupType  = Any) const
virtual

Get the names of all regions/masks.

Reimplemented from casacore::RegionHandler.

virtual Bool casacore::RegionHandlerHDF5::removeRegion ( const String name,
RegionHandler::GroupType  = Any,
Bool  throwIfUnknown = True 
)
virtual

Remove a region belonging to the table.


Optionally an exception is thrown if the region does not exist.
A False status is returned if the table is not writable

Reimplemented from casacore::RegionHandler.

virtual Bool casacore::RegionHandlerHDF5::renameRegion ( const String newName,
const String oldName,
RegionHandler::GroupType  = 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.

Reimplemented from casacore::RegionHandler.

void casacore::RegionHandlerHDF5::restore ( )
void casacore::RegionHandlerHDF5::save ( Bool  always = False)
virtual void casacore::RegionHandlerHDF5::setDefaultMask ( const String maskName)
virtual

Set the default mask to the mask with the given name.

It constructs a ImageRegion object for the new default mask. If the table is writable, the setting is persistent by writing the name as a keyword. If the given maskName is the empty string, the default mask is unset.

Reimplemented from casacore::RegionHandler.

virtual void casacore::RegionHandlerHDF5::setObjectPtr ( void *  objectPtr)
virtual

Set the object pointer (for RegionHandlerTable's callback).

Default implementation does nothing.

Reimplemented from casacore::RegionHandler.

Member Data Documentation

GetCallback* casacore::RegionHandlerHDF5::itsCallback
private

Definition at line 193 of file RegionHandlerHDF5.h.

Referenced by file().

Bool casacore::RegionHandlerHDF5::itsChanged
private

Definition at line 192 of file RegionHandlerHDF5.h.

void* casacore::RegionHandlerHDF5::itsObjectPtr
private

Definition at line 194 of file RegionHandlerHDF5.h.

Referenced by file().

TableRecord casacore::RegionHandlerHDF5::itsRecord
private

Definition at line 191 of file RegionHandlerHDF5.h.


The documentation for this class was generated from the following file: