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

More...

`#include <ImageBeamSet.h>`

## Public Types

typedef Array< GaussianBeam >::const_iterator | BeamIter

## Public Member Functions

| ImageBeamSet ()
| Construct an empty beam set.
| ImageBeamSet (const Matrix< GaussianBeam > &beams)
| Construct a beam set from an 2-D array of beams representing the frequency and stokes axis.
| ImageBeamSet (const GaussianBeam &beam)
| construct an ImageBeamSet representing a single beam which is valid for all channels and stokes
| ImageBeamSet (uInt nchan, uInt nstokes, const GaussianBeam &beam=GaussianBeam::NULL_BEAM)
| Create an ImageBeamSet of the specified shape with all GaussianBeams initialized to beam.
| ImageBeamSet (const ImageBeamSet &other)
| The copy constructor (reference semantics).
| ~ImageBeamSet ()
ImageBeamSet & | operator= (const ImageBeamSet &other)
| Assignment can change the shape (copy semantics).
Bool | operator== (const ImageBeamSet &other) const
| Beam sets are equal if the shapes and all corresponding beams are equal.
Bool | operator!= (const ImageBeamSet &other) const
Bool | equivalent (const ImageBeamSet &that) const
| Beam sets are equivalent if both have no beams or if the expanded sets are equal.
uInt | nelements () const
| Get the number of elements in the beam array.
uInt | size () const
Bool | hasSingleBeam () const
Bool | hasMultiBeam () const
| Does this beam set contain multiple beams?
Bool | empty () const
| Is the beam set empty?
const IPosition & | shape () const
| Get the shape of the beam array.
uInt | nchan () const
| Get the number of channels in the beam array.
uInt | nstokes () const
| Get the number of stokes in the beam array.
const GaussianBeam & | getBeam () const
| Get the single global beam.
const GaussianBeam & | getBeam (Int chan, Int stokes) const
| Get the beam at the specified location.
const GaussianBeam & | operator() (Int chan, Int stokes) const
void | setBeam (Int chan, Int stokes, const GaussianBeam &beam)
| Get a beam at the given 2-dim IPosition.
void | resize (uInt nchan, uInt nstokes)
| Resize the beam array.
ImageBeamSet | subset (const Slicer &imageSlicer, const CoordinateSystem &csys) const
| Return a subset of the beam array.
const Matrix< GaussianBeam > & | getBeams () const
| Get the beam array.
void | setBeams (const Matrix< GaussianBeam > &beams)
| Set the beams in this beam set.
void | set (const GaussianBeam &beam)
| Set all beams to the same value.
GaussianBeam | getMinAreaBeam () const
| Get the beam in the set which has the smallest area.
GaussianBeam | getMaxAreaBeam () const
| Get the beam in the set which has the largest area.
GaussianBeam | getMedianAreaBeam () const
| Get the beam in the set which has the median area.
IPosition | getMinAreaBeamPosition () const
| Get the position of the beam with the minimum area.
IPosition | getMaxAreaBeamPosition () const
| Get the position of the beam with the maximum area.
const GaussianBeam & | getMinAreaBeamForPol (IPosition &pos, uInt stokes) const
| Get the minimal, maximal, and median area beams and positions in the beam set matrix for the given stokes.
const GaussianBeam & | getMaxAreaBeamForPol (IPosition &pos, uInt stokes) const
const GaussianBeam & | getMedianAreaBeamForPol (IPosition &pos, uInt stokes) const
const GaussianBeam | getSmallestMinorAxisBeam () const
| Get the beam that has the smallest minor axis.
Record | toRecord () const
void | summarize (LogIO &log, Bool verbose, const CoordinateSystem &csys) const
| If verbose, log all beams, if not just summarize beam stats.
void | rotate (const Quantity &angle, Bool unwrap=False)
| Modify the beam set by rotating all beams counterclockwise through the specified angle.
const Quantum< Matrix< double > > | getAreas () const
| get all the beam areas in a single quantum matrix.
const std::map< String, Quantum< Matrix< double > > > | paramMatrices (const Unit &majminUnit=Unit("arcsec"), const Unit &paUnit="deg") const
| get all the major axes, minor axes, and pas in quantum matrices.

## Static Public Member Functions

static const String & | className ()
static ImageBeamSet | fromRecord (const Record &rec)
| convert ImageBeamSet to and from record

## Private Member Functions

void | _calculateAreas ()
void | _replaceBeam (const GaussianBeam &beam, const IPosition &location1, const IPosition &location2, Bool overwriteMaxMin)
| common code for replacing a beam in a multi-beam set

## Static Private Member Functions

static void | _chanInfoToStream (ostream &os, const SpectralCoordinate *spCoord, const uInt chan, const uInt chanWidth, const uInt freqPrec, const uInt velWidth, const uInt velPrec)
| Show the spectral info.
static void | _beamToStream (ostream &os, const GaussianBeam &beam, const Unit &unit)
| Show the beam info.

## Private Attributes

Matrix< GaussianBeam > | _beams
Matrix< Double > | _areas
String | _areaUnit
GaussianBeam | _minBeam
GaussianBeam | _maxBeam
IPosition | _minBeamPos
IPosition | _maxBeamPos

## Static Private Attributes

static const String | _DEFAULT_AREA_UNIT

## Detailed Description

Represents a set of restoring beams associated with an image.

### Intended use:

Public interface

### Review Status

Date Reviewed:
  yyyy/mm/dd

### Etymology

A Set of Beams associated with an Image.

### Synopsis

This class represents a set of restoring beams associated with a deconvolved image. Internally, the beams are stored in a Matrix in which the first dimension represents the spectral axis and the second dimension represents the polarization axis. Methods which take the number of channels and stokes as the input parameters will accept 0 for either of these, in the cases where the corresponding axis is absent, but internally, the associated axis of the storage Matrix will be set to one since a Matrix with one dimension of length 0 must be empty. If one (or both) of the axes is of length 1, the beam associated with that position is valid for all channels or stokes at the position. For example, if one has an image with 10 spectral channels and 4 stokes, and one has a beam set of dimensions (1, 4) associated with that image, all channels for a given stokes will have the same beam. Similarly, if the beam set is of shape (10, 1) in this case, all stokes will have the same beam for a given channel. If the axis lengths of the beam set are greater than one, they must be exactly the same length of the corresponding axes in the associated image.

### Example

### Motivation

Restoring beams are used many places in image analysis tasks.

Definition at line 86 of file ImageBeamSet.h.

## Member Typedef Documentation

## BeamIter

typedef Array<GaussianBeam>::const_iterator casacore::ImageBeamSet::BeamIter

Definition at line 89 of file ImageBeamSet.h.

## Constructor & Destructor Documentation

## ImageBeamSet() [1/5]

casacore::ImageBeamSet::ImageBeamSet | ( |  | ) |

Construct an empty beam set.

Referenced by equivalent(), fromRecord(), ImageBeamSet(), operator!=(), operator=(), operator==(), and subset().

## ImageBeamSet() [2/5]

casacore::ImageBeamSet::ImageBeamSet | ( | const Matrix< GaussianBeam > & | beams | ) |

Construct a beam set from an 2-D array of beams representing the frequency and stokes axis.

Axis length 1 means it is valid for all channels cq. stokes. If the image has 0 spectral channels or stokes, the corresponding length of the axis in the provided matrix should be 1.

## ImageBeamSet() [3/5]

casacore::ImageBeamSet::ImageBeamSet | ( | const GaussianBeam & | beam | ) |

construct an ImageBeamSet representing a single beam which is valid for all channels and stokes

## ImageBeamSet() [4/5]

casacore::ImageBeamSet::ImageBeamSet | ( | uInt | nchan,
|  | uInt | nstokes,
|  | const GaussianBeam & | beam = GaussianBeam::NULL_BEAM )

Create an ImageBeamSet of the specified shape with all GaussianBeams initialized to beam.

References nchan(), nstokes(), and casacore::GaussianBeam::NULL_BEAM.

## ImageBeamSet() [5/5]

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

The copy constructor (reference semantics).

References ImageBeamSet().

## ~ImageBeamSet()

casacore::ImageBeamSet::~ImageBeamSet | ( |  | ) |

## Member Function Documentation

## _beamToStream()

void casacore::ImageBeamSet::_beamToStream | ( | ostream & | os,
|  | const GaussianBeam & | beam,
|  | const Unit & | unit )

static private

Show the beam info.

## _calculateAreas()

void casacore::ImageBeamSet::_calculateAreas | ( |  | ) |

private

## _chanInfoToStream()

void casacore::ImageBeamSet::_chanInfoToStream | ( | ostream & | os,
|  | const SpectralCoordinate * | spCoord,
|  | const uInt | chan,
|  | const uInt | chanWidth,
|  | const uInt | freqPrec,
|  | const uInt | velWidth,
|  | const uInt | velPrec )

static private

Show the spectral info.

## _replaceBeam()

void casacore::ImageBeamSet::_replaceBeam | ( | const GaussianBeam & | beam,
|  | const IPosition & | location1,
|  | const IPosition & | location2,
|  | Bool | overwriteMaxMin )

private

common code for replacing a beam in a multi-beam set

## className()

const String & casacore::ImageBeamSet::className | ( |  | ) |

static

## empty()

Bool casacore::ImageBeamSet::empty | ( |  | ) | const

inline

Is the beam set empty?

Definition at line 145 of file ImageBeamSet.h.

References _beams.

## equivalent()

Bool casacore::ImageBeamSet::equivalent | ( | const ImageBeamSet & | that | ) | const

Beam sets are equivalent if both have no beams or if the expanded sets are equal.

Expanded means that an axis can have length 0 or 1 and is (virtually) expanded to the length of the matching axis in the other beam set.

References ImageBeamSet().

## fromRecord()

ImageBeamSet casacore::ImageBeamSet::fromRecord | ( | const Record & | rec | ) |

static

convert ImageBeamSet to and from record

References ImageBeamSet(), and casacore::Record().

## getAreas()

const Quantum< Matrix< double > > casacore::ImageBeamSet::getAreas | ( |  | ) | const

get all the beam areas in a single quantum matrix.

## getBeam() [1/2]

const GaussianBeam & casacore::ImageBeamSet::getBeam | ( |  | ) | const

Get the single global beam.

If there are multiple beams, an exception is thrown.

Referenced by operator()().

## getBeam() [2/2]

const GaussianBeam & casacore::ImageBeamSet::getBeam | ( | Int | chan,
|  | Int | stokes ) const

Get the beam at the specified location.

Note that a single channel or stokes in the beam set is valid for all channels cq. stokes.

## getBeams()

const Matrix< GaussianBeam > & casacore::ImageBeamSet::getBeams | ( |  | ) | const

inline

Get the beam array.

Definition at line 200 of file ImageBeamSet.h.

References _beams.

## getMaxAreaBeam()

GaussianBeam casacore::ImageBeamSet::getMaxAreaBeam | ( |  | ) | const

inline

Get the beam in the set which has the largest area.

Get the beam in the set which has the largest area.

Definition at line 218 of file ImageBeamSet.h.

References _maxBeam.

## getMaxAreaBeamForPol()

const GaussianBeam & casacore::ImageBeamSet::getMaxAreaBeamForPol | ( | IPosition & | pos,
|  | uInt | stokes ) const

## getMaxAreaBeamPosition()

IPosition casacore::ImageBeamSet::getMaxAreaBeamPosition | ( |  | ) | const

inline

Get the position of the beam with the maximum area.

Definition at line 229 of file ImageBeamSet.h.

References _maxBeamPos.

## getMedianAreaBeam()

GaussianBeam casacore::ImageBeamSet::getMedianAreaBeam | ( |  | ) | const

Get the beam in the set which has the median area.

## getMedianAreaBeamForPol()

const GaussianBeam & casacore::ImageBeamSet::getMedianAreaBeamForPol | ( | IPosition & | pos,
|  | uInt | stokes ) const

## getMinAreaBeam()

GaussianBeam casacore::ImageBeamSet::getMinAreaBeam | ( |  | ) | const

inline

Get the beam in the set which has the smallest area.

Definition at line 213 of file ImageBeamSet.h.

References _minBeam.

## getMinAreaBeamForPol()

const GaussianBeam & casacore::ImageBeamSet::getMinAreaBeamForPol | ( | IPosition & | pos,
|  | uInt | stokes ) const

Get the minimal, maximal, and median area beams and positions in the beam set matrix for the given stokes.

If the stokes axis has length 1 in the beam matrix, it is valid for all stokes and no checking is done that stokes is valid; the requested beam for the entire beam set is simply returned in this case. If the number of stokes in the beam matrix is >1, checking is done that the specified value of stokes is valid and if not, an exception is thrown.

## getMinAreaBeamPosition()

IPosition casacore::ImageBeamSet::getMinAreaBeamPosition | ( |  | ) | const

inline

Get the position of the beam with the minimum area.

Definition at line 225 of file ImageBeamSet.h.

References _minBeamPos.

## getSmallestMinorAxisBeam()

const GaussianBeam casacore::ImageBeamSet::getSmallestMinorAxisBeam | ( |  | ) | const

Get the beam that has the smallest minor axis.

If multiple beams have the smallest minor axis, the beam in this subset with the smallest area will be returned.

## hasMultiBeam()

Bool casacore::ImageBeamSet::hasMultiBeam | ( |  | ) | const

inline

Does this beam set contain multiple beams?

Definition at line 141 of file ImageBeamSet.h.

References _beams.

## hasSingleBeam()

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

inline

Definition at line 137 of file ImageBeamSet.h.

References _beams.

## nchan()

uInt casacore::ImageBeamSet::nchan | ( |  | ) | const

inline

Get the number of channels in the beam array.

Note that this will always return a minimum of 1, even if nchan was specified as 0 on construction.

Definition at line 155 of file ImageBeamSet.h.

References _beams.

Referenced by ImageBeamSet(), and resize().

## nelements()

uInt casacore::ImageBeamSet::nelements | ( |  | ) | const

inline

Get the number of elements in the beam array.

Definition at line 131 of file ImageBeamSet.h.

References _beams.

## nstokes()

uInt casacore::ImageBeamSet::nstokes | ( |  | ) | const

inline

Get the number of stokes in the beam array.

Note that this will always return a minimum of 1, even if nstokes was specified as 0 on construction.

Definition at line 160 of file ImageBeamSet.h.

References _beams.

Referenced by ImageBeamSet(), and resize().

## operator!=()

Bool casacore::ImageBeamSet::operator!= | ( | const ImageBeamSet & | other | ) | const

References ImageBeamSet().

## operator()()

const GaussianBeam & casacore::ImageBeamSet::operator() | ( | Int | chan,
|  | Int | stokes ) const

inline

Definition at line 172 of file ImageBeamSet.h.

References getBeam().

## operator=()

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

Assignment can change the shape (copy semantics).

References ImageBeamSet().

## operator==()

Bool casacore::ImageBeamSet::operator== | ( | const ImageBeamSet & | other | ) | const

Beam sets are equal if the shapes and all corresponding beams are equal.

References ImageBeamSet().

## paramMatrices()

const std::map< String, Quantum< Matrix< double > > > casacore::ImageBeamSet::paramMatrices | ( | const Unit & | majminUnit = Unit("arcsec"),
|  | const Unit & | paUnit = "deg" ) const

get all the major axes, minor axes, and pas in quantum matrices.

The returned map has keys "major", "minor", and "pa".

## resize()

void casacore::ImageBeamSet::resize | ( | uInt | nchan,
|  | uInt | nstokes )

Resize the beam array.

nchan=0 or nstokes=0 is silently changed to 1.

References nchan(), and nstokes().

## rotate()

void casacore::ImageBeamSet::rotate | ( | const Quantity & | angle,
|  | Bool | unwrap = False )

Modify the beam set by rotating all beams counterclockwise through the specified angle.

If unwrap=True, unwrap the new position angle(s) so that it falls in the range -90 to 90 degrees before setting it.

References casacore::False.

## set()

void casacore::ImageBeamSet::set | ( | const GaussianBeam & | beam | ) |

Set all beams to the same value.

## setBeam()

void casacore::ImageBeamSet::setBeam | ( | Int | chan,
|  | Int | stokes,
|  | const GaussianBeam & | beam )

Get a beam at the given 2-dim IPosition.

It should match exactly, thus a single channel or stokes in the beam set is not valid for all. const GaussianBeam& getBeam(const IPosition& pos) const { return _beams(pos); }

Set the beam at the given location. The location must be within the beam set shape. If chan or stokes is negative, then the beam applies to all channels or stokes, respectively. If both are negative, the specified beam becomes the global beam and the beam set is resized to (1, 1).

## setBeams()

void casacore::ImageBeamSet::setBeams | ( | const Matrix< GaussianBeam > & | beams | ) |

Set the beams in this beam set.

The shape of the given array must match the beam set. It also matches if an axis in array or beam set has length 1, which means that it expands to the other length.

## shape()

const IPosition & casacore::ImageBeamSet::shape | ( |  | ) | const

inline

Get the shape of the beam array.

The minimum value for a component of the returned IPosition is always 1.

Definition at line 150 of file ImageBeamSet.h.

References _beams.

## size()

uInt casacore::ImageBeamSet::size | ( |  | ) | const

inline

Definition at line 133 of file ImageBeamSet.h.

References _beams.

## subset()

ImageBeamSet casacore::ImageBeamSet::subset | ( | const Slicer & | imageSlicer,
|  | const CoordinateSystem & | csys ) const

Return a subset of the beam array.

The slicer is usually the slicer used for a subimage. The slicer can contain multiple stokes or channels, even if the beam set has only one.

References ImageBeamSet().

## summarize()

void casacore::ImageBeamSet::summarize | ( | LogIO & | log,
|  | Bool | verbose,
|  | const CoordinateSystem & | csys ) const

If verbose, log all beams, if not just summarize beam stats.

References casacore::log().

## toRecord()

Record casacore::ImageBeamSet::toRecord | ( |  | ) | const

References casacore::Record().

## Member Data Documentation

## _areas

Matrix<Double> casacore::ImageBeamSet::_areas

private

Definition at line 286 of file ImageBeamSet.h.

## _areaUnit

String casacore::ImageBeamSet::_areaUnit

private

Definition at line 287 of file ImageBeamSet.h.

## _beams

Matrix<GaussianBeam> casacore::ImageBeamSet::_beams

private

Definition at line 285 of file ImageBeamSet.h.

Referenced by empty(), getBeams(), hasMultiBeam(), hasSingleBeam(), nchan(), nelements(), nstokes(), shape(), and size().

## _DEFAULT_AREA_UNIT

const String casacore::ImageBeamSet::_DEFAULT_AREA_UNIT

static private

Definition at line 283 of file ImageBeamSet.h.

## _maxBeam

GaussianBeam casacore::ImageBeamSet::_maxBeam

private

Definition at line 288 of file ImageBeamSet.h.

Referenced by getMaxAreaBeam().

## _maxBeamPos

IPosition casacore::ImageBeamSet::_maxBeamPos

private

Definition at line 289 of file ImageBeamSet.h.

Referenced by getMaxAreaBeamPosition().

## _minBeam

GaussianBeam casacore::ImageBeamSet::_minBeam

private

Definition at line 288 of file ImageBeamSet.h.

Referenced by getMinAreaBeam().

## _minBeamPos

IPosition casacore::ImageBeamSet::_minBeamPos

private

Definition at line 289 of file ImageBeamSet.h.

Referenced by getMinAreaBeamPosition().

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

- images/Images/ImageBeamSet.h