ImageInfo.h

Classes

ImageInfo -- Miscellaneous information related to an image. (full description)
Global Functions -- Global functions (full description)

class ImageInfo : public RecordTransformable

Types

enum ImageTypes

Undefined = 0
Intensity
Beam
ColumnDensity
DepolarizationRatio
KineticTemperature
MagneticField
OpticalDepth
RotationMeasure
RotationalTemperature
SpectralIndex
Velocity
VelocityDispersion
nTypes

Interface

Public Members
ImageInfo()
~ImageInfo()
ImageInfo(const ImageInfo &other)
ImageInfo &operator=(const ImageInfo &other)
Vector<Quantum<Double> > restoringBeam() const
ImageInfo& setRestoringBeam(const Vector<Quantum<Double> >& beam)
ImageInfo& setRestoringBeam(const Quantum<Double>& major, const Quantum<Double>& minor, const Quantum<Double>& pa)
ImageInfo& removeRestoringBeam()
Bool getRestoringBeam (LoggerHolder& logger)
ImageInfo::ImageTypes imageType () const
ImageInfo& setImageType(ImageTypes type)
static String imageType(ImageInfo::ImageTypes type)
static ImageInfo::ImageTypes imageType(String type)
virtual Bool toRecord(String & error, RecordInterface & outRecord) const
virtual Bool fromRecord(String & error, const RecordInterface & inRecord)
static Vector<Quantum<Double> > defaultRestoringBeam()
static ImageTypes defaultImageType()
Bool toFITS(String & error, RecordInterface & outRecord) const
Bool fromFITS(Vector<String>& error, const RecordInterface & inRecord)
static ImageInfo::ImageTypes imageTypeFromFITS(Int fitsValue)
static Vector<String> keywordNamesFITS()
static ImageInfo::ImageTypes MiriadImageType (const String& type)
Private Members
void copy_other(const ImageInfo &other)

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Synopsis

This class is used to record information about an image. At present it contains the following:
  1. The restoring beam
  2. A parameter describing what quantity the image holds.
This list can easily be extended if necessary.

Example

The interface is a simple get/set interface. Note that the "set" methods can be chained together since each set method returns a reference to its object (rather like cout).
    ImageInfo ii;
    ii.setRestoringBeam(Quantity(30,"arcsec"), Quantity(10,"arcsec"),
                        Quantity(-18,"deg"));
    ...
    cout << "The restoring beam is : " << oi.restoringBeam() << endl;

Motivation

This sort of information needed a standard place to go with a standard interface so it could be moved out of MiscInfo.

To Do

Member Description

enum ImageTypes

This enum defines the actual quantity being held in an image It's really only used for descriptive information.

ImageInfo()

Default constructor

~ImageInfo()

Destructor

ImageInfo(const ImageInfo &other)

Copy constructor (copy semantics)

ImageInfo &operator=(const ImageInfo &other)

Assignment (copy semantics)

Vector<Quantum<Double> > restoringBeam() const
ImageInfo& setRestoringBeam(const Vector<Quantum<Double> >& beam)
ImageInfo& setRestoringBeam(const Quantum<Double>& major, const Quantum<Double>& minor, const Quantum<Double>& pa)
ImageInfo& removeRestoringBeam()

Set and get the restoring beam. Vector beam in order major axis, minor axis, position angle.

Bool getRestoringBeam (LoggerHolder& logger)

Get the restoring beam from a LoggerHolder (where the history is stored) as AIPS writes the beam in the FITS history rather than the header keywords. If there is no beam, False is returned, and the internal state of the object is unchanged.

ImageInfo::ImageTypes imageType () const
ImageInfo& setImageType(ImageTypes type)
static String imageType(ImageInfo::ImageTypes type)
static ImageInfo::ImageTypes imageType(String type)

Set and get the Image Type.

virtual Bool toRecord(String & error, RecordInterface & outRecord) const
virtual Bool fromRecord(String & error, const RecordInterface & inRecord)

Functions to interconvert between an ImageInfo and a record. These functions are inherited from class RecordTransformable. As new fields get added to ImageInfo these functions should be augmented. Missing fields should not generate an error to in fromRecord to allow for backwards compatibility - null values should be supplied instead. The record field names are: "restoringbeam".

static Vector<Quantum<Double> > defaultRestoringBeam()
static ImageTypes defaultImageType()

In some circumstances it might be useful to know what the defaults for the various values are so you can check if they have been set. The default restoring beam is a null vector.

Bool toFITS(String & error, RecordInterface & outRecord) const
Bool fromFITS(Vector<String>& error, const RecordInterface & inRecord)

Functions to interconvert between an ImageInfo and FITS keywords (converted to a Record). Failure of fromFITS should probably not be regarded as fatal as the default ImageInfo values are viable. For each item contained in the ImageInfo, an attempt to decode it from FITS is made. If any of them fail, False is returned, but it attempts to decode them all. For those that fail an error message is held in error in the order restoring beam, and image type. error will be returned of length 0 if the return value is True, else it will be length 2.

static ImageInfo::ImageTypes imageTypeFromFITS(Int fitsValue)

This function takes an unofficial fitsValue found on the Stokes axis and returns the appropriate ImageType. The idea is that you detect the unofficial value, drop the Stokes axis, and store the value as an ImageType in ImageInfo. Only values pertaining to beam, optical depth and spectral index are handled here. All others give back Undefined. See usage in Image FITS conversion classes.

static Vector<String> keywordNamesFITS()

It might be useful to know what FITS keyword names are used in to/from FITS so we can remove them so they won't be used more than once. The names are in lower case.

static ImageInfo::ImageTypes MiriadImageType (const String& type)

Convert the Miriad 'btype' strings to the ImageType. Some Miriad 'btype's are dealt with in aips++ via the Stokes axis (fractional_polarization, polarized_intensity, position_angle) and so these will return Undefined.

void copy_other(const ImageInfo &other)

Common copy ctor/assignment operator code.


Global functions (source)

Interface

ostream &operator<<(ostream &os, const ImageInfo &info)

Description

Member Description

ostream &operator<<(ostream &os, const ImageInfo &info)

Output declaration - useful for debugging.