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

          Line data    Source code
       1             : //# Copyright (C) 1998,1999,2000,2001,2003
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This program is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU General Public License as published by the Free
       6             : //# Software Foundation; either version 2 of the License, or (at your option)
       7             : //# any later version.
       8             : //#
       9             : //# This program is distributed in the hope that it will be useful, but WITHOUT
      10             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      11             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
      12             : //# more details.
      13             : //#
      14             : //# You should have received a copy of the GNU General Public License along
      15             : //# with this program; if not, write to the Free Software Foundation, Inc.,
      16             : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      17             : //#
      18             : //# Correspondence concerning AIPS++ should be addressed as follows:
      19             : //#        Internet email: casa-feedback@nrao.edu.
      20             : //#        Postal address: AIPS++ Project Office
      21             : //#                        National Radio Astronomy Observatory
      22             : //#                        520 Edgemont Road
      23             : //#                        Charlottesville, VA 22903-2475 USA
      24             : //#
      25             : //# $Id: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $
      26             : 
      27             : #ifndef IMAGEANALYSIS_IMAGESTATSBASE_H
      28             : #define IMAGEANALYSIS_IMAGESTATSBASE_H
      29             : 
      30             : #include <imageanalysis/ImageAnalysis/ImageTask.h>
      31             : 
      32             : #include <imageanalysis/ImageAnalysis/ImageStatsData.h>
      33             : 
      34             : #include <casacore/images/Images/ImageStatistics.h>
      35             : #include <casacore/casa/namespace.h>
      36             : 
      37             : #include <memory>
      38             : 
      39             : namespace casacore {
      40             : 
      41             : template <class T> class CountedPtr;
      42             : 
      43             : }
      44             : 
      45             : namespace casa {
      46             : 
      47             : class C11Timer;
      48             : 
      49             : template <class T> class ImageStatsBase: public ImageTask<T> {
      50             : 
      51             :     // <summary>
      52             :     // This adds configuration methods for statistics classes.
      53             :     // </summary>
      54             : 
      55             :     // <reviewed reviewer="" date="" tests="" demos="">
      56             :     // </reviewed>
      57             : 
      58             :     // <prerequisite>
      59             :     // </prerequisite>
      60             : 
      61             :     // <etymology>
      62             :     // Image statistics configuration
      63             :     // </etymology>
      64             : 
      65             :     // <synopsis>
      66             :     // This adds configuration methods for statistics classes.
      67             :     // </synopsis>
      68             : 
      69             : public:
      70             : 
      71             :     ImageStatsBase() = delete;
      72             : 
      73             :     ~ImageStatsBase();
      74             : 
      75             :     void configureBiweight(casacore::Int maxIter);
      76             : 
      77             :     void configureChauvenet(
      78             :         casacore::Double zscore, casacore::Int maxIterations
      79             :     );
      80             : 
      81             :     void configureClassical(ImageStatsData::PreferredClassicalAlgorithm p);
      82             : 
      83             :     // configure fit to half algorithm
      84             :     void configureFitToHalf(
      85             :         casacore::FitToHalfStatisticsData::CENTER centerType,
      86             :         casacore::FitToHalfStatisticsData::USE_DATA useData,
      87             :         casacore::Double centerValue
      88             :     );
      89             : 
      90             :     // configure hinges-fences algorithm
      91             :     void configureHingesFences(casacore::Double f);
      92             : 
      93             : protected:
      94             : 
      95             :     struct AlgConf {
      96             :         casacore::StatisticsData::ALGORITHM algorithm;
      97             :         // hinges-fences f factor
      98             :         casacore::Double hf;
      99             :         // fit to have center type
     100             :         casacore::FitToHalfStatisticsData::CENTER ct;
     101             :         // fit to half data portion to use
     102             :         casacore::FitToHalfStatisticsData::USE_DATA ud;
     103             :         // fit to half center value
     104             :         T cv;
     105             :         // Chauvenet zscore
     106             :         casacore::Double zs;
     107             :         // Chauvenet/Biweight max iterations
     108             :         casacore::Int mi;
     109             :     };
     110             : 
     111             :     ImageStatsBase(
     112             :         const SPCIIT image,
     113             :         const casacore::Record *const &regionPtr,
     114             :         const casacore::String& maskInp,
     115             :         const casacore::String& outname="",
     116             :         casacore::Bool overwrite=false
     117             :     );
     118             : 
     119             :     casacore::String _configureAlgorithm();
     120             : 
     121           0 :     std::unique_ptr<casacore::ImageStatistics<T>>& _getImageStats() {
     122           0 :         return _statistics;
     123             :     }
     124             : 
     125           0 :     StatisticsData::ALGORITHM _getAlgorithm() const {
     126           0 :         return _algConf.algorithm;
     127             :     }
     128             : 
     129           0 :     AlgConf _getAlgConf() const {
     130           0 :         return _algConf;
     131             :     }
     132             : 
     133           0 :     void _resetStats(ImageStatistics<T>* stat=nullptr) {
     134           0 :         _statistics.reset(stat);
     135           0 :     }
     136             : 
     137             : private:
     138             : 
     139             :     std::unique_ptr<casacore::ImageStatistics<T>> _statistics;
     140             :     AlgConf _algConf;
     141             :     ImageStatsData::PreferredClassicalAlgorithm _prefClassStatsAlg
     142             :         = ImageStatsData::AUTO;
     143             : 
     144             : };
     145             : 
     146             : }
     147             : 
     148             : #ifndef AIPS_NO_TEMPLATE_SRC
     149             : #include <imageanalysis/ImageAnalysis/ImageStatsBase.tcc>
     150             : #endif
     151             : 
     152             : #endif

Generated by: LCOV version 1.16