Computes simple clipped, and masked moments. More...
#include <MomentClip.h>
Public Member Functions | |
MomentClip (shared_ptr< Lattice< T >> pAncilliaryLattice, MomentsBase< T > &iMom, LogIO &os, const uInt nLatticeOut) | |
Constructor. | |
virtual | ~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 | |
shared_ptr< Lattice< T > > | _ancilliaryLattice |
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 123 of file MomentClip.h.
casa::MomentClip< T >::MomentClip | ( | shared_ptr< 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.
virtual casa::MomentClip< T >::~MomentClip | ( | ) | [virtual] |
Destructor (does nothing).
virtual Bool casa::MomentClip< T >::canHandleNullMask | ( | ) | const [inline, virtual] |
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.
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.
shared_ptr<Lattice<T> > casa::MomentClip< T >::_ancilliaryLattice [private] |
Definition at line 157 of file MomentClip.h.
Vector<T> casa::MomentClip< T >::ancilliarySliceRef_p [private] |
Definition at line 166 of file MomentClip.h.
Bool casa::MomentClip< T >::doExclude_p [private] |
Definition at line 169 of file MomentClip.h.
Bool casa::MomentClip< T >::doInclude_p [private] |
Definition at line 169 of file MomentClip.h.
MomentsBase<T>& casa::MomentClip< T >::iMom_p [private] |
Definition at line 162 of file MomentClip.h.
LogIO casa::MomentClip< T >::os_p [private] |
Definition at line 163 of file MomentClip.h.
const Vector<T>* casa::MomentClip< T >::pProfileSelect_p [private] |
Definition at line 165 of file MomentClip.h.
Vector<T> casa::MomentClip< T >::range_p [private] |
Definition at line 170 of file MomentClip.h.
Vector<T> casa::MomentClip< T >::selectedData_p [private] |
Definition at line 167 of file MomentClip.h.
Vector<Int> casa::MomentClip< T >::selectedDataIndex_p [private] |
Definition at line 168 of file MomentClip.h.
IPosition casa::MomentClip< T >::sliceShape_p [private] |
Definition at line 171 of file MomentClip.h.