00001 #ifndef IMAGEANALYSIS_IMAGEMOMENTSTASK_H 00002 #define IMAGEANALYSIS_IMAGEMOMENTSTASK_H 00003 00004 #include <imageanalysis/ImageAnalysis/ImageTask.h> 00005 00006 #include <casa/namespace.h> 00007 00008 namespace casa { 00009 00010 class ImageMomentsProgressMonitor; 00011 00012 template <class T> class ImageMomentsTask : public ImageTask<T> { 00013 // <summary> 00014 // Top level interface for creating image moments 00015 // </summary> 00016 00017 // <reviewed reviewer="" date="" tests="" demos=""> 00018 // </reviewed> 00019 00020 // <prerequisite> 00021 // </prerequisite> 00022 00023 // <etymology> 00024 // Rebins an image to larger pixels. 00025 // </etymology> 00026 00027 // <synopsis> 00028 // Top level interface for rebinning images. 00029 // </synopsis> 00030 00031 public: 00032 00033 ImageMomentsTask() = delete; 00034 00035 // overwrite only applies to the smooth image. The moment images should 00036 // be removed if they exist. 00037 ImageMomentsTask( 00038 const SPCIIT image, const Record *const region, 00039 const String& mask, const String& smoothImageName, 00040 Bool overwrite 00041 ); 00042 00043 ~ImageMomentsTask() {} 00044 00045 String getClass() const { const static String s = "ImageMomentsTask"; return s; } 00046 00047 // the first requested moments image is returned. 00048 SPIIT makeMoments() const; 00049 00050 // set moments axis number 00051 void setAxis(Int axis); 00052 00053 // set the include or exclude range. An empty vector means no range is set, 00054 // a one element vector means -range[0] to range[0] is set. If the vector 00055 // contains more than two elements, an exception is thrown. If isInclude is 00056 // True, then the range is the range to be included, excluded if False. 00057 void setIncludeExcludeRange(const std::vector<T>& range, Bool isInclude); 00058 00059 // Set smoothing kernels 00060 void setKernels(const std::vector<String>& kernels) { _kernels = kernels; } 00061 00062 // set smoothing kernel widths 00063 void setKernelWidths(const vector<Quantity>& kernelWidths) { 00064 _kernelWidths = kernelWidths; 00065 } 00066 00067 // set moment methods 00068 void setMethods(const vector<String>& methods) { _methods = methods; } 00069 00070 // set moments to compute 00071 void setMoments(const Vector<Int>& moments); 00072 00073 void setMomentsProgressMonitor(ImageMomentsProgressMonitor* progressMonitor ) { 00074 _imageMomentsProgressMonitor = progressMonitor; 00075 } 00076 00077 // set the base name for the moment images. 00078 void setMomentImageName(const String& name) { _momentName = name; } 00079 00080 // Should the moment axis be removed. These rules will be followed: 00081 // If the moment axis is associated with a coordinate with one axis only, 00082 // the axis and its coordinate are physically removed from the output image. Otherwise, 00083 // if <src>remove=True</src> then the output axis is logically removed from the 00084 // the output CoordinateSystem. If <src>remove=False</src> then the axis 00085 // is retained with shape=1 and with its original coordinate information (which 00086 // is probably meaningless). 00087 void setRemoveAxis(Bool remove) { _removeAxis = remove; } 00088 00089 // set smoothing axes 00090 void setSmoothAxes(const std::vector<uInt>& axes); 00091 00092 // set desired signal-to-noise. Less than or equal to zero means 00093 // use the default value. 00094 void setSNR(Double snr) { _snr = snr; } 00095 00096 // set desired standard deviation. Less than or equal to zero means 00097 // set to 0. 00098 void setStdDev(Double stddev) { _stddev = stddev; } 00099 00100 // set the velocity type. 00101 void setVelocityType(const String& type) { _velocityType = type; } 00102 00103 protected: 00104 00105 CasacRegionManager::StokesControl _getStokesControl() const { 00106 return CasacRegionManager::USE_ALL_STOKES; 00107 } 00108 00109 std::vector<Coordinate::Type> _getNecessaryCoordinates() const { 00110 return std::vector<Coordinate::Type>(); 00111 } 00112 00113 Bool _supportsMultipleBeams() const {return True;} 00114 00115 Bool _supportsMultipleRegions() const {return True;} 00116 00117 private: 00118 Vector<Int> _moments; 00119 Int _axis; 00120 std::vector<String> _methods, _kernels; 00121 std::vector<uInt> _smoothAxes; 00122 std::vector<Quantity> _kernelWidths; 00123 std::vector<T> _range; 00124 Bool _isIncludeRange, _removeAxis; 00125 Double _snr, _stddev; 00126 String _velocityType, _momentName; 00127 ImageMomentsProgressMonitor* _imageMomentsProgressMonitor; 00128 00129 void _deleteTempImage(const String& tmpImage) const; 00130 00131 }; 00132 } 00133 00134 #ifndef AIPS_NO_TEMPLATE_SRC 00135 #include <imageanalysis/ImageAnalysis/ImageMomentsTask.tcc> 00136 #endif 00137 00138 #endif