Line data Source code
1 : #ifndef IMAGEANALYSIS_IMAGEMASKEDPIXELREPLACER_H 2 : #define IMAGEANALYSIS_IMAGEMASKEDPIXELREPLACER_H 3 : 4 : #include <imageanalysis/ImageAnalysis/ImageTask.h> 5 : #include <casacore/casa/namespace.h> 6 : 7 : namespace casa { 8 : 9 : template <class T> class ImageMaskedPixelReplacer : public ImageTask<T> { 10 : // <summary> 11 : // Top level interface for replacing masked pixel values of an image 12 : // </summary> 13 : 14 : // <reviewed reviewer="" date="" tests="" demos=""> 15 : // </reviewed> 16 : 17 : // <prerequisite> 18 : // </prerequisite> 19 : 20 : // <etymology> 21 : // Replace masked pixel values of an image 22 : // </etymology> 23 : 24 : // <synopsis> 25 : // Top level interface for replacing masked pixel values of an image 26 : // </synopsis> 27 : 28 : public: 29 : 30 : ImageMaskedPixelReplacer() = delete; 31 : 32 : // The total pixel mask is calculated by a logical OR of the existing default 33 : // image pixel mask when the mask specified by <src>mask</src>. Pixel replacement 34 : // is done in place; ie on the image passed to the constructor. No copy of that image 35 : // is made. 36 : ImageMaskedPixelReplacer( 37 : const SPIIT image, 38 : const casacore::Record *const ®ion = nullptr, 39 : const casacore::String& maskInp = "" 40 : ); 41 : 42 0 : ~ImageMaskedPixelReplacer() {} 43 : 44 : // Perform the substitution. expr is the LEL expression to use for the new pixel values. 45 : // If updateMask is true, the false mask values will be changed to true. 46 : void replace(const casacore::String& expr, casacore::Bool updateMask, casacore::Bool verbose); 47 : 48 : casacore::String getClass() const; 49 : 50 : protected: 51 0 : inline CasacRegionManager::StokesControl _getStokesControl() const { 52 0 : return CasacRegionManager::USE_ALL_STOKES; 53 : } 54 : 55 0 : inline std::vector<casacore::Coordinate::Type> _getNecessaryCoordinates() const { 56 0 : return std::vector<casacore::Coordinate::Type>(0); 57 : } 58 : 59 : private: 60 : static const casacore::String _class; 61 : 62 : // This class holds a writable image object to write pixel value 63 : // changes to. 64 : const SPIIT _image; 65 : 66 : static void _makeRegionBlock( 67 : casacore::PtrBlock<const casacore::ImageRegion*>& imageRegions, 68 : const casacore::Record& regions 69 : ); 70 : }; 71 : } 72 : 73 : #ifndef AIPS_NO_TEMPLATE_SRC 74 : #include <imageanalysis/ImageAnalysis/ImageMaskedPixelReplacer.tcc> 75 : #endif 76 : 77 : #endif