00001 //# tSubImage.cc: Test program for class SubImage 00002 //# Copyright (C) 1998,1999,2000,2001,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This program is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU General Public License as published by the Free 00007 //# Software Foundation; either version 2 of the License, or (at your option) 00008 //# any later version. 00009 //# 00010 //# This program is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 //# more details. 00014 //# 00015 //# You should have received a copy of the GNU General Public License along 00016 //# with this program; if not, write to the Free Software Foundation, Inc., 00017 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: tSubImage.cc 20567 2009-04-09 23:12:39Z gervandiepen $ 00027 00028 #ifndef IMAGEANALYSIS_IMAGECROPPER_H 00029 #define IMAGEANALYSIS_IMAGECROPPER_H 00030 00031 #include <imageanalysis/ImageAnalysis/ImageTask.h> 00032 #include <casa/namespace.h> 00033 00034 namespace casa { 00035 00036 template <class T> class ImageCropper : public ImageTask<T> { 00037 // <summary> 00038 // Top level interface for cropping masked edges of an image 00039 // </summary> 00040 00041 // <reviewed reviewer="" date="" tests="" demos=""> 00042 // </reviewed> 00043 00044 // <prerequisite> 00045 // </prerequisite> 00046 00047 // <etymology> 00048 // Crop an image 00049 // </etymology> 00050 00051 // <synopsis> 00052 // High level interface for cropping images. 00053 // </synopsis> 00054 00055 // <example> 00056 // <srcblock> 00057 // ImageCropper cropper(); 00058 // cropper.crop(); 00059 // </srcblock> 00060 // </example> 00061 00062 public: 00063 00064 // At most one of <src>regionRec</src> 00065 // or <src>box/chanInp/stokes</src> should be supplied. If specifying <src>regionRec</src> that should 00066 // be a non-null pointer and box, chanInp and stokes should all be empty strings. If specifying either or 00067 // both of chanInp and/or stokes, the one(s) being specified should be non-empty strings corresponding 00068 // to correct syntax for that particular parameter, and regionRec should be null. 00069 // If you specify <src>regionRec</src>=0 00070 // and <src>box</src>="", <src>stokes</src>="", and <src>chanInp</src>="", that implies you want to use all 00071 // of the input image. 00072 ImageCropper( 00073 const SHARED_PTR<const ImageInterface<T> > image, 00074 const Record *const ®ionRec, const String& box, const String& chanInp, 00075 const String& stokes, const String& maskInp, 00076 const String& outname, const Bool overwrite 00077 ); 00078 00079 // destructor 00080 ~ImageCropper(); 00081 00082 // Perform the cropping. If <src>wantReturn</src> is True, a shared_ptr which 00083 // wraps the cropped image is returned. If False, an empty shared_ptr is returned. 00084 SHARED_PTR<ImageInterface<T> > crop(const Bool wantReturn) const; 00085 00086 // Set the axes along which to do the cropping. An empty set means 00087 // crop all axes. 00088 void setAxes(const std::set<uInt>& axes); 00089 00090 String getClass() const; 00091 00092 protected: 00093 inline CasacRegionManager::StokesControl _getStokesControl() const { 00094 return CasacRegionManager::USE_ALL_STOKES; 00095 } 00096 00097 inline vector<Coordinate::Type> _getNecessaryCoordinates() const { 00098 return vector<Coordinate::Type>(0); 00099 } 00100 00101 private: 00102 std::set<uInt> _axes; 00103 static const String _class; 00104 00105 00106 // disallow default constructor 00107 ImageCropper(); 00108 00109 }; 00110 } 00111 00112 #ifndef AIPS_NO_TEMPLATE_SRC 00113 #include <imageanalysis/ImageAnalysis/ImageCropper.tcc> 00114 #endif //# AIPS_NO_TEMPLATE_SRC 00115 00116 #endif