Displays various statistics from an image. More...
#include <ImageStatistics.h>
Public Member Functions | |
ImageStatistics (const ImageInterface< T > &image, LogIO &os, Bool showProgress=True, Bool forceDisk=False) | |
Constructor takes the image and a LogIO object for logging. | |
ImageStatistics (const ImageInterface< T > &image, Bool showProgress=True, Bool forceDisk=False) | |
Constructor takes the image only. | |
ImageStatistics (const ImageStatistics< T > &other) | |
Copy constructor. | |
virtual | ~ImageStatistics () |
Destructor. | |
ImageStatistics< T > & | operator= (const ImageStatistics< T > &other) |
Assignment operator. | |
Bool | setNewImage (const ImageInterface< T > &image) |
Set a new ImageInterface object. | |
void | setPrecision (Int precision) |
void | setBlc (const IPosition &blc) |
IPosition | getBlc () const |
Int | getPrecision () const |
void | showRobust (const Bool show) |
list robust statistics? Should be called before display() | |
void | recordMessages (const Bool rm) |
vector< String > | getMessages () |
void | clearMessages () |
void | setListStats (Bool b) |
Protected Types | |
typedef NumericTraits< T > ::PrecisionType | AccumType |
Protected Member Functions | |
virtual Bool | _canDoFlux () const |
Virtual Functions. | |
Private Member Functions | |
virtual void | getLabels (String &higherOrder, String &xAxis, const IPosition &dPos) const |
Virtual functions. | |
virtual Bool | _getBeamArea (Array< Double > &beamArea, String &msg) const |
Get beam area in pixels if possible. | |
virtual void | listMinMax (ostringstream &osMin, ostringstream &osMax, Int oWidth, DataType type) |
List min and max with world coordinates. | |
virtual Bool | listStats (Bool hasBeam, const IPosition &dPos, const Matrix< AccumType > &ord) |
List the statistics. | |
virtual void | displayStats (AccumType nPts, AccumType sum, AccumType median, AccumType medAbsDevMed, AccumType quartile, AccumType sumSq, AccumType mean, AccumType var, AccumType rms, AccumType sigma, AccumType dMin, AccumType dMax, AccumType q1, AccumType q3) |
Quantum< AccumType > | _flux (Bool &isFluxDensity, AccumType sum, Double beamAreaInPixels) const |
If isFluxDensity is False, then the computed value is a flux (ie flux density integrated over a spectral extent). | |
Bool | _computeFlux (Array< AccumType > &flux, const Array< AccumType > &npts, const Array< AccumType > &sum) |
Bool | _computeFlux (Quantum< AccumType > &flux, AccumType sum, const IPosition &pos, Bool posInLattice) |
Private Attributes | |
LogIO | os_p |
Data. | |
const ImageInterface< T > * | pInImage_p |
IPosition | blc_ |
Int | precision_ |
Bool | _showRobust |
Bool | _recordMessages |
Bool | _listStats |
vector< String > | _messages |
Displays various statistics from an image.
Public interface
This is a class designed to display and retrieve statistics from images
This class enable you to display and/or retrieve statistics evaluated over specified regions from an image. The dimension of the region is arbitrary, but the size of each dimension is always the size of the corresponding image axis. The statistics are displayed as a function of location of the axes not used to evaluate the statistics over. The axes which you evaluate the statistics over are called the cursor axes, the others are called the display axes.
This class is derived from the class LatticeStatistics which does all the work. This class only adds some extra capability in terms of logging world (rather than pixel) coordinates and computing the synthesized beam area, if there is one. There are just a few virtual functions for you to over-ride. These are rather specialized, they are not part of a general polymorphic interface, just a way to separate the Lattice and Image functionality out.
See LatticeStatistics for details and examples.
The generation of statistical information from an image is a basic and necessary capability.
Definition at line 99 of file ImageStatistics.h.
typedef NumericTraits<T>::PrecisionType casacore::ImageStatistics< T >::AccumType [protected] |
Reimplemented from casacore::LatticeStatistics< T >.
Definition at line 157 of file ImageStatistics.h.
casacore::ImageStatistics< T >::ImageStatistics | ( | const ImageInterface< T > & | image, | |
LogIO & | os, | |||
Bool | showProgress = True , |
|||
Bool | forceDisk = False | |||
) |
Constructor takes the image and a LogIO
object for logging.
You can specify whether you want to see progress meters or not. You can force the storage image to be disk based, otherwise the decision for core or disk is taken for you.
casacore::ImageStatistics< T >::ImageStatistics | ( | const ImageInterface< T > & | image, | |
Bool | showProgress = True , |
|||
Bool | forceDisk = False | |||
) |
Constructor takes the image only.
In the absence of a logger you get no messages. This includes error messages and potential listing of the statistics. You can specify whether you want to see progress meters or not. You can force the storage image to be disk based, otherwise the decision for core or disk is taken for you.
casacore::ImageStatistics< T >::ImageStatistics | ( | const ImageStatistics< T > & | other | ) |
Copy constructor.
Copy semantics are followed. Therefore any storage image that has already been created for other
is copied to *this
virtual casacore::ImageStatistics< T >::~ImageStatistics | ( | ) | [virtual] |
Destructor.
virtual Bool casacore::ImageStatistics< T >::_canDoFlux | ( | ) | const [protected, virtual] |
Virtual Functions.
See implementation to figure it all out !
FIXME The indirect dependence of this class on ImageInterface related issues (eg flux density) breaks encapsulation. All the ImageInterface related code should be encapsulated in ImageStatistics. Unfortunately, that requires significantly more time than I have atm. A return value of False means that the object in question cannot compute flux density values. The default implementation returns False.
Reimplemented from casacore::LatticeStatistics< T >.
Bool casacore::ImageStatistics< T >::_computeFlux | ( | Quantum< AccumType > & | flux, | |
AccumType | sum, | |||
const IPosition & | pos, | |||
Bool | posInLattice | |||
) | [private, virtual] |
Reimplemented from casacore::LatticeStatistics< T >.
Bool casacore::ImageStatistics< T >::_computeFlux | ( | Array< AccumType > & | flux, | |
const Array< AccumType > & | npts, | |||
const Array< AccumType > & | sum | |||
) | [private, virtual] |
Reimplemented from casacore::LatticeStatistics< T >.
Quantum<AccumType> casacore::ImageStatistics< T >::_flux | ( | Bool & | isFluxDensity, | |
AccumType | sum, | |||
Double | beamAreaInPixels | |||
) | const [private, virtual] |
If isFluxDensity
is False, then the computed value is a flux (ie flux density integrated over a spectral extent).
Reimplemented from casacore::LatticeStatistics< T >.
virtual Bool casacore::ImageStatistics< T >::_getBeamArea | ( | Array< Double > & | beamArea, | |
String & | msg | |||
) | const [private, virtual] |
Get beam area in pixels if possible.
Return False if the beam area could not be calculated.
void casacore::ImageStatistics< T >::clearMessages | ( | ) | [inline] |
Definition at line 152 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_messages.
virtual void casacore::ImageStatistics< T >::displayStats | ( | AccumType | nPts, | |
AccumType | sum, | |||
AccumType | median, | |||
AccumType | medAbsDevMed, | |||
AccumType | quartile, | |||
AccumType | sumSq, | |||
AccumType | mean, | |||
AccumType | var, | |||
AccumType | rms, | |||
AccumType | sigma, | |||
AccumType | dMin, | |||
AccumType | dMax, | |||
AccumType | q1, | |||
AccumType | q3 | |||
) | [private, virtual] |
Reimplemented from casacore::LatticeStatistics< T >.
IPosition casacore::ImageStatistics< T >::getBlc | ( | ) | const |
virtual void casacore::ImageStatistics< T >::getLabels | ( | String & | higherOrder, | |
String & | xAxis, | |||
const IPosition & | dPos | |||
) | const [private, virtual] |
Virtual functions.
See LatticeStatistics for more information about these, or see the implementation.
Get label for higher order axes
Reimplemented from casacore::LatticeStatistics< T >.
vector<String> casacore::ImageStatistics< T >::getMessages | ( | ) | [inline] |
Definition at line 150 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_messages.
Int casacore::ImageStatistics< T >::getPrecision | ( | ) | const |
virtual void casacore::ImageStatistics< T >::listMinMax | ( | ostringstream & | osMin, | |
ostringstream & | osMax, | |||
Int | oWidth, | |||
DataType | type | |||
) | [private, virtual] |
List min and max with world coordinates.
Reimplemented from casacore::LatticeStatistics< T >.
virtual Bool casacore::ImageStatistics< T >::listStats | ( | Bool | hasBeam, | |
const IPosition & | dPos, | |||
const Matrix< AccumType > & | ord | |||
) | [private, virtual] |
List the statistics.
Reimplemented from casacore::LatticeStatistics< T >.
ImageStatistics<T>& casacore::ImageStatistics< T >::operator= | ( | const ImageStatistics< T > & | other | ) |
Assignment operator.
Deletes any storage image associated with the object being assigned to and copies any storage image that has already been created for "other".
Reimplemented from casacore::LatticeStatistics< T >.
void casacore::ImageStatistics< T >::recordMessages | ( | const Bool | rm | ) | [inline] |
Definition at line 148 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_recordMessages.
void casacore::ImageStatistics< T >::setBlc | ( | const IPosition & | blc | ) |
void casacore::ImageStatistics< T >::setListStats | ( | Bool | b | ) | [inline] |
Definition at line 154 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_listStats.
Bool casacore::ImageStatistics< T >::setNewImage | ( | const ImageInterface< T > & | image | ) |
Set a new ImageInterface object.
A return value of False
indicates the image had an invalid type or that the internal state of the class is bad.
void casacore::ImageStatistics< T >::setPrecision | ( | Int | precision | ) |
void casacore::ImageStatistics< T >::showRobust | ( | const Bool | show | ) |
list robust statistics? Should be called before display()
Bool casacore::ImageStatistics< T >::_listStats [private] |
Definition at line 170 of file ImageStatistics.h.
Referenced by casacore::ImageStatistics< T >::setListStats().
vector<String> casacore::ImageStatistics< T >::_messages [mutable, private] |
Definition at line 171 of file ImageStatistics.h.
Referenced by casacore::ImageStatistics< T >::clearMessages(), and casacore::ImageStatistics< T >::getMessages().
Bool casacore::ImageStatistics< T >::_recordMessages [private] |
Definition at line 170 of file ImageStatistics.h.
Referenced by casacore::ImageStatistics< T >::recordMessages().
Bool casacore::ImageStatistics< T >::_showRobust [private] |
Definition at line 170 of file ImageStatistics.h.
IPosition casacore::ImageStatistics< T >::blc_ [private] |
Definition at line 168 of file ImageStatistics.h.
LogIO casacore::ImageStatistics< T >::os_p [private] |
Data.
Reimplemented from casacore::LatticeStatistics< T >.
Definition at line 166 of file ImageStatistics.h.
const ImageInterface<T>* casacore::ImageStatistics< T >::pInImage_p [private] |
Definition at line 167 of file ImageStatistics.h.
Int casacore::ImageStatistics< T >::precision_ [private] |
Definition at line 169 of file ImageStatistics.h.