casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageStatsCalculator.h
Go to the documentation of this file.
1 //# tSubImage.cc: Test program for class SubImage
2 //# Copyright (C) 1998,1999,2000,2001,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This program is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU General Public License as published by the Free
7 //# Software Foundation; either version 2 of the License, or (at your option)
8 //# any later version.
9 //#
10 //# This program is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 //# more details.
14 //#
15 //# You should have received a copy of the GNU General Public License along
16 //# with this program; if not, write to the Free Software Foundation, Inc.,
17 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $
27 
28 #ifndef IMAGEANALYSIS_IMAGESTATSCALCULATOR_H
29 #define IMAGEANALYSIS_IMAGESTATSCALCULATOR_H
30 
32 
33 #include <casa/namespace.h>
34 
35 namespace casacore{
36 
37 template <class T> class CountedPtr;
38 }
39 
40 namespace casa {
41 
42 template <class T> class ImageStatsCalculator: public ImageStatsBase<T> {
43  // <summary>
44  // Top level class used for statistics calculations
45  // </summary>
46 
47  // <reviewed reviewer="" date="" tests="" demos="">
48  // </reviewed>
49 
50  // <prerequisite>
51  // </prerequisite>
52 
53  // <etymology>
54  // Image statistics calculator
55  // </etymology>
56 
57  // <synopsis>
58  // Top level class used for statistics calculations
59  // </synopsis>
60 
61 public:
62 
64  const SPCIIT image, const casacore::Record *const &regionPtr,
65  const casacore::String& maskInp,
66  casacore::Bool beVerboseDuringConstruction=false
67  );
68 
70 
72 
73  void forceNewStorage() { this->_resetStats(); }
74 
75  inline casacore::String getClass() const {return _class;}
76 
77  inline void setAxes(const casacore::Vector<casacore::Int>& axes) {
79  }
80 
81  void setDisk(casacore::Bool d);
82 
83  // Set range of pixel values to include in the
84  // calculation. Should be a two element Vector
86  _includepix.assign(inc);
87  }
88 
89  // Set range of pixel values to exclude from the
90  // calculation. Should be a two element Vector
92  _excludepix.assign(exc);
93  }
94 
95  // casacore::List stats to logger? If you want no logging you should set this to false in addition to
96  // calling setVerbosity()
97  inline void setList(casacore::Bool l) {_list = l;}
98 
99  void setRobust(casacore::Bool r);
100 
101  void setVerbose(casacore::Bool v);
102 
103  // moved from ImageAnalysis
104  // if messageStore != 0, log messages, stripped of time stampe and priority, will also
105  // be placed in this parameter and returned to caller for eg logging to file.
107  std::vector<casacore::String> *const &messageStore=0
108  );
109 
110  const static String SIGMA;
111 
112 protected:
113 
116  }
117 
118  std::vector<OutputDestinationChecker::OutputStruct> _getOutputStruct() {
119  return std::vector<OutputDestinationChecker::OutputStruct>(0);
120  }
121 
122  std::vector<casacore::Coordinate::Type> _getNecessaryCoordinates() const {
123  return std::vector<casacore::Coordinate::Type>(0);
124  }
125 
126  casacore::Bool _hasLogfileSupport() const { return true; }
127 
128  inline casacore::Bool _supportsMultipleRegions() const {return true;}
129 
130 private:
140  std::shared_ptr<const casacore::SubImage<T>> _subImage = nullptr;
141  static const casacore::String _class;
142 
143  // moved from ImageAnalysis
144  // See if the combination of the 'region' and
145  // 'mask' ImageRegions have changed
147  casacore::ImageRegion* newRegion,
148  casacore::ImageRegion* newMask,
149  casacore::ImageRegion* oldRegion,
150  casacore::ImageRegion* oldMask
151  );
152 
153  void _logStartup(
154  std::vector<String> *const &messageStore, const String& alg,
155  const casacore::IPosition& blc, const casacore::IPosition& trc,
156  const casacore::String& blcf, const casacore::String trcf
157  ) const;
158 
160  const std::shared_ptr<const casacore::ImageInterface<T>> tempIm,
161  const casacore::Record& retval
162  );
163 
164  template <class U> void _removePlanes(
165  Array<U>& arr, uInt axis, const std::set<uInt>& planes
166  ) const;
167 
168  // remove values for which there were no points, CAS-10183
169  void _sanitizeDueToRegionSelection(Record& retval) const;
170 
171 };
172 
173 }
174 
175 #ifndef AIPS_NO_TEMPLATE_SRC
176 #include <imageanalysis/ImageAnalysis/ImageStatsCalculator.tcc>
177 #endif
178 
179 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
void setDisk(casacore::Bool d)
static const casacore::String _class
static casacore::Bool _haveRegionsChanged(casacore::ImageRegion *newRegion, casacore::ImageRegion *newMask, casacore::ImageRegion *oldRegion, casacore::ImageRegion *oldMask)
moved from ImageAnalysis See if the combination of the &#39;region&#39; and &#39;mask&#39; ImageRegions have changed ...
std::vector< OutputDestinationChecker::OutputStruct > _getOutputStruct()
void _logStartup(std::vector< String > *const &messageStore, const String &alg, const casacore::IPosition &blc, const casacore::IPosition &trc, const casacore::String &blcf, const casacore::String trcf) const
casacore::Bool _hasLogfileSupport() const
by default, derived classes are configured to have no log file support.
void setRobust(casacore::Bool r)
casacore::String getClass() const
ImageStatsCalculator(const SPCIIT image, const casacore::Record *const &regionPtr, const casacore::String &maskInp, casacore::Bool beVerboseDuringConstruction=false)
Top level class used for statistics calculations.
casacore::Vector< casacore::Int > _axes
casacore::Record calculate()
casacore::CountedPtr< casacore::ImageRegion > _oldStatsRegion
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
A base class for astronomical images.
casacore::Vector< T > _excludepix
void _sanitizeDueToRegionSelection(Record &retval) const
remove values for which there were no points, CAS-10183
virtual void assign(const Array< T > &other)
Assign the other array (which must be of dimension one) to this vector.
void setVerbose(casacore::Bool v)
casacore::Vector< T > _includepix
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void setList(casacore::Bool l)
casacore::List stats to logger? If you want no logging you should set this to false in addition to ca...
void _removePlanes(Array< U > &arr, uInt axis, const std::set< uInt > &planes) const
const Bool False
Definition: aipstype.h:44
#define SPCIIT
Definition: ImageTypedefs.h:35
std::vector< casacore::Coordinate::Type > _getNecessaryCoordinates() const
Represents the minimum set of coordinates necessary for the task to function.
std::shared_ptr< const casacore::SubImage< T > > _subImage
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
casacore::Bool _supportsMultipleRegions() const
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
void setAxes(const casacore::Vector< casacore::Int > &axes)
void _reportDetailedStats(const std::shared_ptr< const casacore::ImageInterface< T >> tempIm, const casacore::Record &retval)
casacore::CountedPtr< casacore::ImageRegion > _oldStatsMask
static uInt sort(T *, uInt nr, Sort::Order=Sort::Ascending, int options=0)
Sort a C-array containing nr T-type objects.
void setExcludePix(const casacore::Vector< T > &exc)
Set range of pixel values to exclude from the calculation.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void setIncludePix(const casacore::Vector< T > &inc)
Set range of pixel values to include in the calculation.
casacore::Record statistics(std::vector< casacore::String > *const &messageStore=0)
moved from ImageAnalysis if messageStore != 0, log messages, stripped of time stampe and priority...
unsigned int uInt
Definition: aipstype.h:51
void _resetStats(ImageStatistics< T > *stat=nullptr)
CasacRegionManager::StokesControl _getStokesControl() const
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42