casa
5.7.0-16
|
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, Bool clone=True) | |
Constructor takes the image and a LogIO object for logging. More... | |
ImageStatistics (const ImageInterface< T > &image, Bool showProgress=True, Bool forceDisk=False, Bool clone=True) | |
Constructor takes the image only. More... | |
ImageStatistics (const ImageStatistics< T > &other) | |
Copy constructor. More... | |
virtual | ~ImageStatistics () |
Destructor. More... | |
ImageStatistics< T > & | operator= (const ImageStatistics< T > &other) |
Assignment operator. More... | |
Bool | setNewImage (const ImageInterface< T > &image, Bool clone=True) |
Set a new ImageInterface object. More... | |
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() More... | |
void | recordMessages (const Bool rm) |
vector< String > | getMessages () |
void | clearMessages () |
void | setListStats (Bool b) |
Public Member Functions inherited from casacore::LatticeStatistics< T > | |
LatticeStatistics (const MaskedLattice< T > &lattice, LogIO &os, Bool showProgress=True, Bool forceDisk=False, Bool clone=True) | |
Constructor takes the lattice and a LogIO object for logging. More... | |
LatticeStatistics (const MaskedLattice< T > &lattice, Bool showProgress=True, Bool forceDisk=False, Bool clone=True) | |
Constructor takes the lattice only. More... | |
LatticeStatistics (const LatticeStatistics< T > &other) | |
Copy constructor. More... | |
virtual | ~LatticeStatistics () |
Destructor. More... | |
LatticeStatistics< T > & | operator= (const LatticeStatistics< T > &other) |
Assignment operator. More... | |
Bool | setAxes (const Vector< Int > &cursorAxes) |
Set the cursor axes (0 relative). More... | |
Bool | setInExCludeRange (const Vector< T > &include, const Vector< T > &exclude, Bool setMinMaxToInclude=False) |
You may specify a pixel intensity range as either one for which all pixels in that range are included or one for which all pixels in that range are excluded. More... | |
Bool | setList (const Bool &doList) |
This function allows you to control whether the statistics are written to the output stream if you are also making a plot. More... | |
Bool | display () |
Display the statistics by listing and/or plotting them. More... | |
Bool | getLayerStats (String &stats, Double area, Int zAxis=-1, Int zLayer=-1, Int hAxis=-1, Int hLayer=-1) |
Bool | getLayerStats (stat_list &stats, Double area, Int zAxis=-1, Int zLayer=-1, Int hAxis=-1, Int hLayer=-1) |
Vector< Int > | displayAxes () const |
Return the display axes. More... | |
Bool | getStatistic (Array< AccumType > &stat, LatticeStatsBase::StatisticsTypes type, Bool dropDeg=True) |
Recover the desired Statistic into an array. More... | |
Bool | getConvertedStatistic (Array< T > &stat, LatticeStatsBase::StatisticsTypes type, Bool dropDeg=True) |
Bool | getMinMaxPos (IPosition &minPos, IPosition &maxPos) |
Recover position of min and max. More... | |
Bool | getStats (Vector< AccumType > &, const IPosition &pos, const Bool posInLattice=False) |
This function gets a vector containing all the statistics for a given location. More... | |
void | resetError () |
Reset argument error condition. More... | |
Bool | getFullMinMax (T &dataMin, T &dataMax) |
Get full lattice min and max only. More... | |
String | errorMessage () const |
Recover last error message. More... | |
Bool | setNewLattice (const MaskedLattice< T > &lattice, Bool clone=True) |
Set a new MaskedLattice object. More... | |
Bool | hasLogger () const |
Did we construct with a logger ? More... | |
Bool | configureBiweight (Int maxIter, Double c) |
The configure methods return True if reconfiguration is actually necessary (ie if the underlying storage lattice needs to be recomputed). More... | |
Bool | configureClassical () |
configure object to use Classical Statistics The time, t_x, it takes to compute classical statistics using algorithm x, can be modeled by t_x = n_sets*(a_x + b_x*n_el) where n_sets is the number of independent sets of data to compute stats on, each containing n_el number of elements. More... | |
Bool | configureClassical (Double aOld, Double bOld, Double aNew, Double bNew) |
Bool | configureFitToHalf (FitToHalfStatisticsData::CENTER centerType=FitToHalfStatisticsData::CMEAN, FitToHalfStatisticsData::USE_DATA useData=FitToHalfStatisticsData::LE_CENTER, AccumType centerValue=0) |
configure to use fit to half algorithm. More... | |
Bool | configureHingesFences (Double f) |
configure to use hinges-fences algorithm More... | |
Bool | configureChauvenet (Double zscore=-1, Int maxIterations=-1) |
configure to use Chauvenet's criterion More... | |
void | forceUseStatsFrameworkUsingDataProviders () |
The force* methods are really only for testing. More... | |
void | forceUseStatsFrameworkUsingArrays () |
void | forceUseOldTiledApplyMethod () |
void | forceAllowCodeDecideWhichAlgortihmToUse () |
std::map< String, uInt > | getChauvenetNiter () const |
get number of iterations associated with Chauvenet criterion algorithm More... | |
void | setComputeQuantiles (Bool b) |
should quantile-like stats (median, quartiles, medabsdevmed) be computed? When the stats framework is used, It is better to set this before computing any statistics, to avoid unnecessary duplicate creations of the stats algorithm objects. More... | |
Protected Types | |
typedef NumericTraits< T > ::PrecisionType | AccumType |
Protected Member Functions | |
virtual Bool | _canDoFlux () const |
Virtual Functions. More... | |
Protected Member Functions inherited from casacore::LatticeStatistics< T > | |
virtual Bool | listLayerStats (const Matrix< AccumType > &ord, ostringstream &rslt, Int zLayer) |
IPosition | locInLattice (const IPosition &storagePosition, Bool relativeToParent=True) const |
Given a location in the storage lattice, convert those locations on the non-statistics axis (the last one) and optionally account for the lattice subsectioning. More... | |
void | setStream (ostream &os, Int oPrec) |
Non-virtual functions. More... | |
IPosition | _storageLatticeShape () const |
get the storage lattice shape More... | |
void | _latticePosToStoragePos (IPosition &storagePos, const IPosition &latticePos) |
convert a position in the input lattice to the corresponding position in the stats storage lattice. More... | |
StatisticsData::ALGORITHM | _getAlgorithm () const |
Private Member Functions | |
virtual void | getLabels (String &higherOrder, String &xAxis, const IPosition &dPos) const |
Virtual functions. More... | |
virtual Bool | _getBeamArea (Array< Double > &beamArea, String &msg) const |
Get beam area in pixels if possible. More... | |
virtual void | listMinMax (ostringstream &osMin, ostringstream &osMax, Int oWidth, DataType type) |
List min and max with world coordinates. More... | |
virtual Bool | listStats (Bool hasBeam, const IPosition &dPos, const Matrix< AccumType > &ord) |
List the statistics. More... | |
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) More... | |
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. More... | |
const ImageInterface< T > * | pInImage_p |
std::shared_ptr< const ImageInterface< T > > | _inImPtrMgr |
IPosition | blc_ |
Int | precision_ |
Bool | _showRobust |
Bool | _recordMessages |
Bool | _listStats |
vector< String > | _messages |
Additional Inherited Members | |
Public Types inherited from casacore::LatticeStatistics< T > | |
typedef NumericTraits< T > ::PrecisionType | AccumType |
typedef std::pair< String, String > | stat_element |
typedef std::list< stat_element > | stat_list |
Public Types inherited from casacore::LatticeStatsBase | |
enum | StatisticsTypes { NPTS, SUM, SUMSQ, MEDIAN, MEDABSDEVMED, QUARTILE, Q1, Q3, MIN, MAX, MEAN, VARIANCE, SIGMA, RMS, FLUX, NSTATS, NACCUM } |
This enum StatisticTypes is provided for use with the LatticeStatistics<T>::setPlotting function. More... | |
Static Public Member Functions inherited from casacore::LatticeStatsBase | |
static Vector< Int > | toStatisticTypes (const String &statistics, const Regex &delimiter) |
Helper function to convert a String containing a list of desired statistics to the correct Vector<Int> required for the LatticeStatistics<T>::setPlotting function. More... | |
static Vector< Int > | toStatisticTypes (const Vector< String > &statistics) |
static String | toStatisticName (StatisticsTypes type) |
Convert type to string. More... | |
static String | toStatisticName (Int type) |
static Int | toStatisticType (const String &statistic) |
Returns -1 if the statistic string is not valid. More... | |
static Bool | setNxy (Vector< Int > &nxy, ostream &os) |
Check and fill in defaults for a Vector<Int> containing the number of subplots in x and y to be put on a plot. More... | |
static void | setStorageImageShape (IPosition &storeImageShape, const Bool &last, const Int &axisSize, const Vector< Int > &displayAxes, const IPosition &shape) |
A storage image is used to accumulate information as a function of the display axes as an image is iterated through. More... | |
static void | stretchMinMax (Float &min, Float &max) |
Stretch a range by 10%. More... | |
static std::set< Double > | quartileFracs () |
Protected Attributes inherited from casacore::LatticeStatistics< T > | |
LogIO | os_p |
Vector< Int > | cursorAxes_p |
Vector< Int > | displayAxes_p |
Bool | goodParameterStatus_p |
Bool | haveLogger_p |
Bool | fixedMinMax_p |
Bool | doRobust_p |
doRobust means that when the storage lattice is generated, the robust statistics are generated as well More... | |
Bool | doList_p |
IPosition | minPos_p |
IPosition | maxPos_p |
IPosition | blcParent_p |
String | error_p |
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.
|
protected |
Definition at line 173 of file ImageStatistics.h.
casacore::ImageStatistics< T >::ImageStatistics | ( | const ImageInterface< T > & | image, |
LogIO & | os, | ||
Bool | showProgress = True , |
||
Bool | forceDisk = False , |
||
Bool | clone = True |
||
) |
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. If clone
is True, the input image will be cloned, so the caller can make changes to the input image, but the statistics will reflect the image as it was at construction. If False, a reference to the input image is used, and so the caller shouldn't make changes to the input image between construction and calling statistics computation methods, unless it calls setNewImage() to update the changed image. Obviously, cloning the image impacts performance and memory usage.
casacore::ImageStatistics< T >::ImageStatistics | ( | const ImageInterface< T > & | image, |
Bool | showProgress = True , |
||
Bool | forceDisk = False , |
||
Bool | clone = True |
||
) |
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 |
Destructor.
|
protectedvirtual |
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 >.
|
privatevirtual |
Reimplemented from casacore::LatticeStatistics< T >.
|
privatevirtual |
Reimplemented from casacore::LatticeStatistics< T >.
|
privatevirtual |
If isFluxDensity
is False, then the computed value is a flux (ie flux density integrated over a spectral extent)
Reimplemented from casacore::LatticeStatistics< T >.
|
privatevirtual |
Get beam area in pixels if possible.
Return False if the beam area could not be calculated.
|
inline |
Definition at line 168 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_messages.
|
privatevirtual |
Reimplemented from casacore::LatticeStatistics< T >.
IPosition casacore::ImageStatistics< T >::getBlc | ( | ) | const |
|
privatevirtual |
Virtual functions.
See LatticeStatistics for more information about these, or see the implementation.
Get label for higher order axes
|
inline |
Definition at line 166 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_messages.
Int casacore::ImageStatistics< T >::getPrecision | ( | ) | const |
|
privatevirtual |
List min and max with world coordinates.
Reimplemented from casacore::LatticeStatistics< T >.
|
privatevirtual |
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".
|
inline |
Definition at line 164 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_recordMessages.
void casacore::ImageStatistics< T >::setBlc | ( | const IPosition & | blc | ) |
|
inline |
Definition at line 170 of file ImageStatistics.h.
References casacore::ImageStatistics< T >::_listStats.
Bool casacore::ImageStatistics< T >::setNewImage | ( | const ImageInterface< T > & | image, |
Bool | clone = True |
||
) |
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. If clone
is True, the input image will be cloned, so the caller can make changes to the input image, but the statistics will reflect the image as it was at construction. If False, a reference to the input image is used, and so the caller shouldn't make changes to the input image between construction and calling statistics computation methods, unless it calls setNewImage() to update the changed image. Obviously, cloning the image impacts performance and memory usage.
void casacore::ImageStatistics< T >::setPrecision | ( | Int | precision | ) |
void casacore::ImageStatistics< T >::showRobust | ( | const Bool | show | ) |
list robust statistics? Should be called before display()
|
private |
Definition at line 182 of file ImageStatistics.h.
|
private |
Definition at line 185 of file ImageStatistics.h.
Referenced by casacore::ImageStatistics< T >::setListStats().
|
mutableprivate |
Definition at line 186 of file ImageStatistics.h.
Referenced by casacore::ImageStatistics< T >::clearMessages(), and casacore::ImageStatistics< T >::getMessages().
|
private |
Definition at line 185 of file ImageStatistics.h.
Referenced by casacore::ImageStatistics< T >::recordMessages().
|
private |
Definition at line 185 of file ImageStatistics.h.
|
private |
Definition at line 183 of file ImageStatistics.h.
|
private |
Data.
Definition at line 180 of file ImageStatistics.h.
|
private |
Definition at line 181 of file ImageStatistics.h.
|
private |
Definition at line 184 of file ImageStatistics.h.