ImageMetaDataRW.h
Go to the documentation of this file.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
00028 #ifndef IMAGES_IMAGEMETADATARW_H
00029 #define IMAGES_IMAGEMETADATARW_H
00030
00031 #include <imageanalysis/ImageAnalysis/ImageMetaDataBase.h>
00032
00033 #include <casa/aips.h>
00034
00035 #include <memory>
00036
00037 namespace casa {
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 class ImageMetaDataRW : public ImageMetaDataBase {
00079
00080 public:
00081
00082 ImageMetaDataRW() = delete;
00083
00084 ImageMetaDataRW(SPIIF image);
00085 ImageMetaDataRW(SPIIC image);
00086
00087
00088
00089 Bool remove(const String& key);
00090
00091
00092
00093
00094 Bool removeMask(const String& maskName);
00095
00096 Record toRecord(Bool verbose) const;
00097
00098
00099 Bool add(const String& key, const ValueHolder& value);
00100
00101
00102 Bool set(const String& key, const ValueHolder& value);
00103
00104
00105 void setCsys(const Record& coordinates);
00106
00107 protected:
00108
00109 SPCIIF _getFloatImage() const {return _floatImage;}
00110
00111 SPCIIC _getComplexImage() const {return _complexImage;}
00112
00113 const ImageInfo& _getInfo() const;
00114
00115 const CoordinateSystem& _getCoords() const;
00116
00117 Vector<String> _getAxisNames() const;
00118
00119 Vector<String> _getAxisUnits() const;
00120
00121 GaussianBeam _getBeam() const;
00122
00123 String _getBrightnessUnit() const;
00124
00125 String _getImType() const;
00126
00127 vector<Quantity> _getIncrements() const;
00128
00129 Vector<String> _getMasks() const;
00130
00131 String _getObject() const;
00132
00133 String _getEquinox() const;
00134
00135 MEpoch _getObsDate() const;
00136
00137 String _getObserver() const;
00138
00139 String _getProjection() const;
00140
00141 String _getRefFreqType() const;
00142
00143 Vector<Double> _getRefPixel() const;
00144
00145 Vector<Quantity> _getRefValue() const;
00146
00147 Quantity _getRestFrequency() const;
00148
00149 String _getTelescope() const;
00150
00151 Record _getStatistics() const;
00152
00153 Vector<String> _getStokes() const;
00154
00155 private:
00156 SPIIF _floatImage;
00157 SPIIC _complexImage;
00158
00159
00160
00161
00162 mutable String _bunit, _imtype, _object, _equinox, _observer, _projection,
00163 _reffreqtype, _telescope;
00164 mutable MEpoch _obsdate;
00165 mutable Quantity _restFreq;
00166 mutable Vector<String> _masks, _stokes;
00167 mutable GaussianBeam _beam;
00168 mutable Vector<String> _axisNames, _axisUnits;
00169 mutable Vector<Double> _refPixel;
00170 mutable vector<Quantity> _refVal, _increment;
00171 mutable Record _header, _stats;
00172
00173 std::unique_ptr<CoordinateSystem> _makeCoordinateSystem(
00174 const Record& coordinates, const IPosition& shape
00175 );
00176
00177 void _setCoordinateValue(const String& key, const ValueHolder& value);
00178
00179 String _getString(const String& key, const ValueHolder& value) const;
00180
00181 void _setUserDefined(const String& key, const ValueHolder& v);
00182
00183 Bool _setUnit(const String& unit);
00184
00185 Bool _setCsys(const CoordinateSystem& csys);
00186
00187 Bool _setImageInfo(const ImageInfo& info);
00188
00189 const TableRecord _miscInfo() const;
00190
00191 void _setMiscInfo(const TableRecord& rec);
00192
00193 Bool _hasRegion(const String& maskName) const;
00194
00195 static Quantity _getQuantity(const ValueHolder& v);
00196
00197 Bool _isWritable() const;
00198
00199 template <class T, class U> void _modHistory(
00200 const String& func, const String& keyword,
00201 const T& oldVal, const U& newVal
00202 );
00203
00204 template <class T> void _addHistory(
00205 const String& func, const String& keyword, const T& newVal
00206 );
00207
00208 void _toHistory(const String& origin, const String& record);
00209
00210 template <class T> static String _quotify(const T& val);
00211 };
00212
00213 }
00214
00215 #endif