LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - SpectralCollapser.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 1 0.0 %
Date: 2024-10-10 19:51:30 Functions: 0 0 -

          Line data    Source code
       1             : //# SpectralCollapser.h: Header file for class SpectralCollapser
       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_SPECTRALCOLLAPSER_H
      29             : #define IMAGEANALYSIS_SPECTRALCOLLAPSER_H
      30             : 
      31             : #include <imageanalysis/ImageAnalysis/ImageTask.h>
      32             : 
      33             : #include <casacore/casa/namespace.h>
      34             : 
      35             : namespace casacore{
      36             : 
      37             : template <class T> class SubImage;
      38             : }
      39             : 
      40             : namespace casa {
      41             : 
      42             : 
      43             : class SpectralCollapser {
      44             :         // <summary>
      45             :         // Class to collapse an image along the spectral axis.
      46             :         // </summary>
      47             : 
      48             :         // <reviewed reviewer="" date="" tests="" demos="">
      49             :         // </reviewed>
      50             : 
      51             :         // <prerequisite>
      52             :         //   <li> <linkto class=ImageCollapser>ImageCollapser</linkto>
      53             :         // </prerequisite>
      54             : 
      55             :         // <etymology>
      56             :         // Collapses an image along the spectral axis
      57             :         // </etymology>
      58             : 
      59             :         // <synopsis>
      60             :         // Helper class to collapse an image along the spectral axis. The spectral
      61             :         // range to combine is provided interactively from the profiler. The class
      62             :         // transforms the range to the channels to be combined. The actual image
      63             :         // combination is then done with the class "ImageCollapser".
      64             :         // </synopsis>
      65             : 
      66             : public:
      67             :         // The different collapse types
      68             :         enum CollapseType {
      69             :                 PMEAN,
      70             :                 PMEDIAN,
      71             :                 PSUM,
      72             :                 CUNKNOWN
      73             :                 //PVRMSE,
      74             :         };
      75             : 
      76             :         enum CollapseError {
      77             :                 PNOERROR,
      78             :                 PERMSE,
      79             :                 PPROPAG,
      80             :                 EUNKNOWN
      81             :         };
      82             : 
      83             :         // Constructor
      84             :         SpectralCollapser(const SPCIIF image);
      85             : 
      86             :         // Constructor
      87             :         SpectralCollapser(const SPCIIF image, const casacore::String storePath);
      88             : 
      89             :         // Destructor
      90             :         virtual ~SpectralCollapser();
      91             : 
      92             :         // Parameters:
      93             :         // <src>specVals</src>  - the vector of spectral values
      94             :         // <src>startVal</src>  - the spectral value to start the collapse
      95             :         // <src>endVal</src>    - the spectral value to end the collapse
      96             :         // <src>unit</src>      - the unit of the spectral values
      97             :         // <src>collType</src>  - the collapse type (e.g. "mean" or "median")
      98             :         // <src>collError</src> - information on what the error
      99             :         // <src>outname</src>   - name of the collapsed image (output)
     100             :         // <src>msg</src>       - message string (output)
     101             :         virtual casacore::Bool collapse(const casacore::Vector<casacore::Float> &specVals, const casacore::Float startVal, const casacore::Float endVal,
     102             :                         const casacore::String &unit, const SpectralCollapser::CollapseType &collType, const SpectralCollapser::CollapseError &collError, casacore::String &outname, casacore::String &msg);
     103             : 
     104             :         casacore::String summaryHeader() const;
     105             : 
     106             :    void collapseTypeToVector(const SpectralCollapser::CollapseType &collType, casacore::Vector<casacore::Int> &momentVec);
     107             : 
     108             :    // Convert from string to collapse type
     109             :         static void stringToCollapseType(const casacore::String &text,  SpectralCollapser::CollapseType &collType);
     110             : 
     111             :         // Convert from string to error type
     112             :         static void stringToCollapseError(const casacore::String &text, SpectralCollapser::CollapseError &collError);
     113             : 
     114             :         // Convert from collapse type to string
     115             :    static void collapseTypeToString(const SpectralCollapser::CollapseType &collType, casacore::String &strCollType);
     116             : 
     117             :    // Convert from error type to string
     118             :    static void collapseErrorToString(const SpectralCollapser::CollapseError &collError, casacore::String &strCollError);
     119             : 
     120             : private:
     121             :    SPCIIF _image;
     122             :    casacore::LogIO *_log;
     123             : 
     124             :    casacore::String _storePath;
     125             :    casacore::String _all; // = CasacRegionManager::ALL;
     126             :    casacore::IPosition _specAxis;
     127             :    casacore::Bool _hasQualAxis;
     128             : 
     129             :         // Disallow default constructor
     130             :    SpectralCollapser();
     131             : 
     132             :    void _setUp();
     133             :    casacore::Bool _cleanTmpData(const casacore::String &tmpFileName) const;
     134             :    casacore::Bool _cleanTmpData(const casacore::String &tmpData, const casacore::String &tmpError) const;
     135             :    casacore::Bool _getQualitySubImg(const casacore::ImageInterface<casacore::Float>* image, const casacore::Bool &data, casacore::SubImage<casacore::Float> &qualitySub);
     136             :    casacore::Bool _getQualitySubImgs(SPCIIF image, std::shared_ptr<casacore::SubImage<casacore::Float> > &subData, std::shared_ptr<casacore::SubImage<casacore::Float> > &subError) const;
     137             :    casacore::Bool _getOutputName(const casacore::String &wcsInp, casacore::String &outImg, casacore::String &outImgData, casacore::String &outImgError) const;
     138             :    casacore::Bool _collapse(const SPCIIF image, const casacore::String &aggString,
     139             :                 const casacore::String& chanInp, const casacore::String& outname) const;
     140             :    casacore::Bool _moments(const casacore::ImageInterface<casacore::Float> *image, const casacore::Vector<casacore::Int> &momentVec,
     141             :                 const casacore::Int & startIndex, const casacore::Int &endIndex, const casacore::String& outname);
     142           0 :    casacore::Bool _mergeDataError(const casacore::String &outImg, const casacore::String &dataImg, const casacore::String &errorImg, const casacore::Float &normError=1.0) const;
     143             :         void _addMiscInfo(const casacore::String &outName, const casacore::String &wcsInput, const casacore::String &chanInput,
     144             :                         const SpectralCollapser::CollapseType &collType, const SpectralCollapser::CollapseError &collError) const;
     145             :         void _collTypeToImCollString(const SpectralCollapser::CollapseType &collType, casacore::String &colType) const;
     146             :         void _collErrorToImCollString(const SpectralCollapser::CollapseError &collError, casacore::String &colError) const ;
     147             : 
     148             : };
     149             : }
     150             : 
     151             : #endif

Generated by: LCOV version 1.16