casacore::LCRegionSingle Class Reference

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

#include <LCRegionSingle.h>

Inheritance diagram for casacore::LCRegionSingle:
casacore::LCRegion casacore::Lattice< Bool > casacore::LatticeBase casacore::LCHDF5Mask casacore::LCLELMask casacore::LCMask casacore::LCPagedMask casacore::LCRegionFixed casacore::LCBox casacore::LCEllipsoid casacore::LCPixelSet casacore::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)
 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.
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 80 of file LCRegionSingle.h.


Constructor & Destructor Documentation

casacore::LCRegionSingle::LCRegionSingle (  ) 
casacore::LCRegionSingle::LCRegionSingle ( const IPosition latticeShape  ) 

Construct with the lattice shape only.

casacore::LCRegionSingle::LCRegionSingle ( const LCRegionSingle other  ) 

Copy constructor (copy semantics).

virtual casacore::LCRegionSingle::~LCRegionSingle (  )  [virtual]

Member Function Documentation

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

Reimplemented from casacore::LCRegion.

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

Reimplemented from casacore::LCRegion.

virtual void casacore::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 casacore::LCRegion.

virtual void casacore::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 casacore::LCRegion.

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

Do the actual getting of the mask.

Implements casacore::Lattice< Bool >.

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

Get the best cursor shape.

Reimplemented from casacore::LatticeBase.

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

virtual void casacore::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 casacore::LCRegion.

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

Does the region have a mask?

Implements casacore::LCRegion.

virtual LatticeIterInterface<Bool>* casacore::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 casacore::Lattice< Bool >.

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

const Array<Bool> casacore::LCRegionSingle::maskArray (  )  const

Get the mask (as an array).

Bool casacore::LCRegionSingle::masksEqual ( const LCRegion other  )  const

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

LCRegionSingle& casacore::LCRegionSingle::operator= ( const LCRegionSingle other  )  [protected]
virtual void casacore::LCRegionSingle::putAt ( const Bool value,
const IPosition where 
) [virtual]

Put the value of a single element.


The default implementation uses putSlice.

Reimplemented from casacore::LCRegion.

virtual void casacore::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 casacore::LCRegion.

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

Set the pointer to the mask in the derived class.


Member Data Documentation

Definition at line 141 of file LCRegionSingle.h.

Definition at line 142 of file LCRegionSingle.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1