ImageRegridder.h

Go to the documentation of this file.
00001 //# Copyright (C) 1998,1999,2000,2001,2003
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This program is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU General Public License as published by the Free
00006 //# Software Foundation; either version 2 of the License, or (at your option)
00007 //# any later version.
00008 //#
00009 //# This program is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00012 //# more details.
00013 //#
00014 //# You should have received a copy of the GNU General Public License along
00015 //# with this program; if not, write to the Free Software Foundation, Inc.,
00016 //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef IMAGEANALYSIS_IMAGEREGRIDDER_H
00027 #define IMAGEANALYSIS_IMAGEREGRIDDER_H
00028 
00029 #include <imageanalysis/ImageAnalysis/ImageRegridderBase.h>
00030 
00031 #include <scimath/Mathematics/Interpolate2D.h>
00032 #include <casa/namespace.h>
00033 
00034 namespace casa {
00035 
00036 template <class T> class SubImage;
00037 template <class T> class TempImage;
00038 
00039 class ImageRegridder : public ImageRegridderBase<Float> {
00040         // <summary>
00041         // Top level interface which regrids an image to a specified coordinate system
00042         // </summary>
00043 
00044         // <reviewed reviewer="" date="" tests="" demos="">
00045         // </reviewed>
00046 
00047         // <prerequisite>
00048         // </prerequisite>
00049 
00050         // <etymology>
00051         // Regrids image.
00052         // </etymology>
00053 
00054         // <synopsis>
00055         // High level interface for regridding an image. Note that in the case of a complex-valued
00056         // image, the image is first divided into its composite real and imaginary parts, and these
00057         // parts are regridded independently. The resulting regridded images are combined to form
00058         // the final regridded complex-valued image.
00059         // </synopsis>
00060 
00061 public:
00062 
00063         ImageRegridder() = delete;
00064 
00065         // if <src>outname</src> is empty, no image will be written
00066         // if <src>overwrite</src> is True, if image already exists it will be removed
00067         // if <src>overwrite</src> is False, if image already exists exception will be thrown
00068         // <group>
00069 
00070         ImageRegridder(
00071                 const SPCIIF image,
00072                 const Record *const regionRec,
00073                 const String& maskInp, const String& outname, Bool overwrite,
00074                 const CoordinateSystem& csysTo, const IPosition& axes,
00075                 const IPosition& shape
00076         );
00077 
00078         // FIXME Add support to allow image and templateIm to be of different data types
00079         ImageRegridder(
00080                 const SPCIIF image, const String& outname,
00081                 const SPCIIF templateIm, const IPosition& axes=IPosition(),
00082                 const Record *const regionRec=0,
00083                 const String& maskInp="", Bool overwrite=False,
00084                 const IPosition& shape=IPosition()
00085         );
00086         // </group>
00087 
00088         // destructor
00089         ~ImageRegridder();
00090 
00091         // perform the regrid.
00092         SPIIF regrid() const;
00093 
00094         inline String getClass() const { return _class; }
00095 
00096         void setDebug(Int debug) { _debug = debug; }
00097 
00098 private:
00099         mutable SPIIF _subimage;
00100         Int _debug;
00101         static const String _class;
00102 
00103         SPIIF _regrid() const;
00104 
00105         SPIIF _regridByVelocity() const;
00106 
00107         Bool _doImagesOverlap(
00108                 SPCIIF image0,
00109                 SPCIIF image1
00110         ) const;
00111 
00112         static Vector<std::pair<Double, Double> > _getDirectionCorners(
00113                 const DirectionCoordinate& dc,
00114                 const IPosition& directionShape
00115         );
00116 
00117         void _checkOutputShape(
00118                 const SubImage<Float>& subImage,
00119                 const std::set<Coordinate::Type>& coordsToRegrid
00120         ) const;
00121 
00122         SPIIF _decimateStokes(SPIIF workIm) const;
00123 
00124         static Bool _doRectanglesIntersect(
00125                 const Vector<std::pair<Double, Double> >& corners0,
00126                 const Vector<std::pair<Double, Double> >& corners1
00127         );
00128 
00129 };
00130 }
00131 
00132 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1