ImageRegion.h

Classes

ImageRegion -- Class to hold a region of interest in an image. (full description)

class ImageRegion : public LattRegionHolder

Interface

Public Members
ImageRegion()
ImageRegion (const LCRegion&)
ImageRegion (const LCSlicer&)
ImageRegion (const WCRegion&)
explicit ImageRegion (LCRegion*)
explicit ImageRegion (LCSlicer*)
explicit ImageRegion (WCRegion*)
ImageRegion (const ImageRegion& other)
virtual ~ImageRegion()
ImageRegion& operator= (const ImageRegion& other)
virtual ImageRegion* clone() const
virtual Bool operator==(const LattRegionHolder& other) const
virtual Bool isWCRegion() const
virtual const WCRegion* asWCRegionPtr() const
const LCRegion& asLCRegion() const
const LCSlicer& asLCSlicer() const
const WCRegion& asWCRegion() const
LCRegion& asMask()
virtual LatticeRegion toLatticeRegion (const CoordinateSystem& cSys, const IPosition& shape) const
LCRegion* toLCRegion (const CoordinateSystem& cSys, const IPosition& shape) const
TableRecord toRecord (const String& tableName) const
static ImageRegion* fromRecord (const TableRecord&, const String& tableName)
virtual LattRegionHolder* makeUnion (const LattRegionHolder& other) const
virtual LattRegionHolder* makeIntersection (const LattRegionHolder& other) const
virtual LattRegionHolder* makeDifference (const LattRegionHolder& other) const
virtual LattRegionHolder* makeComplement() const

Description

Prerequisite

Synopsis

The only purpose of ImageRegion is to have a single object for the various kinds of regions. It can hold a LCRegion, LCSlicer, and WCRegion.

Example


 

Motivation

It was felt that making an abstract base class LatticeRegion for LCRegion and WCRegion would create undesirable dependencies of module Lattices on module Coordinates. E.g. it would be impossible to have a function toWCRegion. Therefore the container class ImageRegion is chosen.

Member Description

ImageRegion()

Default constructor (has no region at all).

ImageRegion (const LCRegion&)

Construct from a region based on lattice coordinates.

ImageRegion (const LCSlicer&)

Construct from a slicer based on lattice coordinates.

ImageRegion (const WCRegion&)

Construct from a region based on world coordinates.

explicit ImageRegion (LCRegion*)
explicit ImageRegion (LCSlicer*)
explicit ImageRegion (WCRegion*)

Similar constructors as above, but using a pointer. It takes over the pointer, so the user should not delete the object. It is deleted by the ImageRegion destructor.

ImageRegion (const ImageRegion& other)

Copy constructor (copy semantics).

virtual ~ImageRegion()

ImageRegion& operator= (const ImageRegion& other)

Assignment (copy semantics).

virtual ImageRegion* clone() const

Clone the object.

virtual Bool operator==(const LattRegionHolder& other) const

Comparison

virtual Bool isWCRegion() const

Test if the underlying region is an WCRegion.

virtual const WCRegion* asWCRegionPtr() const

Get the region as a pointer to WCRegion. An exception is thrown if the region is not the correct type. Functions isWCRegion() can be used to test the type.

const LCRegion& asLCRegion() const
const LCSlicer& asLCSlicer() const
const WCRegion& asWCRegion() const

Get the region as an LCSlicer or WCRegion. An exception is thrown if the region is not the correct type. Functions isWCRegion(), etc. can be used to test the type.

LCRegion& asMask()

Get the region as a writable mask. It throws an exception if the region is not an LCRegion or if its mask is not writable.

virtual LatticeRegion toLatticeRegion (const CoordinateSystem& cSys, const IPosition& shape) const

Convert to a LatticeRegion using the given coordinate system (with reference pixel) and shape. It will also make the region complete (absolute and non-fractional).

LCRegion* toLCRegion (const CoordinateSystem& cSys, const IPosition& shape) const

Convert to an LCRegion using the given coordinate system (with reference pixel) and shape. It will also make the region complete (absolute and non-fractional). An exception is thrown if the region type is a LCSlicer. The axes argument tells which axes to use from the coordinate system and shape.

TableRecord toRecord (const String& tableName) const

Convert the (derived) object to a record. The record can be used to make the object persistent.

static ImageRegion* fromRecord (const TableRecord&, const String& tableName)

Convert correct object from a record.

virtual LattRegionHolder* makeUnion (const LattRegionHolder& other) const
virtual LattRegionHolder* makeIntersection (const LattRegionHolder& other) const
virtual LattRegionHolder* makeDifference (const LattRegionHolder& other) const
virtual LattRegionHolder* makeComplement() const

Form a compound from this and the other region.