casa::LCRegion Class Reference
[Lattices]

#include <LCRegion.h>

Inheritance diagram for casa::LCRegion:

Inheritance graph
[legend]
Collaboration diagram for casa::LCRegion:

Collaboration graph
[legend]
List of all members.

Detailed Description

Abstract base class to define a region of interest in lattice coordinates.

Intended use:

Part of API

Prerequisite

Synopsis

The LCRegion class is the abstract base class for various types of LCRegion's (e.g. LCEllipsoid , LCBox ). It contains the minimal bounding box of the region and, if needed, a mask with the same shape as the bounding box. A mask element is true if the element is inside the box.

Each LCRegion object must be able to convert itself to and from a record. In that way they can be made persistent (in for example a Table).

The LCRegion can be used in several Lattices and Images classes and functions to limit the area to operate on.

Example

Motivation

The Slicer class is too limited as a region, because it can only describe a rectangular region. Specialized classes are needed to describe arbitrary regions. They need a base class to combine them.

Definition at line 86 of file LCRegion.h.

Public Member Functions

 LCRegion ()
 LCRegion (const IPosition &latticeShape)
 Construct with the lattice shape only.
 LCRegion (const LCRegion &other)
 Copy constructor (copy semantics).
virtual ~LCRegion ()
virtual Bool operator== (const LCRegion &other) const
 Equality.
Bool operator!= (const LCRegion &other) const
 Watch out ! You must not, in the derived class structure, invoke LCRegion::operator!= If you do, you will be stuck in a time warp, as this will just fetch the operator== of the concrete class and you start all over again.
virtual void handleDelete ()
 Handle deletion of the region by deleting possible tables.
virtual void handleRename (const String &newName, Bool overwrite)
 Handle renaming the region by renaming possible tables.
virtual String type () const=0
 Region type.
virtual Bool hasMask () const=0
 Does the region have a mask?
const IPositionlatticeShape () const
 Give the full lattice shape.
const SlicerboundingBox () const
 Give the bounding box.
virtual TableRecord toRecord (const String &tableName) const =0
 Convert the (derived) object to a record.
virtual uInt ndim () const
 Return the dimensionality of the region.
virtual IPosition shape () const
 Return the shape of the region (i.e.
virtual Bool isWritable () const
 Usually the lattice (i.e.
virtual Lattice< Bool > * clone () const
 Make a copy of the derived object.
virtual LCRegioncloneRegion () const=0
const Stringcomment () const
 Get or set the comment.
void setComment (const String &comment)
LCRegiontranslate (const IPosition &translateVector) const
 Construct another LCRegion (for e.g.
LCRegiontranslate (const IPosition &translateVector, const IPosition &newLatticeShape) const
LCRegiontranslate (const Vector< Float > &translateVector) const
LCRegiontranslate (const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Slicer expand (const Slicer &slicer) const
 Expand a slicer or position in the region to the full lattice.
IPosition expand (const IPosition &index) const
virtual void doPutSlice (const Array< Bool > &sourceBuffer, const IPosition &where, const IPosition &stride)
 Regions can usually not be put; i.e.
virtual void set (const Bool &value)
virtual void apply (Bool(*function)(Bool))
virtual void apply (Bool(*function)(const Bool &))
virtual void apply (const Functional< Bool, Bool > &function)
virtual void putAt (const Bool &value, const IPosition &where)
virtual void copyData (const Lattice< Bool > &from)

Static Public Member Functions

static LCRegionfromRecord (const TableRecord &, const String &tableName)
 Convert correct object from a record.

Protected Member Functions

LCRegionoperator= (const LCRegion &other)
 Assignment (copy semantics) is only useful for derived classes.
virtual LCRegiondoTranslate (const Vector< Float > &translateVector, const IPosition &newLatticeShape) const =0
 Do the actual translate in a derived class.
void defineRecordFields (RecordInterface &record, const String &className) const
 Define the type and class name in the record.
void setBoundingBox (const Slicer &boundingBox)
 Sometimes it is inconvenient for a derived class to set the bounding box in the constructor.
void setShapeAndBoundingBox (const IPosition &latticeShape, const Slicer &boundingBox)

Private Attributes

IPosition itsShape
Slicer itsBoundingBox
String itsComment


Constructor & Destructor Documentation

casa::LCRegion::LCRegion (  ) 

casa::LCRegion::LCRegion ( const IPosition latticeShape  ) 

Construct with the lattice shape only.

casa::LCRegion::LCRegion ( const LCRegion other  ) 

Copy constructor (copy semantics).

virtual casa::LCRegion::~LCRegion (  )  [virtual]


Member Function Documentation

virtual Bool casa::LCRegion::operator== ( const LCRegion other  )  const [virtual]

Equality.

Bool casa::LCRegion::operator!= ( const LCRegion other  )  const [inline]

Watch out ! You must not, in the derived class structure, invoke LCRegion::operator!= If you do, you will be stuck in a time warp, as this will just fetch the operator== of the concrete class and you start all over again.

Be careful, do not use this anywhere in the derived class structure. You must use, e.g., if (! LCRegion::operator== (.\..)) rather than if (LCRegion::operator!= (.\..)) as the latter will invoke an infinite loop. It is ok to use when applying to a concrete class object.

Definition at line 252 of file LCRegion.h.

virtual Lattice<Bool>* casa::LCRegion::clone (  )  const [virtual]

Make a copy of the derived object.

Implements casa::Lattice< T >.

virtual LCRegion* casa::LCRegion::cloneRegion (  )  const [pure virtual]

virtual void casa::LCRegion::handleDelete (  )  [virtual]

Handle deletion of the region by deleting possible tables.

The default implementation does nothing.

virtual void casa::LCRegion::handleRename ( const String newName,
Bool  overwrite 
) [virtual]

Handle renaming the region by renaming possible tables.

The default implementation does nothing.

virtual String casa::LCRegion::type (  )  const [pure virtual]

Region type.

Returns className() of derived class.

const String & casa::LCRegion::comment (  )  const [inline]

Get or set the comment.

Definition at line 243 of file LCRegion.h.

References itsComment.

Referenced by setComment().

void casa::LCRegion::setComment ( const String comment  )  [inline]

Definition at line 247 of file LCRegion.h.

References comment(), and itsComment.

virtual Bool casa::LCRegion::hasMask (  )  const [pure virtual]

Does the region have a mask?

LCRegion * casa::LCRegion::translate ( const IPosition translateVector  )  const [inline]

Construct another LCRegion (for e.g.

another lattice) by moving this one. It recalculates the bounding box and mask. A positive translation value indicates "to right".

Definition at line 234 of file LCRegion.h.

References itsShape.

Referenced by translate().

LCRegion* casa::LCRegion::translate ( const IPosition translateVector,
const IPosition newLatticeShape 
) const

LCRegion * casa::LCRegion::translate ( const Vector< Float > &  translateVector  )  const [inline]

Definition at line 238 of file LCRegion.h.

References itsShape, and translate().

LCRegion* casa::LCRegion::translate ( const Vector< Float > &  translateVector,
const IPosition newLatticeShape 
) const

const IPosition & casa::LCRegion::latticeShape (  )  const [inline]

Give the full lattice shape.

Definition at line 230 of file LCRegion.h.

References itsShape.

const Slicer & casa::LCRegion::boundingBox (  )  const [inline]

Give the bounding box.

Definition at line 226 of file LCRegion.h.

References itsBoundingBox.

Slicer casa::LCRegion::expand ( const Slicer slicer  )  const

Expand a slicer or position in the region to the full lattice.

This converts the positions in the region to positions in the entire lattice.

IPosition casa::LCRegion::expand ( const IPosition index  )  const

virtual TableRecord casa::LCRegion::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.

static LCRegion* casa::LCRegion::fromRecord ( const TableRecord ,
const String tableName 
) [static]

Convert correct object from a record.

virtual uInt casa::LCRegion::ndim (  )  const [virtual]

Return the dimensionality of the region.

Reimplemented from casa::LatticeBase.

virtual IPosition casa::LCRegion::shape (  )  const [virtual]

Return the shape of the region (i.e.

of its bounding box).

Implements casa::LatticeBase.

virtual Bool casa::LCRegion::isWritable (  )  const [virtual]

Usually the lattice (i.e.

the region mask) is not writable.

Reimplemented from casa::LatticeBase.

virtual void casa::LCRegion::doPutSlice ( const Array< Bool > &  sourceBuffer,
const IPosition where,
const IPosition stride 
) [virtual]

Regions can usually not be put; i.e.

no putSlice, etc. can be done on their masks. Hence LCRegion throws by default an exception for the following functions.

virtual void casa::LCRegion::set ( const Bool value  )  [virtual]

virtual void casa::LCRegion::apply ( Bool(*)(Bool function  )  [virtual]

virtual void casa::LCRegion::apply ( Bool(*)(const Bool &)  function  )  [virtual]

virtual void casa::LCRegion::apply ( const Functional< Bool, Bool > &  function  )  [virtual]

virtual void casa::LCRegion::putAt ( const Bool value,
const IPosition where 
) [virtual]

virtual void casa::LCRegion::copyData ( const Lattice< Bool > &  from  )  [virtual]

LCRegion& casa::LCRegion::operator= ( const LCRegion other  )  [protected]

Assignment (copy semantics) is only useful for derived classes.

void casa::LCRegion::setBoundingBox ( const Slicer boundingBox  )  [protected]

Sometimes it is inconvenient for a derived class to set the bounding box in the constructor.

So it can be set explicitly. It fills in the possibly undefined Slicer values. It may even be needed to set the lattice shape.

void casa::LCRegion::setShapeAndBoundingBox ( const IPosition latticeShape,
const Slicer boundingBox 
) [protected]

virtual LCRegion* casa::LCRegion::doTranslate ( const Vector< Float > &  translateVector,
const IPosition newLatticeShape 
) const [protected, pure virtual]

Do the actual translate in a derived class.

\.

void casa::LCRegion::defineRecordFields ( RecordInterface record,
const String className 
) const [protected]

Define the type and class name in the record.


Member Data Documentation

IPosition casa::LCRegion::itsShape [private]

Definition at line 220 of file LCRegion.h.

Referenced by latticeShape(), and translate().

Slicer casa::LCRegion::itsBoundingBox [private]

Definition at line 221 of file LCRegion.h.

Referenced by boundingBox().

String casa::LCRegion::itsComment [private]

Definition at line 222 of file LCRegion.h.

Referenced by comment(), and setComment().


The documentation for this class was generated from the following file:
Generated on Mon Sep 1 22:46:22 2008 for NRAOCASA by  doxygen 1.5.1