28 #ifndef IMAGEANALYSIS_MOMENTCALCBASE_H
29 #define IMAGEANALYSIS_MOMENTCALCBASE_H
226 s0Sq += dDatum*dDatum;
228 s2 += dDatum*coord*coord;
286 T peakGuess, T posGuess, T widthGuess,
302 T& peakGuess, T& posGuess,
303 T& widthGuess, T& levelGuess,
418 #ifndef CASACORE_NO_AUTO_TEMPLATES
419 #include <imageanalysis/ImageAnalysis/MomentCalcBase.tcc>
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.
A Vector of integers, for indexing into Array<T> objects.
casacore::Vector< casacore::Double > sepWorldCoord_p
This vector houses the world coordinate values for the profile if it was from a separable axis...
A 1-D Specialization of the Array class.
Bool frequencyToVelocity(Quantum< Double > &velocity, Double frequency) const
This class is a base class for generating moments from an image or a spectral data.
T & stdDeviation(MomentsBase< T > &iMom) const
Return standard deviation of image from ImageMoments or MSMoments object.
casacore::Bool doMedianI_p
Although the general philosophy of these classes is to compute all the posisble moments and then sele...
casacore::Bool doAbsDev_p
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
casacore::Int worldMomentAxis_p
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...
typename casacore::Vector< T >::const_iterator DataIterator
casacore::uInt nFailed_p
This is the number of Gaussian fits that failed.
casacore::Bool doFit(const MomentsBase< T > &iMom) const
Return the casacore::Bool from the ImageMoments or MSMoments object saying whether we are going to fi...
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 mome...
Abstract base class for moment calculator classes.
void setCoordinateSystem(casacore::CoordinateSystem &cSys, MomentsBase< T > &iMom)
Install casacore::CoordinateSystem and SpectralCoordinate in protected data members.
ostream-like interface to creating log messages.
casacore::Vector< casacore::Int > selectMoments(MomentsBase< T > &iMom) const
The MomentCalculators compute a vector of all possible moments.
virtual ~MomentCalcBase()
virtual void init(casacore::uInt nOutPixelsPerCollapse)
Check if #pixels is indeed 1.
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.
T & peakSNR(MomentsBase< T > &iMom) const
Return the peak SNR for determination of all noise spectra from the ImageMoments or MSMoments object...
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.
casacore::Vector< casacore::Double > pixelIn_p
These vectors are used to transform coordinates between pixel and world.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
casacore::Vector< casacore::Double > worldOut_p
casacore::Vector< T > calcMoments_p
This vector is a container for all the possible moments that can be calculated.
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 des...
typename casacore::NumericTraits< T >::PrecisionType AccumType
Char PrecisionType
Higher precision type (Float->Double)
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.
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.
casacore::Int & momentAxis(MomentsBase< T > &iMom) const
Return the moment axis from the ImageMoments object.
casacore::Int momentAxis_p
casacore::Bool doCoordRandom_p
Abstract base class for LatticeApply function signatures.
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.
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. ...
casacore::Bool doCoordProfile_p
All computations involving casacore::Coordinate conversions are relatively expensive These Bools sign...
bool Bool
Define the standard types used by Casacore.
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.
casacore::String momAxisType_p
This string tells us the name of the moment axis (VELO or FREQ etc)
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.
virtual casacore::uInt nFailedFits() const
Returns the number of failed fits if doing fitting.
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...
casacore::Vector< casacore::Bool > calcMomentsMask_p
casacore::CoordinateSystem cSys_p
A number of private data members are kept here in the base class as they are common to the derived cl...
virtual Bool toWorld(Vector< Double > &world, const Vector< Double > &pixel, Bool useConversionFrame=True) const
Convert a pixel position to a world position or vice versa.
casacore::Vector< casacore::Int > selectMoments_p
This vector tells us which elements of the calcMoments_p vector we wish to select.
const SpectralCoordinate & spectralCoordinate(uInt which) const
String: the storage and methods of handling collections of characters.
void setPosLabel(casacore::String &title, const casacore::IPosition &pos) const
Fill a string with the position of the cursor.
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.
casacore::String momentAxisName(const casacore::CoordinateSystem &, const MomentsBase< T > &iMom) const
Return the name of the moment/profile axis.
Interconvert pixel and world coordinates.
casacore::Bool doMedianV_p
casacore::Vector< T > abcissa_p
This vector is used to hold the abscissa values.
casacore::Double integratedScaleFactor_p
This scale factor is the increment along the moment axis applied so that units for the Integrated mom...