casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
casa::TiledCollapser< T, U > Class Template Reference

Abstract base class to collapse chunks for LatticeApply. More...

#include <TiledCollapser.h>

Inheritance diagram for casa::TiledCollapser< T, U >:
casa::StatsTiledCollapser< T, U >

List of all members.

Public Member Functions

virtual ~TiledCollapser ()
 Destructor.
virtual void init (uInt nOutPixelsPerCollapse)=0
 The init function for a derived class.
virtual Bool canHandleNullMask () const
 Can the process function in the derived class handle a null mask pointer? If not, LatticeApply ensures that it'll always pass a mask block, even if the lattice does not have a mask (in that case that mask block contains all True values).
virtual void initAccumulator (uInt n1, uInt n3)=0
 Create and initialize the accumulator.
virtual void process (uInt accumIndex1, uInt accumIndex3, const T *inData, const Bool *inMask, uInt inDataIncr, uInt inMaskIncr, uInt nrval, const IPosition &startPos, const IPosition &shape)=0
 Collapse the given input data containing (nrval values with an increment of inIncr elements).
virtual void endAccumulator (Array< U > &result, Array< Bool > &resultMask, const IPosition &shape)=0
 End the accumulator.

Detailed Description

template<class T, class U = T>
class casa::TiledCollapser< T, U >

Abstract base class to collapse chunks for LatticeApply.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

Synopsis

This is an abstract base class for the collapsing of chunks to be used in function tiledApply in class LatticeApply . It is meant for cases where an entire line or plane is not needed (e.g. calculation of maximum). If that is needed (e.g. to calculate moment), it is better to use function LatticeApply::lineApply with class LineCollapser .

The user has to derive a concrete class from this base class and implement the (pure) virtual functions.
The main function is process, which needs to do the calculation.
Other functions make it possible to perform an initial check.

The class is Doubly templated. Ths first template type is for the data type you are processing. The second type is for what type you want the results of the processing assigned to. For example, if you are computing sums of squares for statistical purposes, you might use higher precision (FLoat->Double) for this. No check is made that the template types are self-consistent.

Example

Motivation

To Do

Definition at line 95 of file TiledCollapser.h.


Constructor & Destructor Documentation

template<class T, class U = T>
virtual casa::TiledCollapser< T, U >::~TiledCollapser ( ) [virtual]

Destructor.


Member Function Documentation

template<class T, class U = T>
virtual Bool casa::TiledCollapser< T, U >::canHandleNullMask ( ) const [virtual]

Can the process function in the derived class handle a null mask pointer? If not, LatticeApply ensures that it'll always pass a mask block, even if the lattice does not have a mask (in that case that mask block contains all True values).


The default implementation returns False.
The function is there to make optimization possible when no masks are involved. On the other side, it allows the casual user to ignore optimization.

Reimplemented in casa::StatsTiledCollapser< T, U >, and casa::HistTiledCollapser< T >.

template<class T, class U = T>
virtual void casa::TiledCollapser< T, U >::endAccumulator ( Array< U > &  result,
Array< Bool > &  resultMask,
const IPosition shape 
) [pure virtual]

End the accumulator.

It should return the accumulator as an Array of datatype U (e.g. double the precision of type T) with the given shape. The accumulator should thereafter be deleted when needed.

Implemented in casa::StatsTiledCollapser< T, U >, and casa::HistTiledCollapser< T >.

template<class T, class U = T>
virtual void casa::TiledCollapser< T, U >::init ( uInt  nOutPixelsPerCollapse) [pure virtual]

The init function for a derived class.

It can be used to check if nOutPixelsPerCollapse corresponds with the number of pixels produced per collapsed chunk.
processAxis is the axis of the line being passed to the process function.

Implemented in casa::StatsTiledCollapser< T, U >, and casa::HistTiledCollapser< T >.

template<class T, class U = T>
virtual void casa::TiledCollapser< T, U >::initAccumulator ( uInt  n1,
uInt  n3 
) [pure virtual]

Create and initialize the accumulator.

The accumulator can be a cube with shape [n1,n2,n3], where n2 is equal to nOutPixelsPerCollapse. However, one can also use several matrices as accumulator.
The data type of the accumulator can be any. E.g. when accumulating Float lattices, the accumulator could be of type Double to have enough precision.
In the endAccumulator function the accumulator data has to be copied into an Array object with the correct shape and data type.

Implemented in casa::StatsTiledCollapser< T, U >, and casa::HistTiledCollapser< T >.

template<class T, class U = T>
virtual void casa::TiledCollapser< T, U >::process ( uInt  accumIndex1,
uInt  accumIndex3,
const T *  inData,
const Bool inMask,
uInt  inDataIncr,
uInt  inMaskIncr,
uInt  nrval,
const IPosition startPos,
const IPosition shape 
) [pure virtual]

Collapse the given input data containing (nrval values with an increment of inIncr elements).

inMask is a Bool block representing a mask with the same nr of values and increment as the input data. If a mask value is False, the corresponding input value is masked off.
When function canHandleNullMask returned True, it is possible that inMask is a null pointer indicating that the input has no mask, thus all values are valid.
The result(s) have to be stored in the accumulator at the given indices.
startPos gives the lattice position of the first value. The position of other values can be calculated from index and shape using function toPositionInArray in class IPosition .

Implemented in casa::StatsTiledCollapser< T, U >, and casa::HistTiledCollapser< T >.


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