casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
casa::MomentClip< T > Class Template Reference

Computes simple clipped, and masked moments. More...

#include <MomentClip.h>

Inheritance diagram for casa::MomentClip< T >:
casa::MomentCalcBase< T > casacore::LineCollapser< T, T >

Public Member Functions

 MomentClip (shared_ptr< casacore::Lattice< T >> pAncilliaryLattice, MomentsBase< T > &iMom, casacore::LogIO &os, const casacore::uInt nLatticeOut)
 Constructor. More...
 
virtual ~MomentClip ()
 Destructor (does nothing). More...
 
virtual void process (T &out, casacore::Bool &outMask, const casacore::Vector< T > &in, const casacore::Vector< casacore::Bool > &inMask, const casacore::IPosition &pos)
 This function is not implemented and throws an exception. More...
 
virtual void multiProcess (casacore::Vector< T > &out, casacore::Vector< casacore::Bool > &outMask, const casacore::Vector< T > &in, const casacore::Vector< casacore::Bool > &inMask, const casacore::IPosition &pos)
 This function returns a vector of numbers from each input vector. More...
 
virtual casacore::Bool canHandleNullMask () const
 Can handle null mask. More...
 
- Public Member Functions inherited from casa::MomentCalcBase< T >
virtual ~MomentCalcBase ()
 
virtual casacore::uInt nFailedFits () const
 Returns the number of failed fits if doing fitting. More...
 
- Public Member Functions inherited from casacore::LineCollapser< T, T >
virtual ~LineCollapser ()
 Destructor. More...
 

Private Attributes

shared_ptr< casacore::Lattice
< T > > 
_ancilliaryLattice
 
MomentsBase< T > & iMom_p
 
casacore::LogIO os_p
 
const casacore::Vector< T > * pProfileSelect_p
 
casacore::Vector< T > ancilliarySliceRef_p
 
casacore::Vector< T > selectedData_p
 
casacore::Vector< casacore::IntselectedDataIndex_p
 
casacore::Bool doInclude_p
 
casacore::Bool doExclude_p
 
casacore::Vector< T > range_p
 
casacore::IPosition sliceShape_p
 

Additional Inherited Members

- Public Types inherited from casa::MomentCalcBase< T >
using AccumType = typename casacore::NumericTraits< T >::PrecisionType
 
using DataIterator = typename casacore::Vector< T >::const_iterator
 
using MaskIterator = casacore::Vector< casacore::Bool >::const_iterator
 
- Protected Member Functions inherited from casa::MomentCalcBase< T >
void accumSums (typename casacore::NumericTraits< T >::PrecisionType &s0, typename casacore::NumericTraits< T >::PrecisionType &s0Sq, typename casacore::NumericTraits< T >::PrecisionType &s1, typename casacore::NumericTraits< T >::PrecisionType &s2, casacore::Int &iMin, casacore::Int &iMax, T &dMin, T &dMax, casacore::Int i, T datum, casacore::Double coord) const
 Accumulate statistical sums from a vector. More...
 
casacore::uInt allNoise (T &dMean, const casacore::Vector< T > &data, const casacore::Vector< casacore::Bool > &mask, T peakSNR, T stdDeviation) const
 Determine if the spectrum is pure noise. More...
 
void constructorCheck (casacore::Vector< T > &calcMoments, casacore::Vector< casacore::Bool > &calcMomentsMask, const casacore::Vector< casacore::Int > &selectMoments, casacore::uInt nLatticeOut) const
 Check validity of constructor inputs. More...
 
void costlyMoments (MomentsBase< T > &iMom, casacore::Bool &doMedianI, casacore::Bool &doMedianV, casacore::Bool &doAbsDev) const
 Find out from the selectMoments array whether we want to compute the more expensive moments. More...
 
void doCoordCalc (casacore::Bool &doCoordProfile, casacore::Bool &doCoordRandom, const MomentsBase< T > &iMom) const
 Return the casacore::Bool saying whether we need to compute coordinates or not for the requested moments. More...
 
casacore::Bool doFit (const MomentsBase< T > &iMom) const
 Return the casacore::Bool from the ImageMoments or MSMoments object saying whether we are going to fit Gaussians to the profiles or not. More...
 
casacore::Bool findNextDatum (casacore::uInt &iFound, const casacore::uInt &n, const casacore::Vector< casacore::Bool > &mask, const casacore::uInt &iStart, const casacore::Bool &findGood) const
 Find the next masked or unmasked point in a vector. More...
 
casacore::Bool fitGaussian (casacore::uInt &nFailed, T &peak, T &pos, T &width, T &level, const casacore::Vector< T > &x, const casacore::Vector< T > &y, const casacore::Vector< casacore::Bool > &mask, T peakGuess, T posGuess, T widthGuess, T levelGuess) const
 Fit a Gaussian to x and y arrays given guesses for the gaussian parameters. More...
 
casacore::Bool getAutoGaussianFit (casacore::uInt &nFailed, casacore::Vector< T > &gaussPars, const casacore::Vector< T > &x, const casacore::Vector< T > &y, const casacore::Vector< casacore::Bool > &mask, T peakSNR, T stdDeviation) const
 Automatically fit a Gaussian to a spectrum, including finding the starting guesses. More...
 
casacore::Bool getAutoGaussianGuess (T &peakGuess, T &posGuess, T &widthGuess, T &levelGuess, const casacore::Vector< T > &x, const casacore::Vector< T > &y, const casacore::Vector< casacore::Bool > &mask) const
 Automatically work out a guess for the Gaussian parameters Returns false if all pixels masked. More...
 
casacore::Double getMomentCoord (const MomentsBase< T > &iMom, casacore::Vector< casacore::Double > &pixelIn, casacore::Vector< casacore::Double > &worldOut, casacore::Double momentPixel, casacore::Bool asVelocity=false) const
 Compute the world coordinate for the given moment axis pixel. More...
 
void lineSegments (casacore::uInt &nSeg, casacore::Vector< casacore::uInt > &start, casacore::Vector< casacore::uInt > &nPts, const casacore::Vector< casacore::Bool > &mask) const
 Examine a mask and determine how many segments of unmasked points it consists of. More...
 
casacore::IntmomentAxis (MomentsBase< T > &iMom) const
 Return the moment axis from the ImageMoments object. More...
 
casacore::String momentAxisName (const casacore::CoordinateSystem &, const MomentsBase< T > &iMom) const
 Return the name of the moment/profile axis. More...
 
T & peakSNR (MomentsBase< T > &iMom) const
 Return the peak SNR for determination of all noise spectra from the ImageMoments or MSMoments object. More...
 
void selectRange (casacore::Vector< T > &pixelRange, casacore::Bool &doInclude, casacore::Bool &doExlude, MomentsBase< T > &iMom) const
 Return the selected pixel intensity range from the ImageMoments or MSMoments object and the Bools describing whether it is inclusion or exclusion. More...
 
casacore::Vector< casacore::IntselectMoments (MomentsBase< T > &iMom) const
 The MomentCalculators compute a vector of all possible moments. More...
 
void setCalcMoments (const MomentsBase< T > &iMom, casacore::Vector< T > &calcMoments, casacore::Vector< casacore::Bool > &calcMomentsMask, casacore::Vector< casacore::Double > &pixelIn, casacore::Vector< casacore::Double > &worldOut, casacore::Bool doCoord, casacore::Double integratedScaleFactor, T dMedian, T vMedian, casacore::Int nPts, typename casacore::NumericTraits< T >::PrecisionType s0, typename casacore::NumericTraits< T >::PrecisionType s1, typename casacore::NumericTraits< T >::PrecisionType s2, typename casacore::NumericTraits< T >::PrecisionType s0Sq, typename casacore::NumericTraits< T >::PrecisionType sumAbsDev, T dMin, T dMax, casacore::Int iMin, casacore::Int iMax) const
 Fill the ouput moments array. More...
 
void setPosLabel (casacore::String &title, const casacore::IPosition &pos) const
 Fill a string with the position of the cursor. More...
 
void setCoordinateSystem (casacore::CoordinateSystem &cSys, MomentsBase< T > &iMom)
 Install casacore::CoordinateSystem and SpectralCoordinate in protected data members. More...
 
void setUpCoords (const MomentsBase< T > &iMom, casacore::Vector< casacore::Double > &pixelIn, casacore::Vector< casacore::Double > &worldOut, casacore::Vector< casacore::Double > &sepWorldCoord, casacore::LogIO &os, casacore::Double &integratedScaleFactor, const casacore::CoordinateSystem &cSys, casacore::Bool doCoordProfile, casacore::Bool doCoordRandom) const
 Set up separable moment axis coordinate vector and conversion vectors if not separable. More...
 
T & stdDeviation (MomentsBase< T > &iMom) const
 Return standard deviation of image from ImageMoments or MSMoments object. More...
 
virtual void init (casacore::uInt nOutPixelsPerCollapse)
 Check if #pixels is indeed 1. More...
 
- Protected Attributes inherited from casa::MomentCalcBase< T >
casacore::CoordinateSystem cSys_p
 A number of private data members are kept here in the base class as they are common to the derived classes. More...
 
casacore::Vector< T > calcMoments_p
 This vector is a container for all the possible moments that can be calculated. More...
 
casacore::Vector< casacore::BoolcalcMomentsMask_p
 
casacore::Vector< casacore::IntselectMoments_p
 This vector tells us which elements of the calcMoments_p vector we wish to select. More...
 
casacore::Bool doMedianI_p
 Although the general philosophy of these classes is to compute all the posisble moments and then select the ones we want, some of them are too expensive to calculate unless they are really wanted. More...
 
casacore::Bool doMedianV_p
 
casacore::Bool doAbsDev_p
 
casacore::Vector
< casacore::Double
pixelIn_p
 These vectors are used to transform coordinates between pixel and world. More...
 
casacore::Vector
< casacore::Double
worldOut_p
 
casacore::Bool doCoordProfile_p
 All computations involving casacore::Coordinate conversions are relatively expensive These Bools signifies whether we need coordinate calculations or not for the full profile, and for some occaisional calculations. More...
 
casacore::Bool doCoordRandom_p
 
casacore::Vector
< casacore::Double
sepWorldCoord_p
 This vector houses the world coordinate values for the profile if it was from a separable axis. More...
 
casacore::Vector< T > abcissa_p
 This vector is used to hold the abscissa values. More...
 
casacore::String momAxisType_p
 This string tells us the name of the moment axis (VELO or FREQ etc) More...
 
casacore::uInt nFailed_p
 This is the number of Gaussian fits that failed. More...
 
casacore::Double integratedScaleFactor_p
 This scale factor is the increment along the moment axis applied so that units for the Integrated moment are like Jy/beam.km/s (or whatever is needed for the moment axis units) For non-linear velocities (e.g. More...
 

Detailed Description

template<class T>
class casa::MomentClip< T >

Computes simple clipped, and masked moments.

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 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 casacore::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.

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.

// Construct desired moment calculator object. Use it polymorphically
// via a pointer to the base class. os_P is a casacore::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
casacore::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.

Constructor & Destructor Documentation

template<class T >
casa::MomentClip< T >::MomentClip ( shared_ptr< casacore::Lattice< T >>  pAncilliaryLattice,
MomentsBase< T > &  iMom,
casacore::LogIO os,
const casacore::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.

template<class T >
virtual casa::MomentClip< T >::~MomentClip ( )
virtual

Destructor (does nothing).

Member Function Documentation

template<class T >
virtual casacore::Bool casa::MomentClip< T >::canHandleNullMask ( ) const
inlinevirtual

Can handle null mask.

Reimplemented from casacore::LineCollapser< T, T >.

Definition at line 157 of file MomentClip.h.

template<class T >
virtual void casa::MomentClip< T >::multiProcess ( casacore::Vector< T > &  out,
casacore::Vector< casacore::Bool > &  outMask,
const casacore::Vector< T > &  in,
const casacore::Vector< casacore::Bool > &  inMask,
const casacore::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 casacore::LineCollapser< T, T >.

template<class T >
virtual void casa::MomentClip< T >::process ( T &  out,
casacore::Bool outMask,
const casacore::Vector< T > &  in,
const casacore::Vector< casacore::Bool > &  inMask,
const casacore::IPosition pos 
)
virtual

This function is not implemented and throws an exception.

Implements casacore::LineCollapser< T, T >.

Member Data Documentation

template<class T >
shared_ptr<casacore::Lattice<T> > casa::MomentClip< T >::_ancilliaryLattice
private

Definition at line 157 of file MomentClip.h.

template<class T >
casacore::Vector<T> casa::MomentClip< T >::ancilliarySliceRef_p
private

Definition at line 166 of file MomentClip.h.

template<class T >
casacore::Bool casa::MomentClip< T >::doExclude_p
private

Definition at line 169 of file MomentClip.h.

template<class T >
casacore::Bool casa::MomentClip< T >::doInclude_p
private

Definition at line 169 of file MomentClip.h.

template<class T >
MomentsBase<T>& casa::MomentClip< T >::iMom_p
private

Definition at line 162 of file MomentClip.h.

template<class T >
casacore::LogIO casa::MomentClip< T >::os_p
private

Definition at line 163 of file MomentClip.h.

template<class T >
const casacore::Vector<T>* casa::MomentClip< T >::pProfileSelect_p
private

Definition at line 165 of file MomentClip.h.

template<class T >
casacore::Vector<T> casa::MomentClip< T >::range_p
private

Definition at line 170 of file MomentClip.h.

template<class T >
casacore::Vector<T> casa::MomentClip< T >::selectedData_p
private

Definition at line 167 of file MomentClip.h.

template<class T >
casacore::Vector<casacore::Int> casa::MomentClip< T >::selectedDataIndex_p
private

Definition at line 168 of file MomentClip.h.

template<class T >
casacore::IPosition casa::MomentClip< T >::sliceShape_p
private

Definition at line 171 of file MomentClip.h.


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