Loading...
Searching...
No Matches
casacore::ImageAttrHandler Class Reference
images package (libcasa_images) » Images_module

More...

`#include <ImageAttrHandler.h>`

## Public Member Functions

| ImageAttrHandler ()
| Default constructor.
virtual | ~ImageAttrHandler ()
virtual void | flush ()
| Flush the attibrutes if needed.
virtual Bool | hasGroup (const String &name)
| Test if the given attribute group is present.
virtual Vector< String > | groupNames () const
| Get all attribute group names.
virtual ImageAttrGroup & | openGroup (const String &groupName)
| Get access to a group.
virtual ImageAttrGroup & | createGroup (const String &groupName)
| Create an attribute group with the given name.
virtual void | closeGroup (const String &groupName)
| Close the group with the given name.

## Detailed Description

Abstract base class for an image attributes handler.

### Intended use:

Public interface

### Review Status

Test programs:
  tPagedmage
Demo programs:
  dPagedImage

### Prerequisite

- ImageInterface

### 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"));
casacore::ImageAttrGroup
Definition ImageAttrGroup.h:114
casacore::ImageAttrHandler::createGroup
virtual ImageAttrGroup & createGroup(const String &groupName)
Create an attribute group with the given name.
casacore::ImageAttrHandler::groupNames
virtual Vector< String > groupNames() const
Get all attribute group names.
casacore::ImageAttrHandler::ImageAttrHandler
ImageAttrHandler()
Default constructor.
Definition ImageAttrHandler.h:93
casacore::PagedImage
Definition PagedImage.h:134
casacore::ValueHolder
Definition ValueHolder.h:66
casacore::Vector
Definition Vector.h:82

### Motivation

LOFAR needed functionality to store arbitrary attributes.

Definition at line 89 of file ImageAttrHandler.h.

## Constructor & Destructor Documentation

## ImageAttrHandler()

casacore::ImageAttrHandler::ImageAttrHandler | ( |  | ) |

inline

Default constructor.

Definition at line 93 of file ImageAttrHandler.h.

## ~ImageAttrHandler()

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

virtual

## Member Function Documentation

## closeGroup()

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

virtual

Close the group with the given name.

The default implementation does nothing.

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

## createGroup()

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::ImageAttrHandlerCasa, and casacore::ImageAttrHandlerHDF5.

## flush()

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

virtual

Flush the attibrutes if needed.

The default implementation does nothing.

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

## groupNames()

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

virtual

Get all attribute group names.

The default implementation returns an empty vector.

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

## hasGroup()

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::ImageAttrHandlerCasa, and casacore::ImageAttrHandlerHDF5.

References casacore::name().

## openGroup()

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

virtual

Get access to a group.

The default implementation throws an exception.

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

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

- images/Images/ImageAttrHandler.h