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

          Line data    Source code
       1             : //# ImageMask.cc
       2             : //# Copyright (C) 1998,1999,2000,2001
       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             : #include <imageanalysis/ImageAnalysis/ImageMask.h>
      28             : 
      29             : #include <casacore/lattices/Lattices/MaskedLatticeIterator.h>
      30             : 
      31             : namespace casa {
      32             : 
      33           0 : template <class T> casacore::Bool ImageMask::isAllMaskFalse(const casacore::ImageInterface<T>& image) {
      34           0 :         if (! image.isMasked() && ! image.hasPixelMask()) {
      35           0 :                 return false;
      36             :         }
      37           0 :         auto cursorShape = image.niceCursorShape(4096*4096);
      38           0 :         casacore::LatticeStepper stepper(image.shape(), cursorShape, casacore::LatticeStepper::RESIZE);
      39           0 :         casacore::RO_MaskedLatticeIterator<T> iter(image, stepper);
      40           0 :         for (iter.reset(); ! iter.atEnd(); ++iter) {
      41           0 :                 auto cursorShape = iter.cursorShape();
      42           0 :                 auto mymask = iter.getMask();
      43           0 :                 if (anyTrue(mymask)) {
      44           0 :                         return false;
      45             :                 }
      46             :         }
      47           0 :         return true;
      48           0 : }
      49             : 
      50           0 : template <class T> casacore::Bool ImageMask::isAllMaskTrue(
      51             :         const casacore::MaskedLattice<T>& image
      52             : ) {
      53           0 :         if (! image.isMasked()) {
      54           0 :                 return true;
      55             :         }
      56           0 :         auto cursorShape = image.niceCursorShape(4096*4096);
      57           0 :         casacore::LatticeStepper stepper(image.shape(), cursorShape, casacore::LatticeStepper::RESIZE);
      58           0 :         casacore::RO_MaskedLatticeIterator<T> iter(image, stepper);
      59           0 :         for (iter.reset(); ! iter.atEnd(); ++iter) {
      60           0 :                 auto mymask = iter.getMask();
      61           0 :                 if (! allTrue(mymask)) {
      62           0 :                         return false;
      63             :                 }
      64             :         }
      65           0 :         return true;
      66           0 : }
      67             : 
      68             : }

Generated by: LCOV version 1.16