Loading...
Searching...
No Matches
casacore::ImageInfo Class Reference
images package (libcasa_images) » Images_module

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).
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)
GaussianBeam | restoringBeam (Int channel=-1, Int stokes=-1) const
| Set and get the beam.
void | setRestoringBeam (const GaussianBeam &beam)
| Set the single global restoring beam.
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.
const ImageBeamSet & | getBeamSet () const
| Get the beam set associated with this object.
void | setBeam (Int channel, Int stokes, const Quantity &major, const Quantity &minor, const Quantity &pa)
| Set the beam for a specific plane.
void | setBeam (Int channel, Int stokes, const GaussianBeam &beam)
Bool | hasMultipleBeams () const
| does this object contain multiple beams?
Bool | hasSingleBeam () const
| does this object contain a single beam
Bool | hasBeam () const
| Does this object contain one or more beams?
uInt | nChannels () const
| Number of channels and stokes in per hyper-plane beam array.
uInt | nStokes () const
void | setAllBeams (const uInt nChannels, const uInt nStokes, const GaussianBeam &beam)
| Initialize all per-plane beams to the same value.
void | setBeams (const ImageBeamSet &beams)
| Set the per plane beams array directly.
Bool | getRestoringBeam (LoggerHolder &logger)
| This method is not meant for common use.
Record | beamToRecord (Int channel, Int stokes) const
| Convert the given beam to a Record.
void | checkBeamSet (const CoordinateSystem &coords, const IPosition &shape, const String &imageName) const
| Check if the beam set matches the coordinate axes sizes.
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.
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.
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.
void | concatFreqBeams (ImageBeamSet &beamsOut, const ImageInfo &infoThat, Int nchanThis, Int nchanThat, Bool relax, LogIO &os) const
| Concatenate the beam sets along the frequency axis.
void | concatPolBeams (ImageBeamSet &beamsOut, const ImageInfo &infoThat, Int npolThis, Int npolThat, Bool relax, LogIO &os) const
| Concatenate the beam sets along the stokes axis.
void | mergeBeams (ImageBeamSet &beamsOut, const ImageInfo &infoThat, Bool relax, LogIO &os) const
| Merge the beam sets and check if they match.
Double | getBeamAreaInPixels (Int channel, Int stokes, const DirectionCoordinate &) const
| Get the beam area in terms of pixel size of the specified DirectionCoordinate.
Public Member Functions inherited from casacore::RecordTransformable
virtual | ~RecordTransformable ()
| The destructor must be virtual so that the destructor of derived classes is actually used.
virtual Bool | fromString (String &error, const String &inString)
| Initialise the class from a String representation.
virtual const String & | ident () const
| Specify the identification of the record (e.g.

## 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.
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.
static Double | getBeamAreaInPixels (const GaussianBeam &beam, const DirectionCoordinate &dc)

## Private Member Functions

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

## 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

- RecordTransformable

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

ImageInfo ii;
ii.setRestoringBeam(Quantity(30,"arcsec"), Quantity(10,"arcsec"),
Quantity(-18,"deg"));
..\.
cout << "The restoring beam is : " << oi.restoringBeam() << endl;
casacore::ImageInfo::ImageInfo
ImageInfo()
Default constructor.
casacore::ImageInfo::setRestoringBeam
void setRestoringBeam(const GaussianBeam &beam)
Set the single global restoring beam.
casacore::Quantity
Quantum< Double > Quantity
Definition Quantum.h:39

### 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 89 of file ImageInfo.h.

## Member Enumeration Documentation

## ImageTypes

enum casacore::ImageInfo::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 95 of file ImageInfo.h.

## Constructor & Destructor Documentation

## ImageInfo() [1/2]

casacore::ImageInfo::ImageInfo | ( |  | ) |

Default constructor.

Referenced by appendBeams(), combineBeams(), concatFreqBeams(), concatPolBeams(), copy_other(), ImageInfo(), mergeBeams(), operator=(), setImageType(), setInfoSplitBeamSet(), and setObjectName().

## ~ImageInfo()

casacore::ImageInfo::~ImageInfo | ( |  | ) |

Destructor.

## ImageInfo() [2/2]

casacore::ImageInfo::ImageInfo | ( | const ImageInfo & | other | ) |

Copy constructor (copy semantics).

References ImageInfo().

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

References casacore::shape().

## _setRestoringBeam()

void casacore::ImageInfo::_setRestoringBeam | ( | const Record & | inRecord | ) |

private

Set the restoring beam from the record.

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

References ImageInfo().

## beamToRecord()

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

Convert the given beam to a Record.

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

References casacore::shape().

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

References ImageInfo().

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

References ImageInfo().

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

References ImageInfo().

## copy_other()

void casacore::ImageInfo::copy_other | ( | const ImageInfo & | other | ) |

private

Common copy ctor/assignment operator code.

References ImageInfo().

## defaultImageType()

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

String casacore::ImageInfo::defaultObjectName | ( |  | ) |

static

## defaultRestoringBeam()

GaussianBeam casacore::ImageInfo::defaultRestoringBeam | ( |  | ) |

static

## fromFITS()

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

References casacore::RecordInterface().

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

References casacore::RecordInterface().

## getBeamAreaInPixels() [1/2]

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 242 of file ImageInfo.h.

References _beams.

## hasMultipleBeams()

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

inline

does this object contain multiple beams?

Definition at line 234 of file ImageInfo.h.

References _beams.

## hasSingleBeam()

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

inline

does this object contain a single beam

Definition at line 238 of file ImageInfo.h.

References _beams.

## imageType() [1/3]

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

Set and get the Image Type.

## imageType() [2/3]

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

static

## imageType() [3/3]

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

static

## imageTypeFromFITS()

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

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

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.

References ImageInfo().

## MiriadImageType()

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 247 of file ImageInfo.h.

References _beams.

Referenced by setAllBeams().

## nStokes()

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

inline

Definition at line 249 of file ImageInfo.h.

References _beams.

Referenced by setAllBeams().

## objectName()

String casacore::ImageInfo::objectName | ( |  | ) | const

Set and get the Image object name.

## operator=()

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

Assignment (copy semantics).

References ImageInfo().

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

References nChannels(), and nStokes().

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

References casacore::pa().

## setBeams()

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

Set the per plane beams array directly.

## setImageType()

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

References ImageInfo().

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

References ImageInfo(), and casacore::shape().

## setObjectName()

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

References ImageInfo().

## 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 206 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.

References casacore::RecordInterface().

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

References casacore::RecordInterface().

## Member Data Documentation

## _beams

ImageBeamSet casacore::ImageInfo::_beams

private

Definition at line 359 of file ImageInfo.h.

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

## _warnBeam

Bool casacore::ImageInfo::_warnBeam

mutable private

Definition at line 360 of file ImageInfo.h.

## itsImageType

ImageTypes casacore::ImageInfo::itsImageType

private

Definition at line 361 of file ImageInfo.h.

## itsObjectName

String casacore::ImageInfo::itsObjectName

private

Definition at line 362 of file ImageInfo.h.

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

- images/Images/ImageInfo.h