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

Computes moments from a windowed profile. More...

#include <MomentCalculator.h>

Inheritance diagram for casa::MomentWindow< T >:
casa::MomentCalcBase< T > casa::LineCollapser< T, T >

List of all members.

Public Member Functions

 MomentWindow (Lattice< T > *pAncilliaryLattice, MomentsBase< T > &iMom, LogIO &os, const uInt nLatticeOut)
 Constructor.
 ~MomentWindow ()
 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 Member Functions

void drawWindow (const Vector< Int > &window, PGPlotter &plotter) const
 Draw two vertical lines marking a spectral window.
Bool getAutoWindow (uInt &nFailed, Vector< Int > &window, const Vector< T > &x, const Vector< T > &y, const Vector< Bool > &mask, const T peakSNR, const T stdDeviation, const Bool doFit, PGPlotter &plotter, const Bool fixedYLimits, const T yMinAuto, const T yMaxAuto, const String xLabel, const String yLabel, const String title) const
 Automatically determine the spectral window.
Bool getBosmaWindow (Vector< Int > &window, const Vector< T > &x, const Vector< T > &y, const Vector< Bool > &mask, const T peakSNR, const T stdDeviation, PGPlotter &plotter, const Bool fixedYLimits, const T yMinAuto, const T yMaxAuto, const String xLabel, const String yLabel, const String title) const
 Automatically determine the spectral window via Bosma's algorithm.
Bool getInterDirectWindow (Bool &allSubsequent, LogIO &os, Vector< Int > &window, const Vector< T > &x, const Vector< T > &y, const Vector< Bool > &mask, const Bool fixedYLimits, const T yMinAuto, const T yMaxAuto, const String xLabel, const String yLabel, const String title, PGPlotter &plotter) const
 Interactively specify the spectral window with the cursor.
Bool getInterWindow (uInt &nFailed, Bool &allSubsequent, LogIO &os, Vector< Int > &window, const Bool doFit, const Vector< T > &x, const Vector< T > &y, const Vector< Bool > &mask, const Bool fixedYLimits, const T yMinAuto, const T yMaxAuto, const String xLabel, const String yLabel, const String title, PGPlotter &plotter) const
 Interactively define the spectral window Returns false if can't define window.
Bool setNSigmaWindow (Vector< Int > &window, const T pos, const T width, const Int nPts, const Int N) const
 Take the fitted Gaussian parameters and set an N-sigma window.

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
stdDeviation_p
peakSNR_p
Bool doAuto_p
Bool doFit_p
IPosition sliceShape_p

Detailed Description

template<class T>
class casa::MomentWindow< T >

Computes moments from a windowed profile.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Synopsis

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 MomentWindow object and passes it to the LatticeApply function lineMultiApply. This function iterates through a given lattice, and invokes the multiProcess member function of MomentWindow on each profile 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.

MomentWindow computes moments from a subset of the pixels selected from the input profile. This subset is a simple index range, or window. The window is selected, for each profile, that is thought to surround the spectral feature of interest. This window can be found from the primary lattice, or from an ancilliary lattice (ImageMoments or MSMoments offers a smoothed version of the primary lattice as the ancilliary lattice). The moments are always computed from primary lattice data.

For each profile, the window can be found either interactively or automatically. There are two interactive methods. Either you just mark the window with the cursor, or you interactively fit a Gaussian to the profile and the +/- 3-sigma window is returned. There are two automatic methods. Either Bosma's converging mean algorithm is used, or an automatically fit Gaussian +/- 3-sigma window is returned.

The constructor takes an MomentsBase object that is actually an ImageMoments or an MSMoments object; the one that is constructing the MomentWindow 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 MomentWindow for consumption.

Note that the ancilliary lattice is only accessed if the pointer to it is non zero.

See the MomentsBase , ImageMoments , and MSMoments for discussion about the moments that are available for computation.

Example

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. 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;

Motivation


Tip: Note that there are is assignment operator or copy constructor; Do not use the ones the system would generate either;

Definition at line 783 of file MomentCalculator.h.


Constructor & Destructor Documentation

template<class T >
casa::MomentWindow< T >::MomentWindow ( Lattice< T > *  pAncilliaryLattice,
MomentsBase< T > &  iMom,
LogIO os,
const uInt  nLatticeOut 
)

Constructor.

The pointer is to a lattice containing the masking lattice (created by ImageMoments or MSMoments). We also need the ImageMoments or MSMoments object which is calling us, its logger, and the number of output lattices it has created.

template<class T >
casa::MomentWindow< T >::~MomentWindow ( )

Destructor (does nothing).


Member Function Documentation

template<class T >
void casa::MomentWindow< T >::drawWindow ( const Vector< Int > &  window,
PGPlotter plotter 
) const [private]

Draw two vertical lines marking a spectral window.

template<class T >
Bool casa::MomentWindow< T >::getAutoWindow ( uInt nFailed,
Vector< Int > &  window,
const Vector< T > &  x,
const Vector< T > &  y,
const Vector< Bool > &  mask,
const T  peakSNR,
const T  stdDeviation,
const Bool  doFit,
PGPlotter plotter,
const Bool  fixedYLimits,
const T  yMinAuto,
const T  yMaxAuto,
const String  xLabel,
const String  yLabel,
const String  title 
) const [private]

Automatically determine the spectral window.

template<class T >
Bool casa::MomentWindow< T >::getBosmaWindow ( Vector< Int > &  window,
const Vector< T > &  x,
const Vector< T > &  y,
const Vector< Bool > &  mask,
const T  peakSNR,
const T  stdDeviation,
PGPlotter plotter,
const Bool  fixedYLimits,
const T  yMinAuto,
const T  yMaxAuto,
const String  xLabel,
const String  yLabel,
const String  title 
) const [private]

Automatically determine the spectral window via Bosma's algorithm.

template<class T >
Bool casa::MomentWindow< T >::getInterDirectWindow ( Bool allSubsequent,
LogIO os,
Vector< Int > &  window,
const Vector< T > &  x,
const Vector< T > &  y,
const Vector< Bool > &  mask,
const Bool  fixedYLimits,
const T  yMinAuto,
const T  yMaxAuto,
const String  xLabel,
const String  yLabel,
const String  title,
PGPlotter plotter 
) const [private]

Interactively specify the spectral window with the cursor.

template<class T >
Bool casa::MomentWindow< T >::getInterWindow ( uInt nFailed,
Bool allSubsequent,
LogIO os,
Vector< Int > &  window,
const Bool  doFit,
const Vector< T > &  x,
const Vector< T > &  y,
const Vector< Bool > &  mask,
const Bool  fixedYLimits,
const T  yMinAuto,
const T  yMaxAuto,
const String  xLabel,
const String  yLabel,
const String  title,
PGPlotter plotter 
) const [private]

Interactively define the spectral window Returns false if can't define window.

template<class T >
virtual void casa::MomentWindow< 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 >.

template<class T >
virtual void casa::MomentWindow< 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 >.

template<class T >
Bool casa::MomentWindow< T >::setNSigmaWindow ( Vector< Int > &  window,
const T  pos,
const T  width,
const Int  nPts,
const Int  N 
) const [private]

Take the fitted Gaussian parameters and set an N-sigma window.

If the window is too small return a Fail condition.


Member Data Documentation

template<class T >
Vector<T> casa::MomentWindow< T >::ancilliarySliceRef_p [private]

Definition at line 823 of file MomentCalculator.h.

template<class T >
Bool casa::MomentWindow< T >::doAuto_p [private]

Definition at line 826 of file MomentCalculator.h.

template<class T >
Bool casa::MomentWindow< T >::doFit_p [private]

Definition at line 826 of file MomentCalculator.h.

template<class T >
MomentsBase<T>& casa::MomentWindow< T >::iMom_p [private]

Definition at line 819 of file MomentCalculator.h.

template<class T >
LogIO casa::MomentWindow< T >::os_p [private]

Definition at line 820 of file MomentCalculator.h.

template<class T >
Lattice<T>* casa::MomentWindow< T >::pAncilliaryLattice_p [private]

Definition at line 818 of file MomentCalculator.h.

template<class T >
T casa::MomentWindow< T >::peakSNR_p [private]

Definition at line 825 of file MomentCalculator.h.

template<class T >
const Vector<T>* casa::MomentWindow< T >::pProfileSelect_p [private]

Definition at line 822 of file MomentCalculator.h.

template<class T >
Vector<T> casa::MomentWindow< T >::selectedData_p [private]

Definition at line 824 of file MomentCalculator.h.

template<class T >
IPosition casa::MomentWindow< T >::sliceShape_p [private]

Definition at line 827 of file MomentCalculator.h.

template<class T >
T casa::MomentWindow< T >::stdDeviation_p [private]

Definition at line 825 of file MomentCalculator.h.


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