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

Miscellaneous information related to an image. More...

#include <ImageInfo.h>

Inheritance diagram for casacore::ImageInfo:
casacore::RecordTransformable

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. More...
 
 ~ImageInfo ()
 Destructor. More...
 
 ImageInfo (const ImageInfo &other)
 Copy constructor (copy semantics) More...
 
ImageInfooperator= (const ImageInfo &other)
 Assignment (copy semantics) More...
 
ImageInfo::ImageTypes imageType () const
 Set and get the Image Type. More...
 
ImageInfosetImageType (ImageTypes type)
 
String objectName () const
 Set and get the Image object name. More...
 
ImageInfosetObjectName (const String &object)
 
virtual Bool toRecord (String &error, RecordInterface &outRecord) const
 Functions to interconvert between an ImageInfo and a record. More...
 
virtual Bool fromRecord (String &error, const RecordInterface &inRecord)
 Initialise the class from a Record representation. More...
 
Bool toFITS (String &error, RecordInterface &outRecord) const
 Functions to interconvert between an ImageInfo and FITS keywords (converted to a Record). More...
 
Bool fromFITS (Vector< String > &error, const RecordInterface &inRecord)
 
GaussianBeam restoringBeam (Int channel=-1, Int stokes=-1) const
 Set and get the beam. More...
 
void setRestoringBeam (const GaussianBeam &beam)
 Set the single global restoring beam. More...
 
void setRestoringBeam (const Quantum< Double > &major, const Quantum< Double > &minor, const Quantum< Double > &pa)
 
void removeRestoringBeam ()
 Remove all beams (global or per plane) associated with this object. More...
 
const ImageBeamSetgetBeamSet () const
 Get the beam set associated with this object. More...
 
void setBeam (Int channel, Int stokes, const Quantity &major, const Quantity &minor, const Quantity &pa)
 Set the beam for a specific plane. More...
 
void setBeam (Int channel, Int stokes, const GaussianBeam &beam)
 
Bool hasMultipleBeams () const
 does this object contain multiple beams? More...
 
Bool hasSingleBeam () const
 does this object contain a single beam More...
 
Bool hasBeam () const
 Does this object contain one or more beams? More...
 
uInt nChannels () const
 Number of channels and stokes in per hyper-plane beam array. More...
 
uInt nStokes () const
 
void setAllBeams (const uInt nChannels, const uInt nStokes, const GaussianBeam &beam)
 Initialize all per-plane beams to the same value. More...
 
void setBeams (const ImageBeamSet &beams)
 Set the per plane beams array directly. More...
 
Bool getRestoringBeam (LoggerHolder &logger)
 This method is not meant for common use. More...
 
Record beamToRecord (Int channel, Int stokes) const
 Convert the given beam to a Record. More...
 
void checkBeamSet (const CoordinateSystem &coords, const IPosition &shape, const String &imageName) const
 Check if the beam set matches the coordinate axes sizes. More...
 
void appendBeams (ImageInfo &infoThat, Int axis, Bool relax, LogIO &os, const CoordinateSystem &csysThis, const CoordinateSystem &csysThat, const IPosition &shapeThis, const IPosition &shapeThat)
 Append the other beamset to this one. More...
 
void combineBeams (const ImageInfo &infoThat, const IPosition &shapeThis, const IPosition &shapeThat, const CoordinateSystem &csysThis, const CoordinateSystem &csysThat, Int axis, Bool relax, LogIO &os)
 Combine beam sets for the concatenation of images and replace the beamset in this object by the result. More...
 
uInt setInfoSplitBeamSet (uInt ndone, const ImageInfo &concatInfo, const IPosition &shape, const CoordinateSystem &csys, Int concatAxis)
 Reset the info and beamset of this image with the appropriate part of the beam set of the concat image it is part of. More...
 
void concatFreqBeams (ImageBeamSet &beamsOut, const ImageInfo &infoThat, Int nchanThis, Int nchanThat, Bool relax, LogIO &os) const
 Concatenate the beam sets along the frequency axis. More...
 
void concatPolBeams (ImageBeamSet &beamsOut, const ImageInfo &infoThat, Int npolThis, Int npolThat, Bool relax, LogIO &os) const
 Concatenate the beam sets along the stokes axis. More...
 
void mergeBeams (ImageBeamSet &beamsOut, const ImageInfo &infoThat, Bool relax, LogIO &os) const
 Merge the beam sets and check if they match. More...
 
Double getBeamAreaInPixels (Int channel, Int stokes, const DirectionCoordinate &) const
 Get the beam area in terms of pixel size of the specified DirectionCoordinate. More...
 
- Public Member Functions inherited from casacore::RecordTransformable
virtual ~RecordTransformable ()
 The destructor must be virtual so that the destructor of derived classes is actually used. More...
 
virtual Bool fromString (String &error, const String &inString)
 Initialise the class from a String representation. More...
 
virtual const Stringident () const
 Specify the identification of the record (e.g. More...
 

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. More...
 
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. More...
 
static Vector< StringkeywordNamesFITS ()
 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. More...
 
static ImageInfo::ImageTypes MiriadImageType (const String &type)
 Convert the Miriad 'btype' strings to the ImageType. More...
 
static void logMessage (Bool &warn, LogIO &os, Bool relax, const String &msg1, const String msg2=String())
 If relax=True, give a warning message if warn=True and set to False. More...
 
static Double getBeamAreaInPixels (const GaussianBeam &beam, const DirectionCoordinate &dc)
 

Private Member Functions

void copy_other (const ImageInfo &other)
 Common copy ctor/assignment operator code. More...
 
void _setRestoringBeam (const Record &inRecord)
 Set the restoring beam from the record. More...
 
void _checkBeamShape (uInt &nchan, uInt &npol, const IPosition &shape, const CoordinateSystem &csys) const
 Check if the beam shape matches the coordinates. More...
 

Private Attributes

ImageBeamSet _beams
 
Bool _warnBeam
 
ImageTypes itsImageType
 
String itsObjectName
 

Detailed Description

Miscellaneous information related to an image.

Intended use:

Public interface

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(s)
  2. A parameter describing what quantity the image holds.
  3. The image object name.

Support for per plane (eg channel) dependent beams have been added.

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).

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.

Definition at line 92 of file ImageInfo.h.

Member Enumeration Documentation

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

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

Definition at line 98 of file ImageInfo.h.

Constructor & Destructor Documentation

casacore::ImageInfo::ImageInfo ( )

Default constructor.

casacore::ImageInfo::~ImageInfo ( )

Destructor.

casacore::ImageInfo::ImageInfo ( const ImageInfo other)

Copy constructor (copy semantics)

Member Function Documentation

void casacore::ImageInfo::_checkBeamShape ( uInt nchan,
uInt npol,
const IPosition shape,
const CoordinateSystem csys 
) const
private

Check if the beam shape matches the coordinates.

It sets nchan and npol to the values in the image shape.

void casacore::ImageInfo::_setRestoringBeam ( const Record inRecord)
private

Set the restoring beam from the record.

void casacore::ImageInfo::appendBeams ( ImageInfo infoThat,
Int  axis,
Bool  relax,
LogIO os,
const CoordinateSystem csysThis,
const CoordinateSystem csysThat,
const IPosition shapeThis,
const IPosition shapeThat 
)

Append the other beamset to this one.

Record casacore::ImageInfo::beamToRecord ( Int  channel,
Int  stokes 
) const

Convert the given beam to a Record.

void casacore::ImageInfo::checkBeamSet ( const CoordinateSystem coords,
const IPosition shape,
const String imageName 
) const

Check if the beam set matches the coordinate axes sizes.

void casacore::ImageInfo::combineBeams ( const ImageInfo infoThat,
const IPosition shapeThis,
const IPosition shapeThat,
const CoordinateSystem csysThis,
const CoordinateSystem csysThat,
Int  axis,
Bool  relax,
LogIO os 
)

Combine beam sets for the concatenation of images and replace the beamset in this object by the result.

If channel or stokes is the concatenation axis, that beam axis is concatenated. Otherwise it is checked if both beam sets match and are merged. If relax=False, an exception is thrown if mismatching.

void casacore::ImageInfo::concatFreqBeams ( ImageBeamSet beamsOut,
const ImageInfo infoThat,
Int  nchanThis,
Int  nchanThat,
Bool  relax,
LogIO os 
) const

Concatenate the beam sets along the frequency axis.

void casacore::ImageInfo::concatPolBeams ( ImageBeamSet beamsOut,
const ImageInfo infoThat,
Int  npolThis,
Int  npolThat,
Bool  relax,
LogIO os 
) const

Concatenate the beam sets along the stokes axis.

void casacore::ImageInfo::copy_other ( const ImageInfo other)
private

Common copy ctor/assignment operator code.

static ImageTypes casacore::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 String casacore::ImageInfo::defaultObjectName ( )
static
static GaussianBeam casacore::ImageInfo::defaultRestoringBeam ( )
static
Bool casacore::ImageInfo::fromFITS ( Vector< String > &  error,
const RecordInterface inRecord 
)
virtual Bool casacore::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 casacore::RecordTransformable.

Double casacore::ImageInfo::getBeamAreaInPixels ( Int  channel,
Int  stokes,
const DirectionCoordinate  
) const

Get the beam area in terms of pixel size of the specified DirectionCoordinate.

static Double casacore::ImageInfo::getBeamAreaInPixels ( const GaussianBeam beam,
const DirectionCoordinate dc 
)
static
const ImageBeamSet& casacore::ImageInfo::getBeamSet ( ) const

Get the beam set associated with this object.

Bool casacore::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 casacore::ImageInfo::hasBeam ( ) const
inline

Does this object contain one or more beams?

Definition at line 245 of file ImageInfo.h.

References _beams, and casacore::ImageBeamSet::empty().

Bool casacore::ImageInfo::hasMultipleBeams ( ) const
inline

does this object contain multiple beams?

Definition at line 237 of file ImageInfo.h.

References _beams, and casacore::ImageBeamSet::hasMultiBeam().

Bool casacore::ImageInfo::hasSingleBeam ( ) const
inline

does this object contain a single beam

Definition at line 241 of file ImageInfo.h.

References _beams, and casacore::ImageBeamSet::hasSingleBeam().

ImageInfo::ImageTypes casacore::ImageInfo::imageType ( ) const

Set and get the Image Type.

static String casacore::ImageInfo::imageType ( ImageInfo::ImageTypes  type)
static
static ImageInfo::ImageTypes casacore::ImageInfo::imageType ( String  type)
static
static ImageInfo::ImageTypes casacore::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> casacore::ImageInfo::keywordNamesFITS ( )
static

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 void casacore::ImageInfo::logMessage ( Bool warn,
LogIO os,
Bool  relax,
const String msg1,
const String  msg2 = String() 
)
static

If relax=True, give a warning message if warn=True and set to False.

Otherwise give an error showing msg1 only.

void casacore::ImageInfo::mergeBeams ( ImageBeamSet beamsOut,
const ImageInfo infoThat,
Bool  relax,
LogIO os 
) const

Merge the beam sets and check if they match.

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

Convert the Miriad 'btype' strings to the ImageType.

Some Miriad 'btype's are dealt with in Casacore via the Stokes axis (fractional_polarization, polarized_intensity, position_angle) and so these will return Undefined.

uInt casacore::ImageInfo::nChannels ( ) const
inline

Number of channels and stokes in per hyper-plane beam array.

Definition at line 250 of file ImageInfo.h.

References _beams, and casacore::ImageBeamSet::nchan().

uInt casacore::ImageInfo::nStokes ( ) const
inline

Definition at line 252 of file ImageInfo.h.

References _beams, and casacore::ImageBeamSet::nstokes().

String casacore::ImageInfo::objectName ( ) const

Set and get the Image object name.

ImageInfo& casacore::ImageInfo::operator= ( const ImageInfo other)

Assignment (copy semantics)

void casacore::ImageInfo::removeRestoringBeam ( )

Remove all beams (global or per plane) associated with this object.

GaussianBeam casacore::ImageInfo::restoringBeam ( Int  channel = -1,
Int  stokes = -1 
) const

Set and get the beam.

Zero-based channel and stokes are necessary and used if and only if the ImageBeamSet has multiple beams for such an axis. If just a single beam, that beam is returned. If no (or a null) beam, a null beam is returned.

void casacore::ImageInfo::setAllBeams ( const uInt  nChannels,
const uInt  nStokes,
const GaussianBeam beam 
)

Initialize all per-plane beams to the same value.

void casacore::ImageInfo::setBeam ( Int  channel,
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().
This function cannot be used if no beams have been set via set(All)Beams.

void casacore::ImageInfo::setBeam ( Int  channel,
Int  stokes,
const GaussianBeam beam 
)
void casacore::ImageInfo::setBeams ( const ImageBeamSet beams)

Set the per plane beams array directly.

ImageInfo& casacore::ImageInfo::setImageType ( ImageTypes  type)
uInt casacore::ImageInfo::setInfoSplitBeamSet ( uInt  ndone,
const ImageInfo concatInfo,
const IPosition shape,
const CoordinateSystem csys,
Int  concatAxis 
)

Reset the info and beamset of this image with the appropriate part of the beam set of the concat image it is part of.

It returns the number of channels or polarizations handled.

ImageInfo& casacore::ImageInfo::setObjectName ( const String object)
void casacore::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.

Referenced by setRestoringBeam().

void casacore::ImageInfo::setRestoringBeam ( const Quantum< Double > &  major,
const Quantum< Double > &  minor,
const Quantum< Double > &  pa 
)
inline

Definition at line 209 of file ImageInfo.h.

References setRestoringBeam().

Bool casacore::ImageInfo::toFITS ( String error,
RecordInterface outRecord 
) const

Functions to interconvert between an ImageInfo and FITS keywords (converted to a Record).

Failure of <tt>fromFITS</tt>

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 casacore::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 casacore::RecordTransformable.

Member Data Documentation

ImageBeamSet casacore::ImageInfo::_beams
private

Definition at line 362 of file ImageInfo.h.

Referenced by hasBeam(), hasMultipleBeams(), hasSingleBeam(), nChannels(), and nStokes().

Bool casacore::ImageInfo::_warnBeam
mutableprivate

Definition at line 363 of file ImageInfo.h.

ImageTypes casacore::ImageInfo::itsImageType
private

Definition at line 364 of file ImageInfo.h.

String casacore::ImageInfo::itsObjectName
private

Definition at line 365 of file ImageInfo.h.


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