casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ImageStatsCalculator.h
Go to the documentation of this file.
00001 //# tSubImage.cc: Test program for class SubImage
00002 //# Copyright (C) 1998,1999,2000,2001,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This program is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU General Public License as published by the Free
00007 //# Software Foundation; either version 2 of the License, or (at your option)
00008 //# any later version.
00009 //#
00010 //# This program is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00013 //# more details.
00014 //#
00015 //# You should have received a copy of the GNU General Public License along
00016 //# with this program; if not, write to the Free Software Foundation, Inc.,
00017 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $
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 class ImageStatsCalculator: public ImageTask {
00042     // <summary>
00043     // Top level class used for statistics calculations
00044     // </summary>
00045 
00046     // <reviewed reviewer="" date="" tests="" demos="">
00047     // </reviewed>
00048 
00049     // <prerequisite>
00050     // </prerequisite>
00051 
00052     // <etymology>
00053     // Image statistics calculator
00054     // </etymology>
00055 
00056     // <synopsis>
00057     // Top level class used for statistics calculations
00058     // </synopsis>
00059 
00060 public:
00061 
00062         ImageStatsCalculator(
00063                 const ImageInterface<Float> *const &image,
00064         const Record *const &regionPtr,
00065         const String& maskInp, Bool beVerboseDuringConstruction
00066     );
00067 
00068     ~ImageStatsCalculator();
00069 
00070     Record calculate();
00071 
00072     inline String getClass() const {return _class;}
00073 
00074     inline void setPlotStats(const Vector<String>& ps) {_plotStats.assign(ps); }
00075 
00076     inline void setIncludePix(const Vector<Float>& inc) {_includepix.assign(inc);}
00077 
00078     inline void setExcludePix(const Vector<Float>& exc) {_excludepix.assign(exc);}
00079 
00080     inline void setPlotter(const String& p) {_plotter = p;}
00081 
00082     inline void setNXNY(const Int x, const Int y) {
00083         _nx = x;
00084         _ny = y;
00085     }
00086 
00087     inline void setList(const Bool l) {_list = l;}
00088 
00089     inline void setForce(const Bool f) {_force = f;}
00090 
00091     inline void setDisk(const Bool d) {_disk = d;}
00092 
00093     inline void setRobust(const Bool r) {_robust = r;}
00094 
00095     inline void setVerbose(const Bool v) {_verbose = v;}
00096 
00097     inline void setAxes(const Vector<Int>& axes) {_axes.assign(axes);}
00098 
00099     // moved from ImageAnalysis
00100     // if messageStore != 0, log messages, stripped of time stampe and priority, will also be placed in this parameter and
00101     // retur    ned to caller for eg logging to file.
00102     Record statistics(
00103          vector<String> *const &messageStore=0
00104     );
00105 
00106 protected:
00107 
00108         inline CasacRegionManager::StokesControl _getStokesControl() const {
00109                 return CasacRegionManager::USE_ALL_STOKES;
00110         }
00111 
00112     inline vector<ImageInputProcessor::OutputStruct> _getOutputStruct() {
00113         return vector<ImageInputProcessor::OutputStruct>(0);
00114     }
00115 
00116     inline vector<Coordinate::Type> _getNecessaryCoordinates() const {
00117         return vector<Coordinate::Type>(0);
00118     }
00119 
00120     inline Bool _supportsMultipleRegions() {return True;}
00121 
00122 private:
00123     std::auto_ptr<ImageStatistics<Float> > _statistics;
00124     std::auto_ptr<ImageRegion> _oldStatsRegion, _oldStatsMask;
00125     Bool _oldStatsStorageForce;
00126     Vector<Int> _axes;
00127     Vector<String> _plotStats;
00128     Vector<Float> _includepix, _excludepix;
00129     String _plotter;
00130     Int _nx, _ny;
00131     Bool _list, _force, _disk, _robust, _verbose;
00132 
00133     static const String _class;
00134 
00135     // moved from ImageAnalysis
00136     // See if the combination of the 'region' and 'mask' ImageRegions have changed
00137     static Bool _haveRegionsChanged (
00138         ImageRegion* pNewRegionRegion,
00139         ImageRegion* pNewMaskRegion,
00140         ImageRegion* pOldRegionRegion,
00141         ImageRegion* pOldMaskRegion
00142     );
00143 };
00144 }
00145 
00146 #endif