00001 #ifndef IMAGEANALYSIS_IMAGEMASKEDPIXELREPLACER_H 00002 #define IMAGEANALYSIS_IMAGEMASKEDPIXELREPLACER_H 00003 00004 #include <imageanalysis/ImageAnalysis/ImageTask.h> 00005 #include <casa/namespace.h> 00006 00007 namespace casa { 00008 00009 template <class T> class ImageMaskedPixelReplacer : public ImageTask<T> { 00010 // <summary> 00011 // Top level interface for replacing masked pixel values of an image 00012 // </summary> 00013 00014 // <reviewed reviewer="" date="" tests="" demos=""> 00015 // </reviewed> 00016 00017 // <prerequisite> 00018 // </prerequisite> 00019 00020 // <etymology> 00021 // Replace masked pixel values of an image 00022 // </etymology> 00023 00024 // <synopsis> 00025 // Top level interface for replacing masked pixel values of an image 00026 // </synopsis> 00027 00028 public: 00029 00030 // The total pixel mask is calculated by a logical OR of the existing default 00031 // image pixel mask when the mask specified by <src>mask</src>. Pixel replacement 00032 // is done in place; ie on the image passed to the constructor. No copy of that image 00033 // is made. 00034 ImageMaskedPixelReplacer( 00035 const SPIIT image, 00036 const Record *const ®ion, 00037 const String& maskInp 00038 ); 00039 00040 ~ImageMaskedPixelReplacer() {} 00041 00042 // Perform the substitution. expr is the LEL expression to use for the new pixel values. 00043 // If updateMask is True, the False mask values will be changed to True. 00044 void replace(const String& expr, Bool updateMask, Bool verbose); 00045 00046 String getClass() const; 00047 00048 protected: 00049 inline CasacRegionManager::StokesControl _getStokesControl() const { 00050 return CasacRegionManager::USE_ALL_STOKES; 00051 } 00052 00053 inline vector<Coordinate::Type> _getNecessaryCoordinates() const { 00054 return vector<Coordinate::Type>(0); 00055 } 00056 00057 private: 00058 static const String _class; 00059 00060 // This class holds a writable image object to write pixel value 00061 // changes to. 00062 const SPIIT _image; 00063 00064 // disallow default constructor 00065 ImageMaskedPixelReplacer(); 00066 00067 static void _makeRegionBlock( 00068 PtrBlock<const ImageRegion*>& imageRegions, 00069 const Record& regions 00070 ); 00071 00072 }; 00073 } 00074 00075 #ifndef AIPS_NO_TEMPLATE_SRC 00076 #include <imageanalysis/ImageAnalysis/ImageMaskedPixelReplacer.tcc> 00077 #endif 00078 00079 #endif