casacore
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::ImageInfo Class Reference

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. 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;
ImageInfo()
Default constructor.
Quantum< Double > Quantity
Definition: Quantum.h:38

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

◆ ImageTypes

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

◆ ImageInfo() [1/2]

casacore::ImageInfo::ImageInfo ( )

Default constructor.

◆ ~ImageInfo()

casacore::ImageInfo::~ImageInfo ( )

Destructor.

◆ ImageInfo() [2/2]

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

Copy constructor (copy semantics)

Member Function Documentation

◆ _checkBeamShape()

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.

◆ _setRestoringBeam()

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

Set the restoring beam from the record.

◆ appendBeams()

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.

◆ beamToRecord()

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

Convert the given beam to a Record.

◆ checkBeamSet()

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

Check if the beam set matches the coordinate axes sizes.

◆ combineBeams()

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.

◆ concatFreqBeams()

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.

◆ concatPolBeams()

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.

◆ copy_other()

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

Common copy ctor/assignment operator code.

◆ defaultImageType()

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.

◆ defaultObjectName()

static String casacore::ImageInfo::defaultObjectName ( )
static

◆ defaultRestoringBeam()

static GaussianBeam casacore::ImageInfo::defaultRestoringBeam ( )
static

◆ fromFITS()

Bool casacore::ImageInfo::fromFITS ( Vector< String > &  error,
const RecordInterface inRecord 
)

◆ fromRecord()

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.

◆ getBeamAreaInPixels() [1/2]

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

◆ getBeamAreaInPixels() [2/2]

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

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

◆ getBeamSet()

const ImageBeamSet& casacore::ImageInfo::getBeamSet ( ) const

Get the beam set associated with this object.

◆ getRestoringBeam()

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.

◆ hasBeam()

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

◆ hasMultipleBeams()

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

◆ hasSingleBeam()

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

◆ imageType() [1/3]

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

Set and get the Image Type.

◆ imageType() [2/3]

static String casacore::ImageInfo::imageType ( ImageInfo::ImageTypes  type)
static

◆ imageType() [3/3]

static ImageInfo::ImageTypes casacore::ImageInfo::imageType ( String  type)
static

◆ imageTypeFromFITS()

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.

◆ keywordNamesFITS()

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.

◆ logMessage()

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.

◆ mergeBeams()

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

Merge the beam sets and check if they match.

◆ MiriadImageType()

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.

◆ nChannels()

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

◆ nStokes()

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

Definition at line 252 of file ImageInfo.h.

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

◆ objectName()

String casacore::ImageInfo::objectName ( ) const

Set and get the Image object name.

◆ operator=()

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

Assignment (copy semantics)

◆ removeRestoringBeam()

void casacore::ImageInfo::removeRestoringBeam ( )

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

◆ restoringBeam()

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.

◆ setAllBeams()

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

Initialize all per-plane beams to the same value.

◆ setBeam() [1/2]

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

◆ setBeam() [2/2]

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.

◆ setBeams()

void casacore::ImageInfo::setBeams ( const ImageBeamSet beams)

Set the per plane beams array directly.

◆ setImageType()

ImageInfo& casacore::ImageInfo::setImageType ( ImageTypes  type)

◆ setInfoSplitBeamSet()

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.

◆ setObjectName()

ImageInfo& casacore::ImageInfo::setObjectName ( const String object)

◆ setRestoringBeam() [1/2]

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

◆ setRestoringBeam() [2/2]

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 casacore::pa(), and setRestoringBeam().

◆ toFITS()

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

◆ toRecord()

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

◆ _beams

ImageBeamSet casacore::ImageInfo::_beams
private

Definition at line 362 of file ImageInfo.h.

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

◆ _warnBeam

Bool casacore::ImageInfo::_warnBeam
mutableprivate

Definition at line 363 of file ImageInfo.h.

◆ itsImageType

ImageTypes casacore::ImageInfo::itsImageType
private

Definition at line 364 of file ImageInfo.h.

◆ itsObjectName

String casacore::ImageInfo::itsObjectName
private

Definition at line 365 of file ImageInfo.h.


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