LCRegionSingle.h

Classes

LCRegionSingle -- Abstract base class to define a single region. (full description)

class LCRegionSingle : public LCRegion

Interface

Public Members
LCRegionSingle()
LCRegionSingle (const IPosition& latticeShape)
LCRegionSingle (const LCRegionSingle& other)
virtual ~LCRegionSingle()
virtual Bool hasMask() const
const Array<Bool> maskArray() const
Bool masksEqual (const LCRegion& other) const
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)
Protected Members
LCRegionSingle& operator= (const LCRegionSingle& other)
void setMaskPtr (Lattice<Bool>& mask)
virtual Bool doGetSlice (Array<Bool>& buffer, const Slicer& section)
virtual void doPutSlice (const Array<Bool>& sourceBuffer, const IPosition& where, const IPosition& stride)
virtual IPosition doNiceCursorShape (uInt maxPixels) const
virtual LatticeIterInterface<Bool>* makeIter (const LatticeNavigator& navigator, Bool useRef) const

Description

Prerequisite

Synopsis

The LCRegion class is the abstract base class for various types of LCRegion's (e.g. LCRegionEllipsoid, LCRegionBox). 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.

Member Description

LCRegionSingle()

LCRegionSingle (const IPosition& latticeShape)

Construct with the lattice shape only.

LCRegionSingle (const LCRegionSingle& other)

Copy constructor (copy semantics).

virtual ~LCRegionSingle()

virtual Bool hasMask() const

Does the region have a mask?

const Array<Bool> maskArray() const

Get the mask (as an array).

Bool masksEqual (const LCRegion& other) const

Is the mask of this region the same as the mask of the other

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)

The following "put" functions are described in detail in class Lattice. They'll throw an exception is no mask is available or if the mask is not writable.

LCRegionSingle& operator= (const LCRegionSingle& other)

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

void setMaskPtr (Lattice<Bool>& mask)

Set the pointer to the mask in the derived class.

virtual Bool doGetSlice (Array<Bool>& buffer, const Slicer& section)

Do the actual getting of the mask.

virtual void doPutSlice (const Array<Bool>& sourceBuffer, const IPosition& where, const IPosition& stride)

Do the actual putting of the mask. Only possible if region is writable.

virtual IPosition doNiceCursorShape (uInt maxPixels) const

Get the best cursor shape.

virtual LatticeIterInterface<Bool>* makeIter (const LatticeNavigator& navigator, Bool useRef) const

Make an iterator. When the underlying region has a mask, an iterator for that region is returned. Otherwise the standard iterator is returned.