00001 #ifndef IMAGEANALYSIS_PIXELVALUEMANIPULATOR_H
00002 #define IMAGEANALYSIS_PIXELVALUEMANIPULATOR_H
00003
00004 #include <imageanalysis/ImageAnalysis/ImageTask.h>
00005
00006 #include <imageanalysis/ImageAnalysis/ImageCollapserData.h>
00007 #include <imageanalysis/ImageAnalysis/PixelValueManipulatorData.h>
00008
00009
00010 namespace casa {
00011
00012 template <class T> class PixelValueManipulator : public ImageTask<T> {
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 public:
00035
00036 PixelValueManipulator() = delete;
00037
00038
00039
00040
00041 PixelValueManipulator(
00042 const SPCIIT image, const Record *const regionRec,
00043 const String& mask, Bool verboseDuringConstruction=True
00044 );
00045
00046 ~PixelValueManipulator() {}
00047
00048 static void addNoise(
00049 SPIIT image, const String& type, const Record& region, const Vector<Double>& pars,
00050 Bool zero, const std::pair<Int, Int> *const &seeds
00051 );
00052
00053
00054
00055
00056
00057
00058 static Record* coordMeasures(
00059 Quantum<T>& intensity, Record& direction,
00060 Record& frequency, Record& velocity,
00061 SPCIIT image, const Vector<Double>& pixel,
00062 const String& dirFrame, const String& freqFrame
00063 );
00064
00065
00066
00067 void setAxes(const IPosition& axes, Bool invert=False);
00068
00069
00070
00071
00072
00073 Record get() const;
00074
00075
00076
00077
00078
00079 static Record* getSlice(
00080 SPCIIT image, const Vector<Double>& x, const Vector<Double>& y,
00081 const Vector<Int>& axes, const Vector<Int>& coord,
00082 Int npts=0, const String& method="linear"
00083 );
00084
00085 static void put(
00086 SPIIT image, const Array<T>& pixelsArray, const Vector<Int>& blc,
00087 const Vector<Int>& inc, Bool list,
00088 Bool locking, Bool replicate
00089 );
00090
00091 static Bool putRegion(
00092 SPIIT image, const Array<T>& pixels,
00093 const Array<Bool>& mask, Record& region, Bool list,
00094 Bool usemask, Bool replicateArray
00095 );
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 Record getProfile(
00126 uInt axis, const String& function, const String& unit,
00127 PixelValueManipulatorData::SpectralType specType=PixelValueManipulatorData::DEFAULT,
00128 const Quantity *const restFreq=nullptr, const String& frame=""
00129 );
00130
00131 Record getProfile(
00132 uInt axis, ImageCollapserData::AggregateType function, const String& unit,
00133 PixelValueManipulatorData::SpectralType specType=PixelValueManipulatorData::DEFAULT,
00134 const Quantity *const restFreq=nullptr, const String& frame=""
00135 );
00136
00137 String getClass() const { return _className; }
00138
00139
00140
00141 static void insert(
00142 ImageInterface<T>& target, const ImageInterface<T>& image, const Record& region,
00143 const Vector<Double>& locatePixel, Bool verbose
00144 );
00145
00146
00147
00148
00149 static void makeRegionBlock(
00150 PtrBlock<const ImageRegion*>& regions,
00151 const Record& Regions
00152 );
00153
00154 Record pixelValue(const Vector<Int>& pixel) const;
00155
00156 void pixelValue(
00157 Bool& offImage, Quantum<T>& value, Bool& mask,
00158 Vector<Int>& pos
00159 ) const;
00160
00161
00162 static Bool set(
00163 SPIIF image, const String& pixels, const Int pixelmask,
00164 Record& region, const Bool list = false
00165 );
00166
00167
00168 void setRegionName(const String& rname) { _regionName = rname; }
00169
00170 protected:
00171 CasacRegionManager::StokesControl _getStokesControl() const {
00172 return CasacRegionManager::USE_ALL_STOKES;
00173 }
00174
00175 std::vector<Coordinate::Type> _getNecessaryCoordinates() const {
00176 return std::vector<Coordinate::Type>();
00177 }
00178
00179 Bool _hasLogfileSupport() const { return True; }
00180
00181 Bool _supportsMultipleRegions() const {return True;}
00182
00183 private:
00184 IPosition _axes, _lastChunkShape;
00185 String _regionName;
00186 const static String _className;
00187
00188 void _checkUnit(
00189 const String& unit, const CoordinateSystem& csys,
00190 PixelValueManipulatorData::SpectralType specType
00191 ) const;
00192
00193 Record _doWorld(
00194 SPIIT collapsed, const String& unit,
00195 PixelValueManipulatorData::SpectralType specType,
00196 const Quantity *const restFreq, const String& frame,
00197 uInt axis
00198 ) const;
00199
00200 void _doNoncomformantUnit(
00201 Vector<Double>& coords, const CoordinateSystem& csys,
00202 const String& unit, PixelValueManipulatorData::SpectralType specType,
00203 const Quantity *const restFreq, const String& axisUnit
00204 ) const;
00205
00206 Vector<uInt> _npts(uInt axis) const;
00207 };
00208
00209 }
00210
00211 #ifndef AIPS_NO_TEMPLATE_SRC
00212 #include <imageanalysis/ImageAnalysis/PixelValueManipulator.tcc>
00213 #endif //# AIPS_NO_TEMPLATE_SRC
00214
00215 #endif