casa
5.7.0-16
|
This class is a base class for generating moments from an image or a spectral data. More...
#include <MomentCalcBase.h>
Public Types | |
enum | MethodTypes { WINDOW, FIT, NMETHODS } |
The enum MethodTypes is provided for use with the setWinFitMethod function. More... | |
enum | MomentTypes { AVERAGE, INTEGRATED, WEIGHTED_MEAN_COORDINATE, WEIGHTED_DISPERSION_COORDINATE, MEDIAN, MEDIAN_COORDINATE, STANDARD_DEVIATION, RMS, ABS_MEAN_DEVIATION, MAXIMUM, MAXIMUM_COORDINATE, MINIMUM, MINIMUM_COORDINATE, NMOMENTS, DEFAULT } |
This enum MomentTypes is provided for use with the setMoments function. More... | |
Public Member Functions | |
virtual | ~MomentsBase () |
Destructor. More... | |
casacore::Bool | setMoments (const casacore::Vector< casacore::Int > &moments) |
Set the desired moments via an casacore::Int array. More... | |
virtual casacore::Bool | setMomentAxis (casacore::Int)=0 |
Set the moment axis (0 relative). More... | |
casacore::Bool | setWinFitMethod (const casacore::Vector< casacore::Int > &method) |
The method by which you compute the moments is specified by calling (or not calling) the setWinFitMethod and setSmoothMethod functions. More... | |
virtual casacore::Bool | setSmoothMethod (const casacore::Vector< casacore::Int > &, const casacore::Vector< casacore::Int > &, const casacore::Vector< casacore::Quantum< casacore::Double > > &)=0 |
This function invokes smoothing of the input image. More... | |
casacore::Bool | setSmoothMethod (const casacore::Vector< casacore::Int > &smoothAxes, const casacore::Vector< casacore::Int > &kernelTypes, const casacore::Vector< casacore::Double > &kernelWidths) |
void | setInExCludeRange (const casacore::Vector< T > &include, const casacore::Vector< T > &exclude) |
You may specify a pixel intensity range as either one for which all pixels in that range are included in the moment calculation, or one for which all pixels in that range are excluded from the moment calculations. More... | |
void | setSnr (const T &peakSNR, const T &stdDeviation) |
This function is used to help assess whether a spectrum along the moment axis is all noise or not. More... | |
casacore::Bool | setSmoothOutName (const casacore::String &smOut) |
This is the output file name for the smoothed image. More... | |
void | setVelocityType (casacore::MDoppler::Types type) |
Set Velocity type. More... | |
void | resetError () |
Reset argument error condition. More... | |
casacore::String | errorMessage () const |
Recover last error message. More... | |
virtual const casacore::CoordinateSystem & | coordinates ()=0 |
Get CoordinateSystem. More... | |
virtual casacore::IPosition | getShape () const =0 |
casacore::Bool | shouldConvertToVelocity () const |
Static Public Member Functions | |
static casacore::Vector < casacore::Int > | toMethodTypes (const casacore::String &methods) |
Helper function to convert a string containing a list of desired methods to the correct casacore::Vector<casacore::Int> required for the setWinFitMethod function. More... | |
Protected Member Functions | |
MomentsBase (casacore::LogIO &os, casacore::Bool overWriteOutput=false, casacore::Bool showProgress=true) | |
Constructor takes an image and a casacore::LogIO object for logging purposes. More... | |
void | _checkMethod () |
Check that the combination of methods that the user has requested is valid casacore::List a handy dandy table if not. More... | |
void | _setIncludeExclude (casacore::Vector< T > &range, casacore::Bool &noInclude, casacore::Bool &noExclude, const casacore::Vector< T > &include, const casacore::Vector< T > &exclude) |
Take the user's data inclusion and exclusion data ranges and generate the range and Booleans to say what sort it is. More... | |
casacore::Bool | _setOutThings (casacore::String &suffix, casacore::Unit &momentUnits, const casacore::Unit &imageUnits, const casacore::String &momentAxisUnits, const casacore::Int moment, casacore::Bool convertToVelocity) |
Set the output image suffixes and units. More... | |
casacore::CoordinateSystem | _makeOutputCoordinates (casacore::IPosition &outShape, const casacore::CoordinateSystem &cSysIn, const casacore::IPosition &inShape, casacore::Int momentAxis, casacore::Bool removeAxis) |
Make output Coordinates. More... | |
Friends | |
class | MomentCalcBase< T > |
Note that if I don't put MomentCalcBase as a forward declaration and use instead "friend class MomentCalcBase<T>" The gnu compiler fails with a typedef problem. More... | |
This class is a base class for generating moments from an image or a spectral data.
Public interface
This class is an abstract class to compute moments from images or spectral data.
The primary goal of MSMoments, ImageMoments, and MSMoments are to help spectral-line astronomers analyze their multi-dimensional images or spectral data (in the form of casacore::MeasurementSet) by generating moments of a specified axis. ImageMoments is a specialized class to generate moments from images, while MSMoments is designed properly for casacore::MeasurementSet input. MSMoments class is an abstract class that is inherited by the above two concrete classes. MomentsBase provides interface layer to the MomentCalculators so that functionalities in MomentCalculators can be shared with ImageMoments and MSMoments. The word "moment" is used loosely here. It refers to collapsing an axis to one pixel and putting the value of that pixel (for all of the other non-collapsed axes) to something computed from the data values along the moment axis. For example, take an RA-DEC-Velocity cube, collapse the velocity axis by computing the mean intensity at each RA-DEC pixel. This class and its inheritances offer many different moments and a variety of interactive and automatic ways to compute them.
MSMoments is defined so that moments can be generated from both images and spectral data (in the form of casacore::MeasurementSet).
Definition at line 34 of file MomentCalcBase.h.
enum casa::MomentsBase::MethodTypes |
The enum MethodTypes
is provided for use with the setWinFitMethod
function.
It gives the allowed moment methods which are available with this function. The use of these methods is described further with the description of this function as well as in the general documentation earlier.
Enumerator | |
---|---|
WINDOW |
Invokes the spectral windowing method. |
FIT |
Invokes Gaussian fitting. |
NMETHODS |
Definition at line 111 of file MomentsBase.h.
enum casa::MomentsBase::MomentTypes |
This enum MomentTypes
is provided for use with the setMoments
function.
It gives the allowed moment types that you can ask for.
Definition at line 123 of file MomentsBase.h.
|
virtual |
Destructor.
|
protected |
Constructor takes an image and a casacore::LogIO
object for logging purposes.
You specify whether output images are automatically overwritten if pre-existing, or whether an intercative choice dialog widget appears (overWriteOutput=F) You may also determine whether a progress meter is displayed or not.
|
protected |
Check that the combination of methods that the user has requested is valid casacore::List a handy dandy table if not.
|
protected |
Make output Coordinates.
|
protected |
Take the user's data inclusion and exclusion data ranges and generate the range and Booleans to say what sort it is.
|
protected |
Set the output image suffixes and units.
|
pure virtual |
Get CoordinateSystem.
Implemented in casa::ImageMoments< T >, and casa::ImageMoments< float >.
|
inline |
Recover last error message.
Definition at line 273 of file MomentsBase.h.
|
pure virtual |
Implemented in casa::ImageMoments< T >, and casa::ImageMoments< float >.
|
inline |
Reset argument error condition.
If you specify invalid arguments to one of the above functions, an internal flag will be set which will prevent the createMoments
function, which is defined in its inheritances, from doing anything (should you have chosen to igmore the Boolean return values of the functions). This function allows you to reset that internal state to good.
Definition at line 270 of file MomentsBase.h.
void casa::MomentsBase< T >::setInExCludeRange | ( | const casacore::Vector< T > & | include, |
const casacore::Vector< T > & | exclude | ||
) |
You may specify a pixel intensity range as either one for which all pixels in that range are included in the moment calculation, or one for which all pixels in that range are excluded from the moment calculations.
One or the other of include
and exclude
must therefore be a zero length vector if you call this function. A return value of false
indicates that you have given both an include
and an exclude
range. If you don't call this function, the default state of the class is to include all pixels.
|
pure virtual |
Set the moment axis (0 relative).
A return value of false
indicates that the axis was not contained in the image. If you don't call this function, the default state of the class is to set the moment axis to the spectral axis if it can find one. Otherwise an error will result.
Implemented in casa::ImageMoments< T >, and casa::ImageMoments< float >.
casacore::Bool casa::MomentsBase< T >::setMoments | ( | const casacore::Vector< casacore::Int > & | moments | ) |
Set the desired moments via an casacore::Int
array.
Each casacore::Int
specifies a different moment; the allowed values and their meanings are given by the enum MomentTypes
. A return value of false
indicates you asked for an out of range moment. If you don't call this function, the default state of the class is to request the integrated intensity.
|
pure virtual |
This function invokes smoothing of the input image.
Give casacore::Int
arrays for the axes (0 relative) to be smoothed and the smoothing kernel types (use the enum KernelTypes
) for each axis. Give a casacore::Double
array for the widths (full width for BOXCAR and full width at half maximum for GAUSSIAN) in pixels of the smoothing kernels for each axis. For HANNING smoothing, you always get the quarter-half-quarter kernel (no matter what you might ask for). A return value of false
indicates that you have given an inconsistent or invalid set of smoothing parameters. If you don't call this function the default state of the class is to do no smoothing. The kernel types are specified with the casacore::VectorKernel::KernelTypes enum
Implemented in casa::ImageMoments< T >, and casa::ImageMoments< float >.
casacore::Bool casa::MomentsBase< T >::setSmoothMethod | ( | const casacore::Vector< casacore::Int > & | smoothAxes, |
const casacore::Vector< casacore::Int > & | kernelTypes, | ||
const casacore::Vector< casacore::Double > & | kernelWidths | ||
) |
casacore::Bool casa::MomentsBase< T >::setSmoothOutName | ( | const casacore::String & | smOut | ) |
This is the output file name for the smoothed image.
It can be useful to have access this to this image when trying to get the pixel include
or exclude
range correct for the smooth-clip method. The default state of the class is to not output the smoothed image.
void casa::MomentsBase< T >::setSnr | ( | const T & | peakSNR, |
const T & | stdDeviation | ||
) |
This function is used to help assess whether a spectrum along the moment axis is all noise or not.
If it is all noise, there is not a lot of point to trying to computing the moment. peakSNR
is the signal-to-noise ratio of the peak value in the spectrum below which the spectrum is considered pure noise. stdDeviation
is the standard deviation of the noise for the input image.
Default values for one or the other parameter are indicated by giving zero.
The default state of the class then is to set peakSNR=3
and/or to work out the noise level from a Gaussian fit to a histogram (above 25%) of the entire image (it is very hard to get an accurate estimate of the noise a single spectrum).
void casa::MomentsBase< T >::setVelocityType | ( | casacore::MDoppler::Types | type | ) |
Set Velocity type.
This is used for moments for which the moment axis is a spectral axis for which the coordinate is traditionally presented in km/s You can select the velocity definition. The default state of the class is to use the radio definition.
casacore::Bool casa::MomentsBase< T >::setWinFitMethod | ( | const casacore::Vector< casacore::Int > & | method | ) |
The method by which you compute the moments is specified by calling (or not calling) the setWinFitMethod
and setSmoothMethod
functions.
The default state of the class is to compute directly on all (or some according to setInExClude
) of the pixels in the spectrum. Calling these functions modifies the computational state to something more complicated.
The setWinMethod
function requires an casacore::Int
array as its argument. Each casacore::Int
specifies a different method that you can invoke (either separately or in combination). The allowed values and their meanings are given by the enum MethodTypes
.
Both the windowing and fitting methods have interactive modes. The windowing method also has a fitting flavour, so if you set both MomentsBase::WINDOW and MomentsBase::FIT, you would be invoking the windowing method but determining the window by fitting Gaussians automatically (as MomentsBase::INTERACTIVE) was not given.
If you don't call this function, then neither the windowing nor fitting methods are invoked. A return value of false
indicates that you asked for an illegal method.
|
inline |
Definition at line 288 of file MomentsBase.h.
|
static |
Helper function to convert a string containing a list of desired methods to the correct casacore::Vector<casacore::Int>
required for the setWinFitMethod
function.
This may be usful if your user interface involves strings rather than integers. A new value is added to the output vector (which is resized appropriately) if any of the substrings "window", "fit" or "interactive" (actually "win", "box" and "inter" will do) is present.
|
friend |
Note that if I don't put MomentCalcBase as a forward declaration and use instead "friend class MomentCalcBase<T>" The gnu compiler fails with a typedef problem.
But I can't solve it with say typedef MomentCalcBase<T> gpp_type;
because you can only do a typedef with an actual type, not a T
!
Definition at line 104 of file MomentsBase.h.
|
protected |
Definition at line 327 of file MomentsBase.h.
Referenced by casa::MomentsBase< float >::shouldConvertToVelocity().
|
protected |
Definition at line 312 of file MomentsBase.h.
|
protected |
Definition at line 313 of file MomentsBase.h.
|
protected |
Definition at line 311 of file MomentsBase.h.
|
protected |
Definition at line 326 of file MomentsBase.h.
Referenced by casa::MomentsBase< float >::errorMessage(), and casa::MomentsBase< float >::resetError().
|
protected |
Definition at line 316 of file MomentsBase.h.
|
protected |
Definition at line 310 of file MomentsBase.h.
Referenced by casa::MomentsBase< float >::resetError().
|
protected |
Definition at line 320 of file MomentsBase.h.
|
protected |
Definition at line 321 of file MomentsBase.h.
|
protected |
Definition at line 318 of file MomentsBase.h.
Referenced by casa::MomentCalcBase< T >::getMomentCoord().
|
protected |
Definition at line 303 of file MomentsBase.h.
|
protected |
Definition at line 322 of file MomentsBase.h.
|
protected |
Definition at line 315 of file MomentsBase.h.
|
protected |
Definition at line 314 of file MomentsBase.h.
|
protected |
Definition at line 301 of file MomentsBase.h.
|
protected |
Definition at line 308 of file MomentsBase.h.
|
protected |
Definition at line 325 of file MomentsBase.h.
|
protected |
Definition at line 304 of file MomentsBase.h.
|
protected |
Definition at line 323 of file MomentsBase.h.
|
protected |
Definition at line 302 of file MomentsBase.h.
|
protected |
Definition at line 324 of file MomentsBase.h.
|
protected |
Definition at line 309 of file MomentsBase.h.
|
protected |
Definition at line 305 of file MomentsBase.h.
|
protected |
Definition at line 328 of file MomentsBase.h.
|
protected |
Definition at line 319 of file MomentsBase.h.
Referenced by casa::MomentCalcBase< T >::getMomentCoord().
|
protected |
Definition at line 307 of file MomentsBase.h.
|
protected |
Definition at line 306 of file MomentsBase.h.