ImageStatsCalculator.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef IMAGEANALYSIS_IMAGESTATSCALCULATOR_H
00029 #define IMAGEANALYSIS_IMAGESTATSCALCULATOR_H
00030
00031 #include <imageanalysis/ImageAnalysis/ImageTask.h>
00032
00033 #include <images/Images/ImageStatistics.h>
00034
00035 #include <casa/namespace.h>
00036
00037 #include <memory>
00038
00039 namespace casa {
00040
00041 template <class T> class CountedPtr;
00042
00043 class ImageStatsCalculator: public ImageTask<Float> {
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 public:
00063
00064 enum PreferredClassicalAlgorithm {
00065
00066 TILED_APPLY,
00067
00068 STATS_FRAMEWORK,
00069
00070
00071 AUTO
00072 };
00073
00074 ImageStatsCalculator(
00075 const SPCIIF image,
00076 const Record *const ®ionPtr,
00077 const String& maskInp, Bool beVerboseDuringConstruction=False
00078 );
00079
00080 ~ImageStatsCalculator();
00081
00082 Record calculate();
00083
00084 void configureChauvenet(Double zscore, Int maxIterations);
00085
00086 void configureClassical(PreferredClassicalAlgorithm p);
00087
00088
00089 void configureFitToHalf(
00090 FitToHalfStatisticsData::CENTER centerType,
00091 FitToHalfStatisticsData::USE_DATA useData,
00092 Double centerValue
00093 );
00094
00095
00096 void configureHingesFences(Double f);
00097
00098 void forceNewStorage() { _statistics.reset(); }
00099
00100 inline String getClass() const {return _class;}
00101
00102 inline void setAxes(const Vector<Int>& axes) {
00103 _axes.assign(axes); GenSort<Int>::sort(_axes);
00104 }
00105
00106 void setDisk(Bool d);
00107
00108
00109
00110 inline void setIncludePix(const Vector<Float>& inc) {_includepix.assign(inc);}
00111
00112
00113
00114 inline void setExcludePix(const Vector<Float>& exc) {_excludepix.assign(exc);}
00115
00116
00117
00118 inline void setList(Bool l) {_list = l;}
00119
00120 void setRobust(Bool r);
00121
00122 void setVerbose(Bool v);
00123
00124
00125
00126
00127 Record statistics(
00128 vector<String> *const &messageStore=0
00129 );
00130
00131 protected:
00132
00133 CasacRegionManager::StokesControl _getStokesControl() const {
00134 return CasacRegionManager::USE_ALL_STOKES;
00135 }
00136
00137 vector<OutputDestinationChecker::OutputStruct> _getOutputStruct() {
00138 return vector<OutputDestinationChecker::OutputStruct>(0);
00139 }
00140
00141 vector<Coordinate::Type> _getNecessaryCoordinates() const {
00142 return vector<Coordinate::Type>(0);
00143 }
00144
00145 Bool _hasLogfileSupport() const { return True; }
00146
00147 inline Bool _supportsMultipleRegions() const {return True;}
00148
00149 private:
00150 std::unique_ptr<ImageStatistics<Float> > _statistics;
00151 CountedPtr<ImageRegion> _oldStatsRegion, _oldStatsMask;
00152 Vector<Int> _axes;
00153 Vector<Float> _includepix, _excludepix;
00154 Bool _list, _disk, _robust, _verbose;
00155 LatticeStatistics<Float>::AlgConf _algConf;
00156 SHARED_PTR<const SubImage<Float> > _subImage;
00157 PreferredClassicalAlgorithm _prefClassStatsAlg;
00158
00159 static const String _class;
00160
00161 String _configureAlgorithm();
00162
00163
00164
00165 static Bool _haveRegionsChanged (
00166 ImageRegion* pNewRegionRegion,
00167 ImageRegion* pNewMaskRegion,
00168 ImageRegion* pOldRegionRegion,
00169 ImageRegion* pOldMaskRegion
00170 );
00171
00172 void _reportDetailedStats(
00173 const SHARED_PTR<const ImageInterface<Float> > tempIm,
00174 const Record& retval
00175 );
00176
00177 };
00178 }
00179
00180 #endif