LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - ImageStatsCalculator.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 12 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 7 0.0 %

          Line data    Source code
       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: casa-feedback@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             : 
      31             : #include <imageanalysis/ImageAnalysis/ImageStatsBase.h>
      32             : 
      33             : #include <casacore/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             : 
      63             :     ImageStatsCalculator(
      64             :         const SPCIIT image, const casacore::Record *const &regionPtr,
      65             :         const casacore::String& maskInp,
      66             :         casacore::Bool beVerboseDuringConstruction=false
      67             :     );
      68             : 
      69             :     ~ImageStatsCalculator();
      70             : 
      71             :     casacore::Record calculate();
      72             : 
      73             :     void forceNewStorage() { this->_resetStats(); }
      74             : 
      75           0 :     inline casacore::String getClass() const {return _class;}
      76             : 
      77           0 :     inline void setAxes(const casacore::Vector<casacore::Int>& axes) {
      78           0 :         _axes.assign(axes); casacore::GenSort<casacore::Int>::sort(_axes);
      79           0 :     }
      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
      85             :     void setIncludePix(const casacore::Vector<T>& inc) {
      86             :         _includepix.assign(inc);
      87             :     }
      88             : 
      89             :     // Set range of pixel values to exclude from the
      90             :     // calculation. Should be a two element Vector
      91             :     void setExcludePix(const casacore::Vector<T>& exc) {
      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.
     106             :     casacore::Record statistics(
     107             :          std::vector<casacore::String> *const &messageStore=0
     108             :     );
     109             : 
     110             :     const static String SIGMA;
     111             : 
     112             : protected:
     113             : 
     114           0 :        CasacRegionManager::StokesControl _getStokesControl() const {
     115           0 :            return CasacRegionManager::USE_ALL_STOKES;
     116             :        }
     117             : 
     118           0 :     std::vector<OutputDestinationChecker::OutputStruct> _getOutputStruct() {
     119           0 :         return std::vector<OutputDestinationChecker::OutputStruct>(0);
     120             :     }
     121             : 
     122           0 :     std::vector<casacore::Coordinate::Type> _getNecessaryCoordinates() const {
     123           0 :         return std::vector<casacore::Coordinate::Type>(0);
     124             :     }
     125             : 
     126           0 :     casacore::Bool _hasLogfileSupport() const { return true; }
     127             : 
     128           0 :     inline casacore::Bool _supportsMultipleRegions() const {return true;}
     129             : 
     130             : private:
     131             :     casacore::CountedPtr<casacore::ImageRegion> _oldStatsRegion = nullptr;
     132             :     casacore::CountedPtr<casacore::ImageRegion> _oldStatsMask = nullptr;
     133             :     casacore::Vector<casacore::Int> _axes = casacore::Vector<casacore::Int>();
     134             :     casacore::Vector<T> _includepix = casacore::Vector<T>();
     135             :     casacore::Vector<T> _excludepix = casacore::Vector<T>();
     136             :     casacore::Bool _list = casacore::False;
     137             :     casacore::Bool _disk = casacore::False;
     138             :     casacore::Bool _robust = casacore::False;
     139             :     casacore::Bool _verbose = casacore::False;
     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
     146             :     static casacore::Bool _haveRegionsChanged (
     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             : 
     159             :     void _reportDetailedStats(
     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

Generated by: LCOV version 1.16