PVGenerator.h

Go to the documentation of this file.
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 IMAGES_PVGENERATOR_H
00029 #define IMAGES_PVGENERATOR_H
00030 
00031 #include <imageanalysis/ImageAnalysis/ImageTask.h>
00032 #include <casa/namespace.h>
00033 
00034 class MDirection;
00035 
00036 namespace casa {
00037 
00038 class PVGenerator : public ImageTask<Float> {
00039         // <summary>
00040         // Top level interface for generating position-velocity images
00041         // </summary>
00042 
00043         // <reviewed reviewer="" date="" tests="" demos="">
00044         // </reviewed>
00045 
00046         // <prerequisite>
00047         // </prerequisite>
00048 
00049         // <etymology>
00050         // Collapses image.
00051         // </etymology>
00052 
00053         // <synopsis>
00054         // High level interface for generating position-velocity images.
00055         // </synopsis>
00056 
00057         // <example>
00058         // <srcblock>
00059         // ImageCollapser collapser();
00060         // collapser.collapse();
00061         // </srcblock>
00062         // </example>
00063 
00064 public:
00065 
00066         // The region selection in the constructor only applies to the non-direction coordinates.
00067         // The direction coordinate limits are effectively set by calling setEndPoints()
00068         // after construction. The region selection in the constructor is only for things like
00069         // spectral selection and polarization selection. In addition at most one of <src>regionRec</src>
00070         // and <src>chanInp/stokes</src> should be supplied. If specifying <src>regionRec</src> that should
00071         // be a non-null pointer and chanInp and stokes should both be empty strings. If specifying either or
00072         // both of chanInp and/or stokes, the one(s) being specified should be non-empty strings corresponding
00073         // to correct syntax for that particular parameter, and regionRec should be null.
00074         // If you specify <src>regionRec</src>=0
00075         // and <src>stokes</src>="", and <src>chanInp</src>="", that implies you want to use all
00076         // spectral channels and all polarization planes in the input image.
00077         PVGenerator(
00078                 const SPCIIF image,
00079                 const Record *const &regionRec, const String& chanInp,
00080                 const String& stokes, const String& maskInp,
00081                 const String& outname, const Bool overwrite
00082         );
00083 
00084         // destructor
00085         ~PVGenerator();
00086 
00087         // perform the collapse. Returns a pointer to the
00088         // collapsed image.
00089         SPIIF generate() const;
00090 
00091         // set the end points of the slice in direction space. Input values represent pixel
00092         // coordinates in the input image.
00093         void setEndpoints(
00094                 const std::pair<Double, Double>& start,
00095                 const std::pair<Double, Double>& end
00096         );
00097 
00098         // set end points given center in pixels, length of segment in pixels, and position angle
00099         // taken in the normal astronomical sense, measured from north through east.
00100         void setEndpoints(
00101                 const std::pair<Double, Double>& center, Double length,
00102                 const Quantity& pa
00103         );
00104 
00105         void setEndpoints(
00106                 const std::pair<Double, Double>& center, const Quantity& length,
00107                 const Quantity& pa
00108         );
00109 
00110         void setEndpoints(
00111                 const MDirection& center, const Quantity& length,
00112                 const Quantity& pa
00113         );
00114 
00115         // <src>length in pixels</src>
00116         void setEndpoints(
00117                 const MDirection& center, Double length,
00118                 const Quantity& pa
00119         );
00120 
00121         void setEndpoints(
00122                 const MDirection& start, const MDirection& end
00123         );
00124 
00125         // Set the number of pixels perpendicular to the slice for which averaging
00126         // should occur. Must be odd and >= 1. 1 => just use the pixels coincident with the slice
00127         // (no averaging). 3 => Average three pixels, one pixel on either side of the slice and the
00128         // pixel lying on the slice.
00129         // Note this average is done after the image has been rotated.
00130         void setWidth(uInt width);
00131         // This will set the width by rounding <src>q</src> up so that the width is an odd number of pixels.
00132         void setWidth(const Quantity& q);
00133 
00134         String getClass() const;
00135 
00136         // set the unit to be used for the offset axis in the resulting image (from calling
00137         // generate()). Must conform to angular units
00138         void setOffsetUnit(const String& s);
00139 
00140 
00141 protected:
00142         inline  CasacRegionManager::StokesControl _getStokesControl() const {
00143                 return CasacRegionManager::USE_ALL_STOKES;
00144         }
00145 
00146         inline vector<Coordinate::Type> _getNecessaryCoordinates() const {
00147                 vector<Coordinate::Type> v;
00148                 v.push_back(Coordinate::SPECTRAL);
00149                 v.push_back(Coordinate::DIRECTION);
00150                 return v;
00151         }
00152 
00153     virtual Bool _mustHaveSquareDirectionPixels() const {return True;}
00154 
00155 
00156 private:
00157         std::unique_ptr<vector<Double> > _start, _end;
00158         uInt _width;
00159         String _unit;
00160         static const String _class;
00161 
00162 
00163         // disallow default constructor
00164         PVGenerator();
00165 
00166         void _checkWidth(const Int64 xShape, const Int64 yShape) const;
00167 
00168         Quantity _increment() const;
00169 
00170         static String _pairToString(const std::pair<Double, Double>& p);
00171 
00172 };
00173 }
00174 
00175 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1