casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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 {
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 ImageInterface<Float> *const &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. If <src>wantReturn</src> is True, return a pointer to the
00088         // collapsed image. The returned pointer is created via new(); it is the caller's
00089         // responsibility to delete the returned pointer. If <src>wantReturn</src> is False,
00090         // a NULL pointer is returned and pointer deletion is performed internally.
00091         ImageInterface<Float>* generate(const Bool wantReturn) const;
00092 
00093         // set the endpoints of the slice in direction space. Input values represent pixel
00094         // locations.
00095         void setEndpoints(
00096                 const Double startx, const Double starty,
00097                 const Double endx, const Double endy
00098         );
00099 
00100         // Set the number of pixels perpendicular to the slice for which averaging
00101         // should occur. Must be odd and >= 1. 1 => just use the pixels coincident with the slice
00102         // (no averaging). 3 => Average three pixels, one pixel on either side of the slice and the
00103         // pixel lying on the slice.
00104         // Note this average is done after the image has been rotated.
00105         void setWidth(uInt width);
00106 
00107         String getClass() const;
00108 
00109         // set the unit to be used for the offset axis in the resulting image (from calling
00110         // generate()). Must conform to angular units
00111         void setOffsetUnit(const String& s);
00112 
00113 protected:
00114         inline  CasacRegionManager::StokesControl _getStokesControl() const {
00115                 return CasacRegionManager::USE_ALL_STOKES;
00116         }
00117 
00118         inline vector<Coordinate::Type> _getNecessaryCoordinates() const {
00119                 vector<Coordinate::Type> v;
00120                 v.push_back(Coordinate::SPECTRAL);
00121                 v.push_back(Coordinate::DIRECTION);
00122                 return v;
00123         }
00124 
00125 private:
00126         std::auto_ptr<vector<Double> > _start, _end;
00127         uInt _width;
00128         String _unit;
00129         static const String _class;
00130 
00131 
00132         // disallow default constructor
00133         PVGenerator();
00134 
00135         void _checkWidth(const Int64 xShape, const Int64 yShape) const;
00136 
00137 
00138 };
00139 }
00140 
00141 #endif