casa
$Rev:20696$
|
Computes simple clipped, and masked moments. More...
#include <MomentCalculator.h>
Public Member Functions | |
MomentClip (Lattice< T > *pAncilliaryLattice, MomentsBase< T > &iMom, LogIO &os, const uInt nLatticeOut) | |
Constructor. | |
~MomentClip () | |
Destructor (does nothing). | |
virtual void | process (T &out, Bool &outMask, const Vector< T > &in, const Vector< Bool > &inMask, const IPosition &pos) |
This function is not implemented and throws an exception. | |
virtual void | multiProcess (Vector< T > &out, Vector< Bool > &outMask, const Vector< T > &in, const Vector< Bool > &inMask, const IPosition &pos) |
This function returns a vector of numbers from each input vector. | |
virtual Bool | canHandleNullMask () const |
Can handle null mask. | |
Private Attributes | |
Lattice< T > * | pAncilliaryLattice_p |
MomentsBase< T > & | iMom_p |
LogIO | os_p |
const Vector< T > * | pProfileSelect_p |
Vector< T > | ancilliarySliceRef_p |
Vector< T > | selectedData_p |
Vector< Int > | selectedDataIndex_p |
Bool | doInclude_p |
Bool | doExclude_p |
Vector< T > | range_p |
IPosition | sliceShape_p |
Computes simple clipped, and masked moments.
Public interface
This concrete class is derived from the abstract base class MomentCalcBase which provides an interface layer to the ImageMoments or MSMoments driver class. ImageMoments or MSMoments creates a MomentClip object and passes it to the LatticeApply function, lineMultiApply. This function iterates through a given lattice, and invokes the multiProcess
member function of MomentClip on each vector of pixels that it extracts from the input lattice. The multiProcess
function returns a vector of moments which are inserted into the output lattices also supplied to the LatticeApply function.
MomentClip computes moments directly from a vector of pixel intensities extracted from the primary lattice. An optional pixel intensity inclusion or exclusion range can be applied. It can also compute a mask based on the inclusion or exclusion ranges applied to an ancilliary lattice (the ancilliary vector corresponding to the primary vector is extracted). This mask is then applied to the primary vector for moment computation (ImageMoments or MSMoments offers a smoothed version of the primary lattice as the ancilliary lattice)
The constructor takes an MomentsBase object that is actually an ImageMoments or an MSMoments object; the one that is constructing the MomentClip object of course. There is much control information embodied in the state of the ImageMoments or MSMoments object. This information is extracted by the MomentCalcBase class and passed on to MomentClip for consumption.
Note that the ancilliary lattice is only accessed if the ImageMoments or MSMoments object indicates that a pixel inclusion or exclusion range has been given as well as the pointer to the lattice having a non-zero value.
See the MomentsBase , ImageMoments , and MSMoments for discussion about the moments that are available for computation.
This example comes from ImageMoments. outPt is a pointer block holding pointers to the output lattices. The ancilliary masking lattice is just a smoothed version of the input lattice.
// Construct desired moment calculator object. Use it polymorphically // via a pointer to the base class. os_P is a LogIO object. MomentCalcBase<T>* pMomentCalculator = 0; if (clipMethod || smoothClipMethod) { pMomentCalculator = new MomentClip<T>(pSmoothedImage, *this, os_p, outPt.nelements()); } else if (windowMethod) { pMomentCalculator = new MomentWindow<T>(pSmoothedImage, *this, os_p, outPt.nelements()); } else if (fitMethod) { pMomentCalculator = new MomentFit<T>(*this, os_p, outPt.nelements()); } // Iterate optimally through the image, compute the moments, fill the output lattices LatticeApply<T>::lineMultiApply(outPt, *pInImage_p, *pMomentCalculator, momentAxis_p, pProgressMeter); delete pMomentCalculator;
Tip: Note that there are is assignment operator or copy constructor; Do not use the ones the system would generate either;
Definition at line 609 of file MomentCalculator.h.
casa::MomentClip< T >::MomentClip | ( | Lattice< T > * | pAncilliaryLattice, |
MomentsBase< T > & | iMom, | ||
LogIO & | os, | ||
const uInt | nLatticeOut | ||
) |
Constructor.
The pointer is to an ancilliary lattice used as a mask. If no masking lattice is desired, the pointer value must be zero. We also need the ImageMoments or MSMoments object which is calling us, its logger, and the number of output lattices it has created.
casa::MomentClip< T >::~MomentClip | ( | ) |
Destructor (does nothing).
virtual Bool casa::MomentClip< T >::canHandleNullMask | ( | ) | const [inline, virtual] |
Can handle null mask.
Reimplemented from casa::LineCollapser< T, T >.
Definition at line 642 of file MomentCalculator.h.
virtual void casa::MomentClip< T >::multiProcess | ( | Vector< T > & | out, |
Vector< Bool > & | outMask, | ||
const Vector< T > & | in, | ||
const Vector< Bool > & | inMask, | ||
const IPosition & | pos | ||
) | [virtual] |
This function returns a vector of numbers from each input vector.
the output vector contains the moments known to the ImageMoments or MSMoments object passed into the constructor.
Implements casa::LineCollapser< T, T >.
virtual void casa::MomentClip< T >::process | ( | T & | out, |
Bool & | outMask, | ||
const Vector< T > & | in, | ||
const Vector< Bool > & | inMask, | ||
const IPosition & | pos | ||
) | [virtual] |
This function is not implemented and throws an exception.
Implements casa::LineCollapser< T, T >.
Vector<T> casa::MomentClip< T >::ancilliarySliceRef_p [private] |
Definition at line 651 of file MomentCalculator.h.
Bool casa::MomentClip< T >::doExclude_p [private] |
Definition at line 654 of file MomentCalculator.h.
Bool casa::MomentClip< T >::doInclude_p [private] |
Definition at line 654 of file MomentCalculator.h.
MomentsBase<T>& casa::MomentClip< T >::iMom_p [private] |
Definition at line 647 of file MomentCalculator.h.
LogIO casa::MomentClip< T >::os_p [private] |
Definition at line 648 of file MomentCalculator.h.
Lattice<T>* casa::MomentClip< T >::pAncilliaryLattice_p [private] |
Definition at line 642 of file MomentCalculator.h.
const Vector<T>* casa::MomentClip< T >::pProfileSelect_p [private] |
Definition at line 650 of file MomentCalculator.h.
Vector<T> casa::MomentClip< T >::range_p [private] |
Definition at line 655 of file MomentCalculator.h.
Vector<T> casa::MomentClip< T >::selectedData_p [private] |
Definition at line 652 of file MomentCalculator.h.
Vector<Int> casa::MomentClip< T >::selectedDataIndex_p [private] |
Definition at line 653 of file MomentCalculator.h.
IPosition casa::MomentClip< T >::sliceShape_p [private] |
Definition at line 656 of file MomentCalculator.h.