casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
casacore::ImageAttrHandler Class Reference

Abstract base class for an image attributes handler. More...

#include <ImageAttrHandler.h>

Inheritance diagram for casacore::ImageAttrHandler:
casacore::ImageAttrHandlerCasa casacore::ImageAttrHandlerHDF5

Public Member Functions

 ImageAttrHandler ()
 Default constructor. More...
 
virtual ~ImageAttrHandler ()
 
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...
 

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.

An ImageAttrHandler object handles those attributes in an image. Specific handler classes exist for images stored in casacore and in HDF5 format. The attributes are divided into group which are handled by ImageAttrGroup. A group (e.g. LOFAR_SOURCES) maps to a subtable in casacore format and a group in HDF5 format.

Example

This example shows how to get attributes from an image.

// Open the image (done as read/write when having write access).
PagedImage<Float> myimage ("image.name");
// Get access to the attibute handler.
ImageAttrHandler& attrHandler = myimage.attrHandler();
// Get the names of all attribute groups.
Vector<String> groupNames = attrHandler.groupNames();
// Create a new group and define an attribute defining Freq in Hz.
ImageAttrGroup& newGroup = attrHandler.createGroup ("NEW_GROUP");
newGroup.putAttr ("Freq", ValueHolder(Vector<Double>(1, 1e7)),
Vector<String>(1,"Hz"));

Motivation

LOFAR needed functionality to store arbitrary attributes.

Definition at line 91 of file ImageAttrHandler.h.

Constructor & Destructor Documentation

casacore::ImageAttrHandler::ImageAttrHandler ( )
inline

Default constructor.

Definition at line 95 of file ImageAttrHandler.h.

virtual casacore::ImageAttrHandler::~ImageAttrHandler ( )
virtual

Member Function Documentation

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

Close the group with the given name.

The default implementation does nothing.

Reimplemented in casacore::ImageAttrHandlerHDF5, and casacore::ImageAttrHandlerCasa.

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

Create an attribute group with the given name.

The default implementation throws an exception.

Reimplemented in casacore::ImageAttrHandlerHDF5, and casacore::ImageAttrHandlerCasa.

virtual void casacore::ImageAttrHandler::flush ( )
virtual

Flush the attibrutes if needed.

The default implementation does nothing.

Reimplemented in casacore::ImageAttrHandlerHDF5, and casacore::ImageAttrHandlerCasa.

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

Get all attribute group names.

The default implementation returns an empty vector.

Reimplemented in casacore::ImageAttrHandlerHDF5, and casacore::ImageAttrHandlerCasa.

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

Test if the given attribute group is present.

The default implementation returns False.

Reimplemented in casacore::ImageAttrHandlerHDF5, and casacore::ImageAttrHandlerCasa.

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

Get access to a group.

The default implementation throws an exception.

Reimplemented in casacore::ImageAttrHandlerHDF5, and casacore::ImageAttrHandlerCasa.


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