casa::MomentWindow< T > Class Template Reference

Computes moments from a windowed profile. More...

#include <MomentWindow.h>

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

List of all members.

Public Member Functions

 MomentWindow (shared_ptr< 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

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) const
 Automatically determine the spectral window.
Bool _getBosmaWindow (Vector< Int > &window, const Vector< T > &y, const Vector< Bool > &mask, const T peakSNR, const T stdDeviation) const
 Automatically determine the spectral window via Bosma's algorithm.
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

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
stdDeviation_p
peakSNR_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 140 of file MomentWindow.h.


Constructor & Destructor Documentation

template<class T >
casa::MomentWindow< T >::MomentWindow ( shared_ptr< 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 >
Bool casa::MomentWindow< T >::_getBosmaWindow ( Vector< Int > &  window,
const Vector< T > &  y,
const Vector< Bool > &  mask,
const T  peakSNR,
const T  stdDeviation 
) const [private]

Automatically determine the spectral window via Bosma's algorithm.

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 
) const [private]

Automatically determine the spectral 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.

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.

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 >
shared_ptr<Lattice<T> > casa::MomentWindow< T >::_ancilliaryLattice [private]

Definition at line 178 of file MomentWindow.h.

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

Definition at line 183 of file MomentWindow.h.

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

Definition at line 186 of file MomentWindow.h.

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

Definition at line 179 of file MomentWindow.h.

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

Definition at line 180 of file MomentWindow.h.

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

Definition at line 185 of file MomentWindow.h.

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

Definition at line 182 of file MomentWindow.h.

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

Definition at line 184 of file MomentWindow.h.

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

Definition at line 187 of file MomentWindow.h.

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

Definition at line 185 of file MomentWindow.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1