casacore
Public Member Functions | Private Attributes | List of all members
casacore::ImageAttrHandlerHDF5 Class Reference

More...

#include <ImageAttrHandlerHDF5.h>

Public Member Functions

 ImageAttrHandlerHDF5 ()
 Default construct from the image table. More...
 
ImageAttrHandlerHDF5attachTable (const Table &image, Bool createHandler=False)
 Attach the table and return this object. More...
 
virtual ~ImageAttrHandlerHDF5 ()
 
ImageAttrHandlerHDF5attachHid (const HDF5Object &hid, Bool createHandler, Bool isWritable)
 Attach the hid and return this object. More...
 
virtual void flush ()
 Flush the attibrutes if needed. More...
 
virtual Bool hasGroup (const String &name)
 Test if the given attribute group is present. More...
 
virtual Vector< StringgroupNames () const
 Get all attribute group names. More...
 
virtual ImageAttrGroupopenGroup (const String &groupName)
 Get access to a group. More...
 
virtual ImageAttrGroupcreateGroup (const String &groupName)
 Create an attribute group with the given name. More...
 
virtual void closeGroup (const String &groupName)
 Close the group with the given name. More...
 
- Public Member Functions inherited from casacore::ImageAttrHandler
 ImageAttrHandler ()
 Default constructor. More...
 
virtual ~ImageAttrHandler ()
 

Private Attributes

Bool itsCanWrite
 
CountedPtr< HDF5GroupitsGroup
 
std::map< String, ImageAttrGroupHDF5itsGroupMap
 

Detailed Description

Abstract base class for an image attributes handler.

Intended use:

Public interface

Review Status

Test programs:
tPagedmage
Demo programs:
dPagedImage

Prerequisite

Etymology

This class makes it possible to store extra attributes with an image to describe atrbitrary meta information.

Synopsis

For LOFAR it was needed to store extra meta information and to be able to convert it from casacore table format to HDF5 format and vice-versa. Furthermore, it must be possible to access the information in a way that arbitrary info can be stored and retrieved.

The attributes are divided into handlers. Each handler can reside in a subtable of the image or in a handler in HDF5. All attributes in a handler have the same number of values, where each value can be a scalar or (small) array. It is possible to define units and measure info for an attribute.

Example

This example shows how to get attributes from an image. make it known to the image.

// Open the image (as readonly for the moment).
PagedImage<Float> myimage ("image.name");
// Get access to attibute handler LOFAR_SOURCE.
ImageExtrAttr& = myimage.attrHandler ("LOFAR_SOURCE");
// Get the data for some field.
Vector<String> names = ImageExtrAttr->getString("NAME");

Motivation

LOFAR needed functionality to store arbitrary attributes.

Definition at line 89 of file ImageAttrHandlerHDF5.h.

Constructor & Destructor Documentation

◆ ImageAttrHandlerHDF5()

casacore::ImageAttrHandlerHDF5::ImageAttrHandlerHDF5 ( )

Default construct from the image table.

◆ ~ImageAttrHandlerHDF5()

virtual casacore::ImageAttrHandlerHDF5::~ImageAttrHandlerHDF5 ( )
virtual

Member Function Documentation

◆ attachHid()

ImageAttrHandlerHDF5& casacore::ImageAttrHandlerHDF5::attachHid ( const HDF5Object hid,
Bool  createHandler,
Bool  isWritable 
)

Attach the hid and return this object.

It looks for the group ATTRGROUPS which contains groups defining the attribute groups. If the group does not exist, it will be added if createHandler is set. Otherwise the handler is an empty one and no groups can be added to it.

◆ attachTable()

ImageAttrHandlerHDF5& casacore::ImageAttrHandlerHDF5::attachTable ( const Table image,
Bool  createHandler = False 
)

Attach the table and return this object.

It looks for the table keyword ATTRGROUPS which contains the subtables defining the attribute groups. If the keyword does not exist, it will be added if createHandler is set. Otherwise the handler is an empty one and no groups can be added to it.

◆ closeGroup()

virtual void casacore::ImageAttrHandlerHDF5::closeGroup ( const String groupName)
virtual

Close the group with the given name.

It will flush its attributes. Nothing is done if it is not open.

Reimplemented from casacore::ImageAttrHandler.

◆ createGroup()

virtual ImageAttrGroup& casacore::ImageAttrHandlerHDF5::createGroup ( const String groupName)
virtual

Create an attribute group with the given name.

Reimplemented from casacore::ImageAttrHandler.

◆ flush()

virtual void casacore::ImageAttrHandlerHDF5::flush ( )
virtual

Flush the attibrutes if needed.

Reimplemented from casacore::ImageAttrHandler.

◆ groupNames()

virtual Vector<String> casacore::ImageAttrHandlerHDF5::groupNames ( ) const
virtual

Get all attribute group names.

Reimplemented from casacore::ImageAttrHandler.

◆ hasGroup()

virtual Bool casacore::ImageAttrHandlerHDF5::hasGroup ( const String name)
virtual

Test if the given attribute group is present.

Reimplemented from casacore::ImageAttrHandler.

◆ openGroup()

virtual ImageAttrGroup& casacore::ImageAttrHandlerHDF5::openGroup ( const String groupName)
virtual

Get access to a group.

Reimplemented from casacore::ImageAttrHandler.

Member Data Documentation

◆ itsCanWrite

Bool casacore::ImageAttrHandlerHDF5::itsCanWrite
private

Definition at line 136 of file ImageAttrHandlerHDF5.h.

◆ itsGroup

CountedPtr<HDF5Group> casacore::ImageAttrHandlerHDF5::itsGroup
private

Definition at line 137 of file ImageAttrHandlerHDF5.h.

◆ itsGroupMap

std::map<String,ImageAttrGroupHDF5> casacore::ImageAttrHandlerHDF5::itsGroupMap
private

Definition at line 138 of file ImageAttrHandlerHDF5.h.


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