LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - ComponentImager.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 5 5 100.0 %
Date: 2024-12-11 20:54:31 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //# ComponentImager.h: this defines ComponentImager, which ...
       2             : //# Copyright (C) 1999,2000,2003
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library 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 Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 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             : //#
      27             : //# $Id: ComponentImager.h 20299 2008-04-03 05:56:44Z gervandiepen $
      28             : //#! ========================================================================
      29             : //#!                Attention!  Programmers read this!
      30             : //#!
      31             : //#! This file is a template to guide you in creating a header file
      32             : //#! for your new class.   By following this template, you will create
      33             : //#! a permanent reference document for your class, suitable for both
      34             : //#! the novice client programmer, the seasoned veteran, and anyone in 
      35             : //#! between.  It is essential that you write the documentation portions 
      36             : //#! of this file with as much care as you do the source code.
      37             : //#!
      38             : //#! If you are unfamilar with the AIPS++ header style please refer to
      39             : //#! template-class-h.
      40             : //#!
      41             : //#!                         Replacement Tokens
      42             : //#!                         ------------------
      43             : //#!
      44             : //#! These are character strings enclosed in angle brackets, on a commented
      45             : //#! line.  Two are found on the first line of this file:
      46             : //#!
      47             : //#!   <ClassFileName.h> <ClassName>
      48             : //#!
      49             : //#! You should remove the angle brackets, and replace the characters within
      50             : //#! the brackets with names specific to your class.  Mimic the capitalization
      51             : //#! and punctuation of the original.  For example, you would change
      52             : //#!
      53             : //#!   <ClassFileName.h>  to   LatticeIter.h
      54             : //#!   <ClassName>        to   LatticeIterator
      55             : //#!
      56             : //#! Another replacement token will be found in the "include guard" just
      57             : //#! a few lines below.
      58             : //#!
      59             : //#!  #define <AIPS_CLASSFILENAME_H>  to  #define AIPS_LATTICEITER_H
      60             : //#!
      61             : 
      62             : #ifndef IMAGES_COMPONENTIMAGER_H
      63             : #define IMAGES_COMPONENTIMAGER_H
      64             : 
      65             : #include <casacore/casa/aips.h>
      66             : 
      67             : #include <imageanalysis/ImageAnalysis/ImageTask.h>
      68             : #include <components/ComponentModels/ComponentList.h>
      69             : #include <casacore/casa/Arrays/ArrayFwd.h>
      70             : 
      71             : #include <memory>
      72             : 
      73             : namespace casacore{
      74             : 
      75             : template <class T> class ImageInterface;
      76             : class Unit;
      77             : class LogIO;
      78             : template <class T> class MeasRef;
      79             : class MDirection;
      80             : class MVAngle;
      81             : class MVFrequency;
      82             : class MFrequency;
      83             : 
      84             : }
      85             : 
      86             : namespace casa {
      87             : 
      88             : 
      89             : // <summary>
      90             : // </summary>
      91             : 
      92             : // <use visibility=local>
      93             : 
      94             : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
      95             : // </reviewed>
      96             : 
      97             : // <prerequisite>
      98             : //   <li> ImageInterface
      99             : //   <li> ComponentList
     100             : // </prerequisite>
     101             : //
     102             : // <etymology>
     103             : // </etymology>
     104             : //
     105             : // <synopsis>
     106             : // Project the componentlist onto the image.  If any of the coordinate
     107             : // transformations for a particular pixel fail (e.g. coordinate system
     108             : // is not defined for that pixel) if the image has a writable mask, then those 
     109             : // pixels will be masked, otherwise they are just zeroed.  Any pixels
     110             : // that are already masked mask=F) will not have their values changed
     111             : // (perhaps this behaviour should be changed).
     112             : // </synopsis>
     113             : //
     114             : // <example>
     115             : // </example>
     116             : //
     117             : // <motivation>
     118             : // </motivation>
     119             : 
     120             : class ComponentImager: public ImageTask<casacore::Float> {
     121             : public:
     122             : 
     123             :         ComponentImager() = delete;
     124             : 
     125             :         ComponentImager(
     126             :                 const SPIIF image, const casacore::Record *const &regionPtr,
     127             :             const casacore::String& maskInp
     128             :         );
     129             : 
     130             :         ~ComponentImager();
     131             : 
     132             :         void setComponentList(const ComponentList& list) {
     133             :                 _list = list;
     134             :         }
     135             : 
     136             :         void setSubtract(casacore::Bool b) { _subtract = b; }
     137             : 
     138          19 :         casacore::String getClass() const { return "ComponentImager"; }
     139             : 
     140             :         void modify(casacore::Bool verbose);
     141             : 
     142             :         // Project the componentlist onto the image.  If any of the coordinate
     143             :         // transformations for a particular pixel fail (e.g. coordinate system
     144             :         // is not defined for that pixel) if the image has a writable mask, then those
     145             :         // pixels will be masked, otherwise they are just zeroed.  Any pixels
     146             :         // that are already masked mask=F) will not have their values changed
     147             :         // (perhaps this behaviour should be changed).
     148             :         static void project(
     149             :                 casacore::ImageInterface<casacore::Float>& image,
     150             :                 const ComponentList& list
     151             :         );
     152             : 
     153             : private:
     154             :         // we cannot use pointer stored in base class because that's const
     155             :         SPIIF _image;
     156             : 
     157             :         ComponentList _list;
     158             : 
     159             :         casacore::Bool _subtract = false;
     160             : 
     161          19 :         CasacRegionManager::StokesControl _getStokesControl() const {
     162          19 :                 return CasacRegionManager::USE_ALL_STOKES;
     163             :         }
     164             : 
     165          19 :     std::vector<casacore::Coordinate::Type> _getNecessaryCoordinates() const {
     166          38 :         return std::vector<casacore::Coordinate::Type>(1, casacore::Coordinate::DIRECTION);
     167             :     }
     168             : 
     169             :         static std::unique_ptr<ComponentList> _doPoints(
     170             :                 casacore::ImageInterface<casacore::Float>& image, const ComponentList& list,
     171             :                 int longAxis, int latAxis, const casacore::Unit& fluxUnits,
     172             :                 const casacore::MeasRef<casacore::MDirection>& dirRef, const casacore::MVAngle& pixelLatSize,
     173             :                 const casacore::MVAngle& pixelLongSize, const casacore::Vector<casacore::MVFrequency>& freqValues,
     174             :                 const casacore::MeasRef<casacore::MFrequency>& freqRef, casacore::Int freqAxis, casacore::Int polAxis, casacore::uInt nStokes
     175             :         );
     176             : 
     177             : };
     178             : 
     179             : }
     180             : 
     181             : #endif
     182             : 
     183             : 

Generated by: LCOV version 1.16