casacore
Public Member Functions | List of all members
casacore::TiledCollapser< T, U > Class Template Referenceabstract

More...

#include <TiledCollapser.h>

Public Member Functions

virtual ~TiledCollapser ()
 Destructor. More...
 
virtual void init (uInt nOutPixelsPerCollapse)=0
 The init function for a derived class. More...
 
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). More...
 
virtual void initAccumulator (uInt64 n1, uInt64 n3)=0
 Create and initialize the accumulator. More...
 
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 inDataIncr elements). More...
 
virtual void endAccumulator (Array< U > &result, Array< Bool > &resultMask, const IPosition &shape)=0
 End the accumulator. More...
 

Detailed Description

template<class T, class U = T>
class casacore::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 94 of file TiledCollapser.h.

Constructor & Destructor Documentation

◆ ~TiledCollapser()

template<class T , class U = T>
virtual casacore::TiledCollapser< T, U >::~TiledCollapser ( )
virtual

Destructor.

Member Function Documentation

◆ canHandleNullMask()

template<class T , class U = T>
virtual Bool casacore::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 casacore::StatsTiledCollapser< T, U >, and casacore::HistTiledCollapser< T >.

◆ endAccumulator()

template<class T , class U = T>
virtual void casacore::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 casacore::HistTiledCollapser< T >.

◆ init()

template<class T , class U = T>
virtual void casacore::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 casacore::StatsTiledCollapser< T, U >, and casacore::HistTiledCollapser< T >.

◆ initAccumulator()

template<class T , class U = T>
virtual void casacore::TiledCollapser< T, U >::initAccumulator ( uInt64  n1,
uInt64  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 casacore::StatsTiledCollapser< T, U >, and casacore::HistTiledCollapser< T >.

◆ process()

template<class T , class U = T>
virtual void casacore::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 inDataIncr 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 casacore::HistTiledCollapser< T >, and casacore::StatsTiledCollapser< T, U >.


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