Image2DConvolver.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef IMAGES_IMAGE2DCONVOLVER_H
00029 #define IMAGES_IMAGE2DCONVOLVER_H
00030
00031 #include <imageanalysis/ImageAnalysis/ImageTask.h>
00032
00033 #include <casa/aips.h>
00034 #include <casa/Logging/LogIO.h>
00035 #include <casa/Arrays/Array.h>
00036 #include <scimath/Mathematics/VectorKernel.h>
00037 #include <casa/Quanta/Quantum.h>
00038
00039 namespace casa {
00040
00041 template <class T> class ImageInterface;
00042 template <class T> class Matrix;
00043 template <class T> class Vector;
00044 class String;
00045 class IPosition;
00046 class CoordinateSystem;
00047 class ImageInfo;
00048 class Unit;
00049 class GaussianBeam;
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 template <class T> class Image2DConvolver : public ImageTask<T> {
00093 public:
00094
00095 const static String CLASS_NAME;
00096
00097 Image2DConvolver() = delete;
00098
00099 Image2DConvolver(
00100 const SPCIIT image, const Record *const ®ionPtr,
00101 const String& mask, const String& outname, const Bool overwrite
00102 );
00103
00104 Image2DConvolver(const Image2DConvolver<T> &other) = delete;
00105
00106 ~Image2DConvolver() {}
00107
00108 Image2DConvolver &operator=(const Image2DConvolver<T> &other) = delete;
00109
00110 SPIIT convolve();
00111
00112
00113
00114 void setKernel(
00115 const String& type, const Quantity& major, const Quantity& minor,
00116 const Quantity& pa
00117 );
00118
00119 void setScale(Double d) { _scale = d; }
00120
00121 void setAxes(const std::pair<uInt, uInt>& axes);
00122
00123 void setTargetRes(Bool b) { _targetres = b; }
00124
00125 String getClass() const { return CLASS_NAME; }
00126
00127
00128
00129 void setSuppressWarnings(Bool b) { _suppressWarnings = b; }
00130
00131 protected:
00132
00133 CasacRegionManager::StokesControl _getStokesControl() const {
00134 return CasacRegionManager::USE_ALL_STOKES;
00135 }
00136
00137 vector<Coordinate::Type> _getNecessaryCoordinates() const {
00138 return vector<Coordinate::Type>();
00139 }
00140
00141 inline Bool _supportsMultipleRegions() const {return True;}
00142
00143 private:
00144 VectorKernel::KernelTypes _type;
00145 Double _scale;
00146 Quantity _major, _minor, _pa;
00147 IPosition _axes;
00148 Bool _targetres, _suppressWarnings;
00149
00150 void _checkKernelParameters(
00151 VectorKernel::KernelTypes kernelType,
00152 const Vector<Quantity>& parameters
00153 ) const;
00154
00155 void _convolve(
00156 LogIO& os, SPIIT imageOut, const ImageInterface<T>& imageIn,
00157 VectorKernel::KernelTypes kernelType
00158 ) const;
00159
00160
00161 T _dealWithRestoringBeam (
00162 LogIO& os, String& brightnessUnitOut, GaussianBeam& beamOut,
00163 const Array<T>& kernelArray, const T kernelVolume,
00164 const VectorKernel::KernelTypes kernelType,
00165 const Vector<Quantity>& parameters,
00166 const CoordinateSystem& cSys,
00167 const GaussianBeam& beamIn, const Unit& brightnessUnit,
00168 Bool emitMessage
00169 ) const;
00170
00171 T _fillKernel (
00172 Matrix<T>& kernelMatrix,
00173 VectorKernel::KernelTypes kernelType,
00174 const IPosition& kernelShape,
00175 const Vector<Double>& parameters
00176 ) const;
00177
00178 void _fillGaussian(
00179 T& maxVal, T& volume, Matrix<T>& pixels,
00180 T height, T xCentre, T yCentre,
00181 T majorAxis, T ratio, T positionAngle
00182 ) const;
00183
00184 T _makeKernel(
00185 Array<T>& kernel,
00186 VectorKernel::KernelTypes kernelType,
00187 const std::vector<Quantity>& parameters,
00188 const ImageInterface<T>& inImage
00189 ) const;
00190
00191 IPosition _shapeOfKernel(
00192 const VectorKernel::KernelTypes kernelType,
00193 const Vector<Double>& parameters,
00194 const uInt ndim
00195 ) const;
00196
00197 uInt _sizeOfGaussian(const Double width, const Double nSigma) const;
00198
00199 std::vector<Quantity> _getConvolvingBeamForTargetResolution(
00200 const std::vector<Quantity>& targetBeamParms,
00201 const GaussianBeam& inputBeam
00202 ) const;
00203 };
00204
00205 }
00206
00207 #ifndef CASACORE_NO_AUTO_TEMPLATES
00208 #include <imageanalysis/ImageAnalysis/Image2DConvolver.tcc>
00209 #endif //# CASACORE_NO_AUTO_TEMPLATES
00210 #endif
00211
00212
00213