casa
$Rev:20696$
|
Miscellaneous information related to an image. More...
#include <ImageInfo.h>
Public Types | |
enum | ImageTypes { Undefined, Intensity, Beam, ColumnDensity, DepolarizationRatio, KineticTemperature, MagneticField, OpticalDepth, RotationMeasure, RotationalTemperature, SpectralIndex, Velocity, VelocityDispersion, nTypes } |
This enum defines the actual quantity being held in an image It's really only used for descriptive information. More... | |
Public Member Functions | |
ImageInfo () | |
Default constructor. | |
~ImageInfo () | |
Destructor. | |
ImageInfo (const ImageInfo &other) | |
Copy constructor (copy semantics) | |
ImageInfo & | operator= (const ImageInfo &other) |
Assignment (copy semantics) | |
GaussianBeam | restoringBeam (const Int channel=-1, const Int polarization=-1) const |
Set and get the beam. | |
void | setRestoringBeam (const GaussianBeam &beam) |
set the single global restoring beam. | |
void | removeRestoringBeam () |
Remove all beams (global or per plane) associated with this object. | |
Bool | getRestoringBeam (LoggerHolder &logger) |
This method is not meant for common use. | |
ImageInfo::ImageTypes | imageType () const |
Set and get the Image Type. | |
ImageInfo & | setImageType (ImageTypes type) |
String | objectName () const |
Set and get the Image object name. | |
ImageInfo & | setObjectName (const String &object) |
virtual Bool | toRecord (String &error, RecordInterface &outRecord) const |
Functions to interconvert between an ImageInfo and a record. | |
virtual Bool | fromRecord (String &error, const RecordInterface &inRecord) |
Initialise the class from a Record representation. | |
Bool | toFITS (String &error, RecordInterface &outRecord) const |
Functions to interconvert between an ImageInfo and FITS keywords (converted to a Record). | |
Bool | fromFITS (Vector< String > &error, const RecordInterface &inRecord) |
const ImageBeamSet & | getBeamSet () const |
get the beam set associated with this object | |
void | setBeam (const Int channel, const Int stokes, const Quantity &major, const Quantity &minor, const Quantity &pa) |
set the beam for a specific plane. | |
void | setBeam (const Int channel, const Int stokes, const GaussianBeam &beam) |
Bool | hasMultipleBeams () const |
does this object contain multiple beams? | |
Bool | hasSingleBeam () const |
does this object conain a single beam | |
Bool | hasBeam () const |
does this object contain one or more beams? | |
uInt | nChannels () const |
inline const Array<Vector<Quantity> >& getHyperPlaneBeams() const { return _hyperplaneBeams; } | |
uInt | nStokes () const |
void | setAllBeams (const uInt nChannels, const uInt nPolarizations, const GaussianBeam &beam) |
initialize all per-plane beams to the same value | |
void | setBeams (const ImageBeamSet &beams) |
set the per plane beams array directly. | |
Record | beamToRecord (const Int channel, const Int stokes) const |
Static Public Member Functions | |
static String | imageType (ImageInfo::ImageTypes type) |
static ImageInfo::ImageTypes | imageType (String type) |
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. | |
static String | defaultObjectName () |
static GaussianBeam | defaultRestoringBeam () |
static ImageInfo::ImageTypes | imageTypeFromFITS (Int fitsValue) |
This function takes an unofficial fitsValue found on the Stokes axis and returns the appropriate ImageType. | |
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. | |
static ImageInfo::ImageTypes | MiriadImageType (const String &type) |
Convert the Miriad 'btype' strings to the ImageType. | |
Private Member Functions | |
void | copy_other (const ImageInfo &other) |
Array<Vector<Quantum<Double> > > _hyperplaneBeams; uInt _nStokes, _nChannels; Common copy ctor/assignment operator code. | |
void | _validateChannelStokes (Int &channel, Int &stokes) const |
GaussianBeam | _getBeam (const Int channel, const Int stokes) const |
Get the beam for hyper plane for the corresponding channel and/or stokes. | |
IPosition | _beamPosition (const Int channel, const Int polarization) const |
void | _setUpBeamArray (const uInt nChan, const uInt nStokes) |
determine what the shape of the _beams array should be | |
void | _getChansAndStokes (uInt &nChannels, uInt &nStokes) const |
convenience method for getting number of channels and polarizations from the beam array | |
void | _setRestoringBeam (const Record &inRecord) |
Static Private Member Functions | |
static String | _className () |
Private Attributes | |
ImageBeamSet | _beams |
Vector<Quantum<Double> > itsRestoringBeam;. | |
ImageInfo::ImageTypes | itsImageType |
String | itsObjectName |
Miscellaneous information related to an image.
Public interface
This class is used to record information about an image. At present it contains the following:
Support for per plane (eg channel) dependent beams have been added.
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;
This sort of information needed a standard place to go with a standard interface so it could be moved out of MiscInfo.
Definition at line 92 of file ImageInfo.h.
This enum defines the actual quantity being held in an image It's really only used for descriptive information.
Undefined | |
Intensity | |
Beam | |
ColumnDensity | |
DepolarizationRatio | |
KineticTemperature | |
MagneticField | |
OpticalDepth | |
RotationMeasure | |
RotationalTemperature | |
SpectralIndex | |
Velocity | |
VelocityDispersion | |
nTypes |
Definition at line 98 of file ImageInfo.h.
Default constructor.
Destructor.
casa::ImageInfo::ImageInfo | ( | const ImageInfo & | other | ) |
Copy constructor (copy semantics)
IPosition casa::ImageInfo::_beamPosition | ( | const Int | channel, |
const Int | polarization | ||
) | const [private] |
static String casa::ImageInfo::_className | ( | ) | [inline, static, private] |
Definition at line 310 of file ImageInfo.h.
References casa::C::c.
GaussianBeam casa::ImageInfo::_getBeam | ( | const Int | channel, |
const Int | stokes | ||
) | const [private] |
Get the beam for hyper plane for the corresponding channel and/or stokes.
If no frequency axis, channel should be less than zero, if no polarization axis, stokes should be less than zero.
void casa::ImageInfo::_getChansAndStokes | ( | uInt & | nChannels, |
uInt & | nStokes | ||
) | const [private] |
convenience method for getting number of channels and polarizations from the beam array
void casa::ImageInfo::_setRestoringBeam | ( | const Record & | inRecord | ) | [private] |
void casa::ImageInfo::_setUpBeamArray | ( | const uInt | nChan, |
const uInt | nStokes | ||
) | [private] |
determine what the shape of the _beams array should be
void casa::ImageInfo::_validateChannelStokes | ( | Int & | channel, |
Int & | stokes | ||
) | const [private] |
Record casa::ImageInfo::beamToRecord | ( | const Int | channel, |
const Int | stokes | ||
) | const |
void casa::ImageInfo::copy_other | ( | const ImageInfo & | other | ) | [private] |
Array<Vector<Quantum<Double> > > _hyperplaneBeams; uInt _nStokes, _nChannels; Common copy ctor/assignment operator code.
static ImageTypes casa::ImageInfo::defaultImageType | ( | ) | [static] |
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.
static GaussianBeam defaultRestoringBeam();
static String casa::ImageInfo::defaultObjectName | ( | ) | [static] |
static GaussianBeam casa::ImageInfo::defaultRestoringBeam | ( | ) | [static] |
Bool casa::ImageInfo::fromFITS | ( | Vector< String > & | error, |
const RecordInterface & | inRecord | ||
) |
virtual Bool casa::ImageInfo::fromRecord | ( | String & | error, |
const RecordInterface & | inRecord | ||
) | [virtual] |
Initialise the class from a Record representation.
The input record should contain the fields that are required by the class. Other fields will be ignored. If the transformation succeeds then the error String is unchanged and the function returns True. Otherwise the function returns False and appends an error message to the supplied String giving the reason why the conversion failed.
Implements casa::RecordTransformable.
const ImageBeamSet& casa::ImageInfo::getBeamSet | ( | ) | const |
get the beam set associated with this object
Bool casa::ImageInfo::getRestoringBeam | ( | LoggerHolder & | logger | ) |
This method is not meant for common use.
New code should not use it. 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.
Bool casa::ImageInfo::hasBeam | ( | ) | const |
does this object contain one or more beams?
Bool casa::ImageInfo::hasMultipleBeams | ( | ) | const |
does this object contain multiple beams?
Bool casa::ImageInfo::hasSingleBeam | ( | ) | const |
does this object conain a single beam
Set and get the Image Type.
static String casa::ImageInfo::imageType | ( | ImageInfo::ImageTypes | type | ) | [static] |
static ImageInfo::ImageTypes casa::ImageInfo::imageType | ( | String | type | ) | [static] |
static ImageInfo::ImageTypes casa::ImageInfo::imageTypeFromFITS | ( | Int | fitsValue | ) | [static] |
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> casa::ImageInfo::keywordNamesFITS | ( | ) | [static] |
static ImageInfo::ImageTypes casa::ImageInfo::MiriadImageType | ( | const String & | type | ) | [static] |
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.
uInt casa::ImageInfo::nChannels | ( | ) | const |
inline const Array<Vector<Quantity> >& getHyperPlaneBeams() const { return _hyperplaneBeams; }
Number of channels and polarizations in per hyper-plane beam array
uInt casa::ImageInfo::nStokes | ( | ) | const |
String casa::ImageInfo::objectName | ( | ) | const |
Set and get the Image object name.
void casa::ImageInfo::removeRestoringBeam | ( | ) |
Remove all beams (global or per plane) associated with this object.
GaussianBeam casa::ImageInfo::restoringBeam | ( | const Int | channel = -1 , |
const Int | polarization = -1 |
||
) | const |
Set and get the beam.
Zero-based channel
and polarization
are necessary and used if and only if the ImageBeamSet has multiple beams. If just a single beam, that beam is returned. If no (or a null) beam, a null beam is returned.
void casa::ImageInfo::setAllBeams | ( | const uInt | nChannels, |
const uInt | nPolarizations, | ||
const GaussianBeam & | beam | ||
) |
initialize all per-plane beams to the same value
void casa::ImageInfo::setBeam | ( | const Int | channel, |
const Int | stokes, | ||
const Quantity & | major, | ||
const Quantity & | minor, | ||
const Quantity & | pa | ||
) |
set the beam for a specific plane.
A value of channel
or stokes
of less than 0 means that particular coordinate does not exist. Obviously, at least one of these must be zero or greater. The only consistency checking that is done is to ensure the values of channel
and stokes
are consistent with the size of the beam array Additional consistency checks are done when this object is added via ImageInterface<T>::setImageInfo().
void casa::ImageInfo::setBeam | ( | const Int | channel, |
const Int | stokes, | ||
const GaussianBeam & | beam | ||
) |
void casa::ImageInfo::setBeams | ( | const ImageBeamSet & | beams | ) |
set the per plane beams array directly.
If the dimensionality of beams
is 1, one hasSpectral
or hasPolarization
must be True and the other False. If the dimensionality of beams
is 2, hasSpectral
and hasPolarization
are ignored.
ImageInfo& casa::ImageInfo::setObjectName | ( | const String & | object | ) |
void casa::ImageInfo::setRestoringBeam | ( | const GaussianBeam & | beam | ) |
set the single global restoring beam.
An exception will be thrown if this object already has multiple beams. In that case, the caller must call removeRestoringBeam() first.
Bool casa::ImageInfo::toFITS | ( | String & | error, |
RecordInterface & | outRecord | ||
) | const |
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.
virtual Bool casa::ImageInfo::toRecord | ( | String & | error, |
RecordInterface & | outRecord | ||
) | const [virtual] |
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, imagetype, objectname".
Implements casa::RecordTransformable.
ImageBeamSet casa::ImageInfo::_beams [private] |
Vector<Quantum<Double> > itsRestoringBeam;.
Definition at line 282 of file ImageInfo.h.
Definition at line 283 of file ImageInfo.h.
String casa::ImageInfo::itsObjectName [private] |
Definition at line 284 of file ImageInfo.h.