LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - ImageMaskAttacher.tcc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 11 14 78.6 %
Date: 2024-11-06 17:42:47 Functions: 1 4 25.0 %

          Line data    Source code
       1             : //# Copyright (C) 1998,1999,2000,2001,2003
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This library is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU Library General Public License as published by
       6             : //# the Free Software Foundation; either version 2 of the License, or (at your
       7             : //# option) any later version.
       8             : //#
       9             : //# This library 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 Library General Public
      12             : //# License for more details.
      13             : //#
      14             : //# You should have received a copy of the GNU Library General Public License
      15             : //# along with this library; if not, write to the Free Software Foundation,
      16             : //# Inc., 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             : 
      26             : #include <imageanalysis/ImageAnalysis/ImageMaskAttacher.h>
      27             : 
      28             : namespace casa {
      29             : 
      30          21 : template<class T> casacore::Bool ImageMaskAttacher::makeMask(
      31             :         casacore::ImageInterface<T>& out, casacore::String& maskName,
      32             :         casacore::Bool init, casacore::Bool makeDefault, casacore::LogIO& os, casacore::Bool list
      33             : ) {
      34          21 :         os << casacore::LogOrigin("ImageMaskAttacher", __func__);
      35          21 :         if (out.canDefineRegion()) {
      36             :                 // Generate mask name if not given
      37          21 :                 if (maskName.empty()) {
      38          21 :                         maskName = out.makeUniqueRegionName(casacore::String("mask"), 0);
      39             :                 }
      40             :                 // Make the mask if it does not exist
      41          21 :                 if (! out.hasRegion(maskName, casacore::RegionHandler::Masks)) {
      42          21 :                         out.makeMask(maskName, true, makeDefault, init, true);
      43          21 :                         if (list) {
      44          21 :                                 if (init) {
      45             :                                         os << casacore::LogIO::NORMAL << "Created and initialized mask `"
      46          21 :                                                         << maskName << "'" << casacore::LogIO::POST;
      47             :                                 } else {
      48             :                                         os << casacore::LogIO::NORMAL << "Created mask `" << maskName << "'"
      49           0 :                                                         << casacore::LogIO::POST;
      50             :                                 }
      51             :                         }
      52             :                 }
      53          21 :                 return true;
      54             :         }
      55             :         else {
      56             :                 os << casacore::LogIO::WARN
      57             :                         << "Cannot make requested mask for this type of image"
      58           0 :                                 << casacore::LogIO::POST;
      59           0 :                 return false;
      60             :         }
      61             : }
      62             : 
      63             : } //# NAMESPACE CASA - END
      64             : 

Generated by: LCOV version 1.16