casacore
|
#include <ImageAttrGroup.h>
Public Member Functions | |
ImageAttrGroup () | |
Default constructor. More... | |
virtual | ~ImageAttrGroup () |
virtual uInt | nrows () const =0 |
Get the number of rows in the group. More... | |
virtual Bool | hasAttr (const String &attrName) const =0 |
Test if an attribute exists. More... | |
virtual Vector< String > | attrNames () const =0 |
Get all attribute names. More... | |
virtual DataType | dataType (const String &attrName) const =0 |
Get the datatype of a attribute. More... | |
virtual ValueHolder | getData (const String &attrName, uInt rownr)=0 |
Get the data of the given attribute in the given row. More... | |
virtual Record | getDataRow (uInt rownr)=0 |
Get the data of all attributes in a rows. More... | |
virtual Vector< String > | getUnit (const String &attrName)=0 |
Get the possible units of the values. More... | |
virtual Vector< String > | getMeasInfo (const String &attrName)=0 |
Get the possible measure info as type and Ref. More... | |
virtual void | putData (const String &attrName, uInt rownr, const ValueHolder &data, const Vector< String > &units=Vector< String >(), const Vector< String > &measInfo=Vector< String >())=0 |
Put the data of the given attribute in the given row. More... | |
Abstract base class for an image attributes group.
Public interface
This class makes it possible to store extra attributes with an image to describe atrbitrary meta information.
For LOFAR it is needed to store extra meta information and be possible 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 attributes can be stored and retrieved in a way that is agnostic to the format the image is stored in. It must also work fine for an image stored in FITS format, be it that such an image cannot have such attributes.
The attributes are divided into groups. A group resides in a subtable of a casacore image or in a group of an HDF5 image. This class handles the attributes of a group. It can get and put the attribute values, as well as their unit and measure info (type and reference frame type). For HDF5 images the unit is stored in attribute attrname>_UNIT
and the measure info in attrname>_MEASINFO
. For casacore images that info is stored as TableMeasure info in the column keywords.
All attributes in a group must have the same number of values, where each value can be a scalar or (small) array. The unit and measure info have only one value, thus all values of an attribute have the same unit.
This example shows how to get attributes from an image.
The following example shows how to add a group and attribute.
LOFAR needed functionality to store arbitrary attributes.
Definition at line 116 of file ImageAttrGroup.h.
|
inline |
Default constructor.
Definition at line 120 of file ImageAttrGroup.h.
|
virtual |
Get all attribute names.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
|
pure virtual |
Get the datatype of a attribute.
It returns TpOther if the attribute is not defined.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
|
pure virtual |
Get the data of the given attribute in the given row.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
Get the data of all attributes in a rows.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
|
pure virtual |
Get the possible measure info as type and Ref.
An empty vector is returned if the attribute has no MEASINFO.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
Get the possible units of the values.
An empty vector is returned if the attribute has no units.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
Test if an attribute exists.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
|
pure virtual |
Get the number of rows in the group.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.
|
pure virtual |
Put the data of the given attribute in the given row.
If the row or attribute is new, it will be added. Note that the new row must be directly after the last row in the group.
If not empty, the units and MEASINFO will be put as column keywords. The MEASINFO vector must be given as type,Ref.
Implemented in casacore::ImageAttrGroupHDF5, and casacore::ImageAttrGroupCasa.