casa
$Rev:20696$
|
Compute moments from a Gaussian fitted to a profile. More...
#include <MomentCalculator.h>
Public Member Functions | |
MomentFit (MomentsBase< T > &iMom, LogIO &os, const uInt nLatticeOut) | |
Constructor. | |
~MomentFit () | |
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. | |
Private Attributes | |
MomentsBase< T > & | iMom_p |
LogIO | os_p |
T | stdDeviation_p |
T | peakSNR_p |
Bool | doAuto_p |
Bool | doFit_p |
Gaussian1D< T > | gauss_p |
Compute moments from a Gaussian fitted to a profile.
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 MomentFit object and passes it to the LatticeApply function, lineMultiApply. This function iterates through a given lattice, and invokes the multiProcess
member function of MomentFit 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.
MomentFit computes moments by fitting a Gaussian to each profile. The moments are then computed from that fit. The fitting can be done either interactively or automatically.
The constructor takes MomentsBase object that is actually an ImageMoments or an MSMoments object; the one that is constructing the MomentFit object of course. There is much control information embodied in the state of the ImageMoments object. This information is extracted by the MomentCalcBase class and passed on to MomentFit for consumption.
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. os_P is a LogIO object.
// Construct desired moment calculator object. Use it polymorphically via // a pointer to the base class. 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 1018 of file MomentCalculator.h.
casa::MomentFit< T >::MomentFit | ( | MomentsBase< T > & | iMom, |
LogIO & | os, | ||
const uInt | nLatticeOut | ||
) |
Constructor.
We need the ImageMoments or MSMoments object which is calling us, its logger, and the number of output lattices it has created.
casa::MomentFit< T >::~MomentFit | ( | ) |
Destructor (does nothing).
virtual void casa::MomentFit< 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::MomentFit< 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 >.
Bool casa::MomentFit< T >::doAuto_p [private] |
Definition at line 1051 of file MomentCalculator.h.
Bool casa::MomentFit< T >::doFit_p [private] |
Definition at line 1051 of file MomentCalculator.h.
Gaussian1D<T> casa::MomentFit< T >::gauss_p [private] |
Definition at line 1052 of file MomentCalculator.h.
MomentsBase<T>& casa::MomentFit< T >::iMom_p [private] |
Definition at line 1048 of file MomentCalculator.h.
LogIO casa::MomentFit< T >::os_p [private] |
Definition at line 1049 of file MomentCalculator.h.
T casa::MomentFit< T >::peakSNR_p [private] |
Definition at line 1050 of file MomentCalculator.h.
T casa::MomentFit< T >::stdDeviation_p [private] |
Definition at line 1050 of file MomentCalculator.h.