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 #ifndef IMAGEANALYSIS_CASACREGIONMANAGER_H
00028 #define IMAGEANALYSIS_CASACREGIONMANAGER_H
00029
00030 #include <images/Regions/RegionManager.h>
00031
00032 #include <imageanalysis/IO/RegionTextParser.h>
00033
00034 namespace casa {
00035
00046 class CasacRegionManager: public RegionManager {
00047
00048 public:
00049 const static String ALL;
00050
00051 enum StokesControl {
00052 USE_FIRST_STOKES,
00053 USE_ALL_STOKES
00054 };
00055
00056 CasacRegionManager();
00057
00058 CasacRegionManager(const CoordinateSystem& csys);
00059
00060 CasacRegionManager(const CasacRegionManager&) = delete;
00061
00062 ~CasacRegionManager();
00063
00064 CasacRegionManager& operator=(const CasacRegionManager&) = delete;
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 Record fromBCS(
00088 String& diagnostics, uInt& nSelectedChannels, String& stokes,
00089 const Record * const ®ionPtr, const String& regionName,
00090 const String& chans, const StokesControl stokesControl,
00091 const String& box, const IPosition& imShape, const String& imageName="",
00092 Bool verbose=True
00093 );
00094
00095 ImageRegion fromBCS(
00096 String& diagnostics, uInt& nSelectedChannels, String& stokes,
00097 const String& chans, const StokesControl stokesControl,
00098 const String& box, const IPosition& imShape
00099 ) const;
00100
00101 static Record regionFromString(
00102 const CoordinateSystem& csys, const String& regionStr,
00103 const String& imageName, const IPosition& imShape
00104
00105
00106 );
00107
00108
00109
00110
00111
00112 vector<uInt> setSpectralRanges(
00113 uInt& nSelectedChannels,
00114 const Record *const regionRec, const IPosition& imShape=IPosition(0)
00115 ) const;
00116
00117 vector<uInt> setSpectralRanges(
00118 String specification, uInt& nSelectedChannels,
00119
00120
00121
00122
00123 const IPosition& imShape=IPosition(0)
00124 ) const;
00125
00126 private:
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 String _pairsToString(const vector<uInt>& pairs) const;
00139
00140 vector<uInt> _setPolarizationRanges(
00141 String& specification, const String& firstStokes, const uInt nStokes,
00142 const StokesControl stokesControl
00143 ) const;
00144
00145 vector<Double> _setBoxCorners(const String& box) const;
00146
00147 ImageRegion _fromBCS(
00148 String& diagnostics,
00149 const vector<Double>& boxCorners, const vector<uInt>& chanEndPts,
00150 const vector<uInt>& polEndPts, const IPosition imShape
00151 ) const;
00152
00153 static void _setRegion(
00154 Record& regionRecord, String& diagnostics,
00155 const Record* regionPtr
00156 );
00157
00158 String _stokesFromRecord(
00159 const Record& region, const StokesControl stokesControl, const IPosition& shape
00160 ) const;
00161
00162 void _setRegion(
00163 Record& regionRecord, String& diagnostics,
00164 const String& regionName, const IPosition& imShape,
00165 const String& imageName,
00166 const String& prependBox,
00167 const String& globalOverrideChans,
00168 const String& globalStokesOverride
00169 );
00170
00171 vector<uInt> _spectralRangeFromRangeFormat(
00172 uInt& nSelectedChannels, const String& specification,
00173 const IPosition& imShape
00174
00175 ) const;
00176
00177 vector<uInt> _spectralRangeFromRegionRecord(
00178 uInt& nSelectedChannels, const Record *const regionRec,
00179 const IPosition& imShape
00180 ) const;
00181
00182
00183
00184
00185 Bool _supports2DBox(Bool except) const;
00186
00187 vector<uInt> _initSpectralRanges(uInt& nSelectedChannels, const IPosition& imShape) const;
00188 };
00189
00190 }
00191 #endif
00192