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

          Line data    Source code
       1             : //# SpectralImageUtil.cc: Spectral Image Utilities
       2             : //# Copyright (C) 2013
       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 adressed 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$
      28             : 
      29             : 
      30             : 
      31           0 : template <typename T>  casacore::SubImage<T>* SpectralImageUtil::getChannel(casacore::ImageInterface<T>& theIm, casacore::Int beginchannel, casacore::Int endchannel, casacore::Bool writeAccess){
      32           0 :     casacore::CoordinateSystem csys=theIm.coordinates();
      33           0 :     if(endchannel<0 )
      34           0 :       endchannel=beginchannel;
      35           0 :     if(beginchannel > endchannel){ 
      36           0 :       casacore::Int temp=endchannel;
      37           0 :       endchannel=beginchannel;
      38           0 :       beginchannel=temp;
      39             :     }
      40           0 :     casacore::Int spectralIndex=casacore::CoordinateUtil::findSpectralAxis(csys);
      41           0 :     casacore::IPosition blc(theIm.shape());
      42           0 :     casacore::IPosition trc(theIm.shape());
      43           0 :     blc-=blc; //set all values to 0
      44           0 :     trc=theIm.shape();
      45           0 :     trc-=1; // set trc to image size -1
      46           0 :     if(beginchannel > trc[spectralIndex] || beginchannel <0 || endchannel >  trc[spectralIndex] )
      47           0 :       throw(casacore::AipsError("Channel requested does not exist"));
      48           0 :     blc[spectralIndex]=beginchannel;
      49           0 :     trc[spectralIndex]=endchannel;
      50           0 :     casacore::Slicer sl(blc, trc, casacore::Slicer::endIsLast);
      51           0 :     casacore::SubImage<T> * imageSub=new casacore::SubImage<T>(theIm, sl, writeAccess);
      52           0 :     return imageSub;
      53           0 :   };
      54             : 
      55             : 
      56             :  
      57             : 

Generated by: LCOV version 1.16