casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Attributes
casa::LCRegionSingle Class Reference

Abstract base class to define a single region. More...

#include <LCRegionSingle.h>

Inheritance diagram for casa::LCRegionSingle:
casa::LCRegion casa::Lattice< Bool > casa::LatticeBase casa::LCHDF5Mask casa::LCLELMask casa::LCMask casa::LCPagedMask casa::LCRegionFixed casa::LCBox casa::LCEllipsoid casa::LCPixelSet casa::LCPolygon

List of all members.

Public Member Functions

 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< BoolmaskArray () 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)
 The following "put" functions are described in detail in class Lattice .
virtual void apply (Bool(*function)(Bool))
 Replace every element, x, of the Lattice with the result of f(x).
virtual void apply (Bool(*function)(const Bool &))
virtual void apply (const Functional< Bool, Bool > &function)
virtual void putAt (const Bool &value, const IPosition &where)
 Put the value of a single element.
virtual void copyData (const Lattice< Bool > &from)
 Copy the data from the given lattice to this one.

Protected Member Functions

LCRegionSingleoperator= (const LCRegionSingle &other)
 
     

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.
virtual IPosition doNiceCursorShape (uInt maxPixels) const
 Get the best cursor shape.
virtual LatticeIterInterface
< Bool > * 
makeIter (const LatticeNavigator &navigator, Bool useRef) const
 Make an iterator.

Private Attributes

Bool itsHasMask
Lattice< Bool > * itsMaskPtr

Detailed Description

Abstract base class to define a single region.

Intended use:

Public interface

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.

Definition at line 79 of file LCRegionSingle.h.


Constructor & Destructor Documentation

Construct with the lattice shape only.

Copy constructor (copy semantics).


Member Function Documentation

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

Replace every element, x, of the Lattice with the result of f(x).

You must pass in the address of the function -- so the function must be declared and defined in the scope of your program. All versions of apply require a function that accepts a single argument of type T (the Lattice template type) and return a result of the same type. The first apply expects a function with an argument passed by value; the second expects the argument to be passed by const reference; the third requires an instance of the class Functional<T,T>. The first form ought to run faster for the built-in types, which may be an issue for large Lattices stored in memory, where disk access is not an issue.

Reimplemented from casa::LCRegion.

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

Reimplemented from casa::LCRegion.

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

Reimplemented from casa::LCRegion.

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

Copy the data from the given lattice to this one.

The default implementation uses function copyDataTo.

Reimplemented from casa::LCRegion.

virtual Bool casa::LCRegionSingle::doGetSlice ( Array< Bool > &  buffer,
const Slicer section 
) [protected, virtual]

Do the actual getting of the mask.

Implements casa::Lattice< Bool >.

virtual IPosition casa::LCRegionSingle::doNiceCursorShape ( uInt  maxPixels) const [protected, virtual]

Get the best cursor shape.

Reimplemented from casa::LatticeBase.

Reimplemented in casa::LCMask, casa::LCPagedMask, and casa::LCHDF5Mask.

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

Do the actual putting of the mask.

Only possible if region is writable.

Reimplemented from casa::LCRegion.

virtual Bool casa::LCRegionSingle::hasMask ( ) const [virtual]

Does the region have a mask?

Implements casa::LCRegion.

virtual LatticeIterInterface<Bool>* casa::LCRegionSingle::makeIter ( const LatticeNavigator navigator,
Bool  useRef 
) const [protected, virtual]

Make an iterator.

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

Reimplemented from casa::Lattice< Bool >.

Reimplemented in casa::LCMask, casa::LCPagedMask, and casa::LCHDF5Mask.

Get the mask (as an array).

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

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

     

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

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

Put the value of a single element.


The default implementation uses putSlice.

Reimplemented from casa::LCRegion.

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

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.

Reimplemented from casa::LCRegion.

void casa::LCRegionSingle::setMaskPtr ( Lattice< Bool > &  mask) [protected]

Set the pointer to the mask in the derived class.


Member Data Documentation

Definition at line 140 of file LCRegionSingle.h.

Definition at line 141 of file LCRegionSingle.h.


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