casa
$Rev:20696$
|
00001 //# StokesImageUtil.h: Definitions for Stokes Image utilities 00002 //# Copyright (C) 1996,1997,1998,1999 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library 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 Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be adressed 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 //# 00027 //# $Id$ 00028 00029 #ifndef SYNTHESIS_STOKESIMAGEUTIL_H 00030 #define SYNTHESIS_STOKESIMAGEUTIL_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/BasicSL/Complex.h> 00034 #include <images/Images/ImageInterface.h> 00035 #include <casa/Quanta/Quantum.h> 00036 #include <ms/MeasurementSets/MeasurementSet.h> 00037 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 00040 // <summary> 00041 // </summary> 00042 00043 // <reviewed reviewer="" date="" tests="" demos=""> 00044 00045 // <prerequisite> 00046 // </prerequisite> 00047 // 00048 // <etymology> 00049 // </etymology> 00050 // 00051 // <synopsis> 00052 // </synopsis> 00053 // 00054 // <example> 00055 // <srcblock> 00056 // </srcblock> 00057 // </example> 00058 // 00059 // <motivation> 00060 // </motivation> 00061 // 00062 // <todo asof=""> 00063 // </todo> 00064 00065 00066 class StokesImageUtil { 00067 00068 public: 00069 00070 enum PolRep { 00071 CIRCULAR=0, 00072 LINEAR 00073 }; 00074 // Make a Gaussian PSF 00075 //<group> 00076 static void MakeGaussianPSF(ImageInterface<Float>& psf, Vector<Float>& beam, 00077 Bool norm=False); 00078 static void MakeGaussianPSF(ImageInterface<Float>& psf, 00079 Quantity& bmaj, Quantity& bmin, Quantity& bpa, 00080 Bool norm=False); 00081 //</group> 00082 00083 // Fit a Gaussian PSF 00084 //<group> 00085 static Bool FitGaussianPSF(ImageInterface<Float>& psf, Vector<Float>& beam); 00086 static Bool FitGaussianPSF(ImageInterface<Float>& psf, GaussianBeam& beam); 00087 static Bool FitGaussianPSF(ImageInterface<Float>& psf, ImageBeamSet& beam); 00088 //</group> 00089 // Locat peak of PSF return pos, peak and first plane that satisfies 00090 // peak >0.9 00091 00092 static void locatePeakPSF(ImageInterface<Float>& psf, Int& xpos, Int& ypos, 00093 Float& amp, Matrix<Float>& psfplane); 00094 00095 // Convolve a Stokes Image in place 00096 //<group> 00097 static void Convolve(ImageInterface<Float>& image, 00098 ImageInterface<Float>& psf); 00099 static void Convolve(ImageInterface<Float>& image, Float bmaj, 00100 Float bmin, Float bpa, Bool normalizeVolume=False); 00101 static void Convolve(ImageInterface<Float>& image, 00102 GaussianBeam& beam, 00103 Bool normalizeVolume=False); 00104 static void Convolve(ImageInterface<Float>& image, 00105 ImageBeamSet& beams, 00106 Bool normalizeVolume=False); 00107 //</group> 00108 00109 00110 // Zero selected planes of a Stokes image 00111 static void Zero(ImageInterface<Float>& image, Vector<Bool>& mask); 00112 00113 // Mask mask iif(image > threshhold), where threshhold is in image's units. 00114 static void MaskFrom(ImageInterface<Float>& mask, 00115 ImageInterface<Float>& image, 00116 const Double threshhold); 00117 00118 // This version uses threshold.get("Jy").getValue(). 00119 static void MaskFrom(ImageInterface<Float>& mask, 00120 ImageInterface<Float>& image, 00121 const Quantity& threshold); 00122 00123 00124 // Zero pixels where Stokes I < some value 00125 static void MaskOnStokesI(ImageInterface<Float>& image, const Quantity& threshold); 00126 00127 // Make a box mask 00128 static void BoxMask(ImageInterface<Float>& mask, const IPosition& blc, 00129 const IPosition& trc, const Float value); 00130 00131 // Constrain a Stokes Image 00132 static void Constrain(ImageInterface<Float>& image); 00133 00134 // Convert from Stokes Image to "correlation" image. 00135 static void From(ImageInterface<Complex>& out, 00136 const ImageInterface<Float>& in); 00137 00138 // Convert to Stokes Image from "correlation" image. 00139 static void To(ImageInterface<Float>& out, ImageInterface<Complex>& in); 00140 00141 // Direct copy from Float to Complex with 00142 static void directCFromR(ImageInterface<Complex>& out, 00143 const ImageInterface<Float>& in); 00144 00145 // Direct copy To Float... 00146 static void directCToR(ImageInterface<Float>& out, ImageInterface<Complex>& in); 00147 00148 00149 // Convert to Stokes PSF 00150 static void ToStokesPSF(ImageInterface<Float>& out, ImageInterface<Complex>& in); 00151 00152 // Find the mapping from pixel on the Stokes Axis to I,Q,U,V 00153 static Int StokesPolMap(Vector<Int>& map, const CoordinateSystem& coord); 00154 00155 // Find the mapping from pixel on the Stokes Axis to either XX,XY,YX,YY 00156 // of LL, LR, RL, RR. Return type as well: Linear:1, Circular 0 00157 static Int CStokesPolMap(Vector<Int>& map, StokesImageUtil::PolRep& polframe, 00158 const CoordinateSystem& coord); 00159 00160 // Find all mappings from coordinate to axis number 00161 static Bool StokesMap(Vector<Int>& map, const CoordinateSystem& coord); 00162 00163 //Create a CoordinateSystem from a MeasurementSet and other info 00164 static CoordinateSystem StokesCoordFromMS(const IPosition& shape, 00165 Vector<Double>& deltas, 00166 MeasurementSet& ms); 00167 00168 // Create a CoordinateSystem from a MeasurementSet and other info 00169 static CoordinateSystem StokesCoordFromMS(const IPosition& shape, 00170 Vector<Double>& deltas, 00171 MeasurementSet& ms, 00172 Vector<Int>& whichStokes, 00173 Bool doCStokes=False, 00174 Int fieldID=0, Int SPWID=0, 00175 Int feedID=0); 00176 00177 // Create a CoordinateSystem 00178 static CoordinateSystem CStokesCoord(//const IPosition& shape, 00179 const CoordinateSystem& coord, 00180 Vector<Int>& whichStokes, 00181 StokesImageUtil::PolRep polRep=StokesImageUtil::CIRCULAR); 00182 /* 00183 static CoordinateSystem 00184 CStokesCoordFromImage(const ImageInterface<Complex>& image, 00185 Vector<Int>& whichStokes, 00186 SkyModel::PolRep polRep); 00187 */ 00188 // Change the stokes representation (but not the data!) 00189 static void changeCStokesRep(ImageInterface<Complex>& image, 00190 StokesImageUtil::PolRep polRep); 00191 00192 static void changeLabelsStokesToCorrStokes(StokesCoordinate &stokesCoord, 00193 StokesImageUtil::PolRep polRep, 00194 Vector<Int>&whichStokes); 00195 00196 // check to see if Image coordinates have the standard order: 00197 // Direction, Stokes, Spectral. Returns false if this is not 00198 // the order, or if any are missing 00199 // <group> 00200 static Bool standardImageCoordinates(const CoordinateSystem& coords); 00201 static Bool standardImageCoordinates(const ImageInterface<Complex>& image); 00202 static Bool standardImageCoordinates(const ImageInterface<Float>& image); 00203 // </group> 00204 00205 }; 00206 00207 } //# NAMESPACE CASA - END 00208 00209 #endif 00210 00211