Source
81
81
RegionTextParser() = delete;
82
82
83
83
// <group>
84
84
// differentiating between the filename and simple text constructors
85
85
// <src>globalOverrideChans</src> override all spectral selections in the file
86
86
// or text by using this channel selection<src>
87
87
// <src>globalOverrideStokes</src> override all correlation selections in the file
88
88
// or text by using this polarization selection<src>
89
89
// <src>prependRegion</src> allows one to specify region(s) that will be prepended to
90
90
// any text in <src>filename</src> or <src>text</src>
91
+
// <src>requireLCRegion</src> forces the parser to create AsciiAnnotationFileLines
92
+
// only from AnnRegions whose LC region is not outside the image
91
93
RegionTextParser(
92
94
const casacore::String& filename, const casacore::CoordinateSystem& csys,
93
95
const casacore::IPosition& imShape, const casacore::Int requireAtLeastThisVersion,
94
96
const casacore::String& prependRegion="",
95
97
const casacore::String& globalOverrideChans="",
96
98
const casacore::String& globalOverrrideStokes="",
97
-
casacore::Bool verbose=true
99
+
casacore::Bool verbose=true,
100
+
casacore::Bool requireLCRegion=true
98
101
);
99
102
100
103
RegionTextParser(
101
-
const casacore::CoordinateSystem& csys, const casacore::IPosition& imShape, const casacore::String& text,
104
+
const casacore::CoordinateSystem& csys,
105
+
const casacore::IPosition& imShape,
106
+
const casacore::String& text,
102
107
const casacore::String& prependRegion="",
103
-
const casacore::String& globalOverrideChans="", const casacore::String& globalOverrrideStokes="",
104
-
casacore::Bool verbose=true
108
+
const casacore::String& globalOverrideChans="",
109
+
const casacore::String& globalOverrrideStokes="",
110
+
casacore::Bool verbose=true,
111
+
casacore::Bool requireLCRegion=true
105
112
);
106
113
//</group>
107
114
108
115
~RegionTextParser();
109
116
110
117
RegionTextParser& operator=(const RegionTextParser&) = delete;
111
118
112
119
casacore::Int getFileVersion() const;
113
120
114
121
std::vector<AsciiAnnotationFileLine> getLines() const;
137
144
casacore::Vector<AnnotationBase::Keyword> _globalKeysToApply;
138
145
casacore::Int _fileVersion;
139
146
casacore::IPosition _imShape;
140
147
casacore::uInt _regions;
141
148
casacore::Bool _verbose = true;
142
149
143
150
std::shared_ptr<std::pair<casacore::MFrequency, casacore::MFrequency> > _overridingFreqRange;
144
151
145
152
std::shared_ptr<casacore::Vector<casacore::Stokes::StokesTypes> > _overridingCorrRange;
146
153
147
-
void _parse(const casacore::String& contents, const casacore::String& fileDesc);
154
+
void _parse(const casacore::String& contents, const casacore::String& fileDesc, casacore::Bool requireLCRegion);
148
155
149
156
casacore::Array<casacore::String> _extractTwoPairs(casacore::uInt& end, const casacore::String& string) const;
150
157
151
158
// extract s1 and s2 from a string of the form "[s1, s2]"
152
159
static casacore::Vector<casacore::String> _extractSinglePair(const casacore::String& string);
153
160
154
161
void _addLine(const AsciiAnnotationFileLine& line);
155
162
156
163
AnnotationBase::Type _getAnnotationType(
157
164
casacore::Vector<casacore::Quantity>& qDirs,
158
-
std::vector<casacore::Quantity>& qunatities,
165
+
std::vector<casacore::Quantity>& quantities,
159
166
casacore::String& textString,
160
167
casacore::String& consumeMe, const casacore::String& preamble
161
168
) const;
162
169
163
170
ParamSet _getCurrentParamSet(
164
171
casacore::Bool& spectralParmsUpdated, ParamSet& newParams,
165
172
casacore::String& consumeMe, const casacore::String& preamble
166
173
) const;
167
174
168
175
void _createAnnotation(
169
176
const AnnotationBase::Type annType,
170
177
//const casacore::Vector<casacore::MDirection> dirs,
171
178
const casacore::Vector<casacore::Quantity>& qDirs,
172
179
const std::pair<casacore::Quantity, casacore::Quantity>& qFreqs,
173
180
const std::vector<casacore::Quantity>& quantities,
174
181
const casacore::String& textString,
175
182
const ParamSet& currentParamSet,
176
183
const casacore::Bool annOnly, const casacore::Bool isDifference,
177
-
const casacore::String& preamble
184
+
const casacore::String& preamble, casacore::Bool requireLCRegion
178
185
);
179
186
180
187
std::pair<casacore::Quantity, casacore::Quantity> _quantitiesFromFrequencyString(
181
188
const casacore::String& freqString, const casacore::String& preamble
182
189
) const;
183
190
184
191
static casacore::String _doLabel(casacore::String& consumeMe, const casacore::String& logPreamble);
185
192
186
193
static casacore::String _getKeyValue(casacore::String& consumeMe, const casacore::String& preamble);
187
194