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

Generate statistics, tile by tile, from a masked lattice. More...

#include <LatticeStatistics.h>

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

List of all members.

Public Member Functions

 StatsTiledCollapser (const Vector< T > &pixelRange, Bool noInclude, Bool noExclude, Bool fixedMinMax)
 Constructor provides pixel selection range and whether that range is an inclusion or exclusion range.
virtual void init (uInt nOutPixelsPerCollapse)
 Initialize process, making some checks.
virtual void initAccumulator (uInt n1, uInt n3)
 Initialiaze the accumulator.
virtual void process (uInt accumIndex1, uInt accumIndex3, const T *inData, const Bool *inMask, uInt dataIncr, uInt maskIncr, uInt nrval, const IPosition &startPos, const IPosition &shape)
 Process the data in the current chunk.
virtual void endAccumulator (Array< U > &result, Array< Bool > &resultMask, const IPosition &shape)
 End the accumulation process and return the result arrays.
virtual Bool canHandleNullMask () const
 Can handle null mask.
void minMaxPos (IPosition &minPos, IPosition &maxPos)
 Find the location of the minimum and maximum data values in the input lattice.

Private Attributes

Vector< T > range_p
Bool noInclude_p
Bool noExclude_p
Bool fixedMinMax_p
IPosition minPos_p
IPosition maxPos_p
Block< U > * pSum_p
 Accumulators for sum, sum squared, number of points minimum, and maximum.
Block< U > * pSumSq_p
Block< U > * pNPts_p
Block< U > * pMean_p
Block< U > * pVariance_p
Block< U > * pNVariance_p
Block< T > * pMin_p
Block< T > * pMax_p
Block< Bool > * pInitMinMax_p
uInt n1_p
uInt n3_p

Detailed Description

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

Generate statistics, tile by tile, from a masked lattice.

Intended use:

Public interface

 <h3>Review Status</h3><dl><dt>Date Reviewed:<dd>yyyy/mm/dd</dl> 

Prerequisite

Etymology

This class is used by LatticeStatistics to generate statistical sum from an input MaskedLattice. The input lattice is iterated through in tile-sized chunks and fed to an object of this class.

Synopsis

StatsTiledCollapser is derived from TiledCollapser which is a base class used to define methods. Objects of this base class are used by LatticeApply functions. In this particular case, we are interested in LatticeApply::tiledApply. This function iterates through a MaskedLattice and allows you to collapse one or more axes, computing some values from it, and placing those values into an output MaskedLattice. It iterates through the input lattice in optimal tile-sized chunks. LatticeStatistics uses a StatsTiledCollapser object which it gives to LatticeApply::tiledApply for digestion. After it has done its work, LatticeStatistics then accesses the output Lattice that it made.

Example

   // Create collapser. Control information is passed in via the constructor
   
      StatsTiledCollapser<T> collapser(range_p, noInclude_p, noExclude_p,   
                                       fixedMinMax_p, blcParent_p);
    
   // This is the first output axis getting  collapsed values. In LatticeStatistics
   // this is the last axis of the output lattice
    
      Int newOutAxis = outLattice.ndim()-1;
   
   // tiledApply does the work by passing the collapser data in chunks
   // and by writing the results into the output lattice 
   
      LatticeApply<T>::tiledApply(outLattice, inLattice,
                                  collapser, collapseAxes,
                                  newOutAxis);

In this example, a collapser is made and passed to LatticeApply. Afterwards, the output Lattice is available for use. The Lattices must all be the correct shapes on input to tiledApply

Motivation

The LatticeApply classes enable the ugly details of optimal Lattice iteration to be hidden from the user.

To Do

Definition at line 619 of file LatticeStatistics.h.


Constructor & Destructor Documentation

template<class T , class U = T>
casa::StatsTiledCollapser< T, U >::StatsTiledCollapser ( const Vector< T > &  pixelRange,
Bool  noInclude,
Bool  noExclude,
Bool  fixedMinMax 
)

Constructor provides pixel selection range and whether that range is an inclusion or exclusion range.

If fixedMinMax=True and an inclusion range is given, the min and max is set to that inclusion range.


Member Function Documentation

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

Can handle null mask.

Reimplemented from casa::TiledCollapser< T, U >.

Definition at line 650 of file LatticeStatistics.h.

References casa::True.

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

End the accumulation process and return the result arrays.

Implements casa::TiledCollapser< T, U >.

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

Initialize process, making some checks.

Implements casa::TiledCollapser< T, U >.

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

Initialiaze the accumulator.

Implements casa::TiledCollapser< T, U >.

template<class T , class U = T>
void casa::StatsTiledCollapser< T, U >::minMaxPos ( IPosition minPos,
IPosition maxPos 
)

Find the location of the minimum and maximum data values in the input lattice.

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

Process the data in the current chunk.

Implements casa::TiledCollapser< T, U >.


Member Data Documentation

template<class T , class U = T>
Bool casa::StatsTiledCollapser< T, U >::fixedMinMax_p [private]

Definition at line 659 of file LatticeStatistics.h.

template<class T , class U = T>
IPosition casa::StatsTiledCollapser< T, U >::maxPos_p [private]

Definition at line 660 of file LatticeStatistics.h.

template<class T , class U = T>
IPosition casa::StatsTiledCollapser< T, U >::minPos_p [private]

Definition at line 660 of file LatticeStatistics.h.

template<class T , class U = T>
uInt casa::StatsTiledCollapser< T, U >::n1_p [private]

Definition at line 677 of file LatticeStatistics.h.

template<class T , class U = T>
uInt casa::StatsTiledCollapser< T, U >::n3_p [private]

Definition at line 678 of file LatticeStatistics.h.

template<class T , class U = T>
Bool casa::StatsTiledCollapser< T, U >::noExclude_p [private]

Definition at line 659 of file LatticeStatistics.h.

template<class T , class U = T>
Bool casa::StatsTiledCollapser< T, U >::noInclude_p [private]

Definition at line 659 of file LatticeStatistics.h.

template<class T , class U = T>
Block<Bool>* casa::StatsTiledCollapser< T, U >::pInitMinMax_p [private]

Definition at line 675 of file LatticeStatistics.h.

template<class T , class U = T>
Block<T>* casa::StatsTiledCollapser< T, U >::pMax_p [private]

Definition at line 674 of file LatticeStatistics.h.

template<class T , class U = T>
Block<U>* casa::StatsTiledCollapser< T, U >::pMean_p [private]

Definition at line 668 of file LatticeStatistics.h.

template<class T , class U = T>
Block<T>* casa::StatsTiledCollapser< T, U >::pMin_p [private]

Definition at line 673 of file LatticeStatistics.h.

template<class T , class U = T>
Block<U>* casa::StatsTiledCollapser< T, U >::pNPts_p [private]

Definition at line 667 of file LatticeStatistics.h.

template<class T , class U = T>
Block<U>* casa::StatsTiledCollapser< T, U >::pNVariance_p [private]

Definition at line 671 of file LatticeStatistics.h.

template<class T , class U = T>
Block<U>* casa::StatsTiledCollapser< T, U >::pSum_p [private]

Accumulators for sum, sum squared, number of points minimum, and maximum.

Definition at line 665 of file LatticeStatistics.h.

template<class T , class U = T>
Block<U>* casa::StatsTiledCollapser< T, U >::pSumSq_p [private]

Definition at line 666 of file LatticeStatistics.h.

template<class T , class U = T>
Block<U>* casa::StatsTiledCollapser< T, U >::pVariance_p [private]

Definition at line 670 of file LatticeStatistics.h.

template<class T , class U = T>
Vector<T> casa::StatsTiledCollapser< T, U >::range_p [private]

Definition at line 658 of file LatticeStatistics.h.


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