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 0 : 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 0 : os << casacore::LogOrigin("ImageMaskAttacher", __func__); 35 0 : if (out.canDefineRegion()) { 36 : // Generate mask name if not given 37 0 : if (maskName.empty()) { 38 0 : maskName = out.makeUniqueRegionName(casacore::String("mask"), 0); 39 : } 40 : // Make the mask if it does not exist 41 0 : if (! out.hasRegion(maskName, casacore::RegionHandler::Masks)) { 42 0 : out.makeMask(maskName, true, makeDefault, init, true); 43 0 : if (list) { 44 0 : if (init) { 45 : os << casacore::LogIO::NORMAL << "Created and initialized mask `" 46 0 : << maskName << "'" << casacore::LogIO::POST; 47 : } else { 48 : os << casacore::LogIO::NORMAL << "Created mask `" << maskName << "'" 49 0 : << casacore::LogIO::POST; 50 : } 51 : } 52 : } 53 0 : 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 :