Loading...
Searching...
No Matches
casacore::WCRegion Class Referenceabstract
images package (libcasa_images) » Regions_module

More...

`#include <WCRegion.h>`

## Public Member Functions

| WCRegion ()
| WCRegion (const WCRegion &other)
| Copy constructor (copy semantics).
virtual | ~WCRegion ()
| Destructor.
virtual Bool | operator== (const WCRegion &other) const
| Comparison.
Bool | operator!= (const WCRegion &other) const
virtual WCRegion * | cloneRegion () const =0
| Clone a WCRegion object.
virtual String | type () const =0
| Return region type.
virtual uInt | ndim () const
| Get the dimensionality (i.e.
const Record & | getAxesDesc () const
| Get the description of all axes.
const Record & | getAxisDesc (uInt axis) const
| Get the description of the given axis.
Int | axisNr (const Record &desc, const Record &axesDesc) const
| Return the axis number of the description of an axis in the full axes description.
Bool | isAxisDescEqual (const Record &desc1, const Record &desc2) const
| Are both axis descriptions equal?
virtual Bool | canExtend () const
| Can the region extend itself?
const String & | comment () const
| Get or set the comment.
void | setComment (const String &comment)
virtual LCRegion * | toLCRegion (const CoordinateSystem &cSys, const IPosition &shape) const
| Convert to an LCRegion using the given new coordinate system and shape.
LCRegion * | toLCRegionAxes (const CoordinateSystem &cSys, const IPosition &shape, const IPosition &pixelAxesMap, const IPosition &outOrder) const
| Convert to an LCRegion using the given coordinate system and shape.
virtual TableRecord | toRecord (const String &tableName) const =0
| Convert the (derived) object to a record.
void | defineRecordFields (RecordInterface &record, const String &className) const
| Define the type and class name in the record.

## Static Public Member Functions

static WCRegion * | fromRecord (const TableRecord &rec, const String &tableName)
| Convert correct object from a record.

## Protected Member Functions

WCRegion & | operator= (const WCRegion &other)
| Assignment (copy semantics) makes only sense for a derived class.
void | addAxisDesc (const Record &axisDesc)
| Add an axis with its description.
Record | makeAxisDesc (const CoordinateSystem &cSys, uInt pixelAxis) const
| Make a description of a pixel axis in the coordinate system.
Record | makeAxesDesc (const CoordinateSystem &cSys) const
| Make a description of all pixel axes in the coordinate system (in pixel axes order).
virtual LCRegion * | doToLCRegion (const CoordinateSystem &cSys, const IPosition &shape, const IPosition &pixelAxesMap, const IPosition &extendAxes) const =0
| Convert to an LCRegion using the given coordinate system and shape.
void | makeWorldAbsolute (Vector< Double > &world, const Vector< Int > &absRel, const CoordinateSystem &cSys, const IPosition &shape) const
| Convert relative to absolute world as needed.
void | checkAxes (const IPosition &pixelAxes, const CoordinateSystem &cSys, const Vector< String > &quantityUnits) const

## Static Protected Member Functions

static void | unitInit ()
static void | convertPixel (Double &pixel, const Double &value, const String &unit, const Int absRel, const Double refPix, const Int shape)

## Private Attributes

String | itsComment
Record | itsAxesDesc

## Detailed Description

Base class to define world coordinate regions of interest in an image.

### Intended use:

Public interface

### Prerequisite

- LCRegion

### Synopsis

WCRegion is the base class for world coordinate regions. The axes in a WCRegion have names (e.g. RA, DEC, FREQ) and carry sometimes an associated reference frame with it. An WCRegion object is converted to the appropriate LCRegion object when they are used to take a subset from an image. LCRegion's are pixel based and are used to access the correct pixels in the image. The conversion has the following rules:

1. All axes of the region must be axes in the image.
2. An image axis does not have to be an axis in the region. Thus the image can have a higher dimensionality than the region. If that is the case, the region is auto-extended to the image's dimensionality by using the full range for those axes.
3. The order of the axes in region and image do not have to be the same. They get reordered as needed.

### Example

### Motivation

User should be able to specify their regions in world coordinates as well as lattice coordinates.

Definition at line 93 of file WCRegion.h.

## Constructor & Destructor Documentation

## WCRegion() [1/2]

casacore::WCRegion::WCRegion | ( |  | ) |

Referenced by casacore::WCBox::cloneRegion(), casacore::WCEllipsoid::cloneRegion(), casacore::WCLELMask::cloneRegion(), casacore::WCPolygon::cloneRegion(), cloneRegion(), fromRecord(), operator!=(), operator=(), casacore::WCBox::operator==(), casacore::WCCompound::operator==(), casacore::WCEllipsoid::operator==(), casacore::WCLELMask::operator==(), casacore::WCPolygon::operator==(), operator==(), and WCRegion().

## WCRegion() [2/2]

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

Copy constructor (copy semantics).

References WCRegion().

## ~WCRegion()

virtual casacore::WCRegion::~WCRegion | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## addAxisDesc()

void casacore::WCRegion::addAxisDesc | ( | const Record & | axisDesc | ) |

protected

Add an axis with its description.

An exception is thrown if the axis already exists in this region.

References casacore::Record().

## axisNr()

Int casacore::WCRegion::axisNr | ( | const Record & | desc,
|  | const Record & | axesDesc ) const

Return the axis number of the description of an axis in the full axes description.

-1 is returned if not found.

References casacore::Record().

## canExtend()

virtual Bool casacore::WCRegion::canExtend | ( |  | ) | const

virtual

Can the region extend itself?

By default it cannot.

Reimplemented in casacore::WCBox, casacore::WCEllipsoid, casacore::WCExtension, casacore::WCLELMask, and casacore::WCPolygon.

References comment().

## checkAxes()

void casacore::WCRegion::checkAxes | ( | const IPosition & | pixelAxes,
|  | const CoordinateSystem & | cSys,
|  | const Vector< String > & | quantityUnits ) const

protected

## cloneRegion()

virtual WCRegion * casacore::WCRegion::cloneRegion | ( |  | ) | const

pure virtual

Clone a WCRegion object.

Implemented in casacore::WCBox, casacore::WCComplement, casacore::WCConcatenation, casacore::WCDifference, casacore::WCEllipsoid, casacore::WCExtension, casacore::WCIntersection, casacore::WCLELMask, casacore::WCPolygon, and casacore::WCUnion.

References WCRegion().

## comment()

const String & casacore::WCRegion::comment | ( |  | ) | const

inline

Get or set the comment.

Definition at line 250 of file WCRegion.h.

References itsComment.

Referenced by canExtend(), and setComment().

## convertPixel()

void casacore::WCRegion::convertPixel | ( | Double & | pixel,
|  | const Double & | value,
|  | const String & | unit,
|  | const Int | absRel,
|  | const Double | refPix,
|  | const Int | shape )

static protected

References casacore::NewDelAllocator< T >::value, and casacore::shape().

## defineRecordFields()

void casacore::WCRegion::defineRecordFields | ( | RecordInterface & | record,
|  | const String & | className ) const

Define the type and class name in the record.

References casacore::RecordInterface().

## doToLCRegion()

virtual LCRegion * casacore::WCRegion::doToLCRegion | ( | const CoordinateSystem & | cSys,
|  | const IPosition & | shape,
|  | const IPosition & | pixelAxesMap,
|  | const IPosition & | extendAxes ) const

protected pure virtual

Convert to an LCRegion using the given coordinate system and shape.

pixelAxesMap(i) is the axis in cSys and shape for region axis i.
outOrder(i) is the axis in the output LCRegion for region axis i.
They always have the same length. If the region can extend itself, the length of pixelAxesMap and outOrder can be more than the dimensionality of the region. The latter axes in them are the extension axes.

Implemented in casacore::WCBox, casacore::WCComplement, casacore::WCConcatenation, casacore::WCDifference, casacore::WCEllipsoid, casacore::WCExtension, casacore::WCIntersection, casacore::WCLELMask, casacore::WCPolygon, and casacore::WCUnion.

References casacore::shape().

## fromRecord()

WCRegion * casacore::WCRegion::fromRecord | ( | const TableRecord & | rec,
|  | const String & | tableName )

static

Convert correct object from a record.

References WCRegion().

## getAxesDesc()

const Record & casacore::WCRegion::getAxesDesc | ( |  | ) | const

inline

Get the description of all axes.

Definition at line 258 of file WCRegion.h.

References itsAxesDesc, and casacore::Record().

## getAxisDesc()

const Record & casacore::WCRegion::getAxisDesc | ( | uInt | axis | ) | const

Get the description of the given axis.

It is a record containing some fields describing the axis.

References casacore::Record().

## isAxisDescEqual()

Bool casacore::WCRegion::isAxisDescEqual | ( | const Record & | desc1,
|  | const Record & | desc2 ) const

Are both axis descriptions equal?

References casacore::Record().

## makeAxesDesc()

Record casacore::WCRegion::makeAxesDesc | ( | const CoordinateSystem & | cSys | ) | const

protected

Make a description of all pixel axes in the coordinate system (in pixel axes order).

References casacore::Record().

## makeAxisDesc()

Record casacore::WCRegion::makeAxisDesc | ( | const CoordinateSystem & | cSys,
|  | uInt | pixelAxis ) const

protected

Make a description of a pixel axis in the coordinate system.

References casacore::Record().

## makeWorldAbsolute()

void casacore::WCRegion::makeWorldAbsolute | ( | Vector< Double > & | world,
|  | const Vector< Int > & | absRel,
|  | const CoordinateSystem & | cSys,
|  | const IPosition & | shape ) const

protected

Convert relative to absolute world as needed.

References casacore::shape().

## ndim()

virtual uInt casacore::WCRegion::ndim | ( |  | ) | const

virtual

Get the dimensionality (i.e.

the number of axes). Note that usually all axes have a description, but in some cases (e.g. WCLELMask) that may not be the case. The default implementation returns the number of axes in the axes description.

Reimplemented in casacore::WCLELMask.

References casacore::Record().

## operator!=()

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

inline

Definition at line 246 of file WCRegion.h.

References WCRegion().

## operator=()

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

protected

Assignment (copy semantics) makes only sense for a derived class.

References WCRegion().

## operator==()

virtual Bool casacore::WCRegion::operator== | ( | const WCRegion & | other | ) | const

virtual

Comparison.

Reimplemented in casacore::WCBox, casacore::WCComplement, casacore::WCCompound, casacore::WCConcatenation, casacore::WCDifference, casacore::WCEllipsoid, casacore::WCExtension, casacore::WCIntersection, casacore::WCLELMask, casacore::WCPolygon, and casacore::WCUnion.

References WCRegion().

## setComment()

void casacore::WCRegion::setComment | ( | const String & | comment | ) |

inline

Definition at line 254 of file WCRegion.h.

References comment(), and itsComment.

## toLCRegion()

virtual LCRegion * casacore::WCRegion::toLCRegion | ( | const CoordinateSystem & | cSys,
|  | const IPosition & | shape ) const

virtual

Convert to an LCRegion using the given new coordinate system and shape.

An exception is thrown if the region's dimensionality is more than the length of the shape vector or if an axis in the region is unknown in the new coordinate system.. When less, the default implementation extends the region over the remaining axes.
If the region does not need to have coordinates (like WCLELMask) the function has to be overridden.

Reimplemented in casacore::WCLELMask.

References casacore::shape().

## toLCRegionAxes()

LCRegion * casacore::WCRegion::toLCRegionAxes | ( | const CoordinateSystem & | cSys,
|  | const IPosition & | shape,
|  | const IPosition & | pixelAxesMap,
|  | const IPosition & | outOrder ) const

Convert to an LCRegion using the given coordinate system and shape.

This function is meant for internal use by WCCompound objects.
pixelAxesMap(i) is the axis in cSys and shape for region axis i.
outOrder(i) is the axis in the output LCRegion for region axis i.
The length of pixelAxesMap and outOrder is the dimensionality of the output LCRegion. It can be more than the dimensionality of this WCRegion object. In that case the region gets extended along the latter axes. If the region cannot extend itself, this function will create an LCExtension object to extend the region.
Note that initially pixelAxisMap and outOrder are the same, but when called for regions in compound regions they may start to differ.

References casacore::shape().

## toRecord()

virtual TableRecord casacore::WCRegion::toRecord | ( | const String & | tableName | ) | const

pure virtual

Convert the (derived) object to a record.

The record can be used to make the object persistent. The tableName argument can be used by derived classes (e.g. LCPagedMask) to put very large objects.

Implemented in casacore::WCBox, casacore::WCComplement, casacore::WCConcatenation, casacore::WCDifference, casacore::WCEllipsoid, casacore::WCExtension, casacore::WCIntersection, casacore::WCLELMask, casacore::WCPolygon, and casacore::WCUnion.

## type()

virtual String casacore::WCRegion::type | ( |  | ) | const

pure virtual

Return region type.

Just returns the class name of the derived class.

Implemented in casacore::WCBox, casacore::WCComplement, casacore::WCConcatenation, casacore::WCDifference, casacore::WCEllipsoid, casacore::WCExtension, casacore::WCIntersection, casacore::WCLELMask, casacore::WCPolygon, and casacore::WCUnion.

## unitInit()

void casacore::WCRegion::unitInit | ( |  | ) |

static protected

## Member Data Documentation

## itsAxesDesc

Record casacore::WCRegion::itsAxesDesc

private

Definition at line 242 of file WCRegion.h.

Referenced by getAxesDesc().

## itsComment

String casacore::WCRegion::itsComment

private

Definition at line 241 of file WCRegion.h.

Referenced by comment(), and setComment().

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

- images/Regions/WCRegion.h