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_IMAGEMETADATABASE_H
00029 #define IMAGES_IMAGEMETADATABASE_H
00030
00031 #include <images/Images/ImageInterface.h>
00032 #include <imageanalysis/ImageTypedefs.h>
00033 #include <casa/aips.h>
00034
00035 namespace casa {
00036
00037
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 class ImageMetaDataBase {
00065
00066 public:
00067
00068 const static String MASKS;
00069
00070 virtual ~ImageMetaDataBase() {}
00071
00072 CoordinateSystem coordsys(const vector<Int>& axes) const;
00073
00074 uInt nChannels() const;
00075
00076
00077 Bool isChannelNumberValid(const uInt chan) const;
00078
00079
00080
00081
00082
00083
00084
00085 Int stokesPixelNumber(const String& stokesString) const;
00086
00087
00088
00089
00090 String stokesAtPixel(const uInt pixel) const;
00091
00092
00093 uInt nStokes() const;
00094
00095
00096 Bool isStokesValid(const String& stokesString) const;
00097
00098
00099
00100
00101
00102 Vector<Int> directionShape() const;
00103
00104
00105
00106
00107 Bool areChannelAndStokesValid(
00108 String& message, const uInt chan, const String& stokesString
00109 ) const;
00110
00111
00112 Record* getBoundingBox(const Record& region) const;
00113
00114
00115 virtual Record toRecord(Bool verbose) const = 0;
00116
00117
00118 ValueHolder getFITSValue(const String& key) const;
00119
00120
00121
00122
00123
00124
00125
00126
00127 Record toWorld(
00128 const Vector<double>& value, const String& format = "n",
00129 Bool doVelocity=True, const String& dirFrame="cl",
00130 const String& freqFrame="cl"
00131 ) const;
00132
00133 protected:
00134 const static String _BEAMMAJOR, _BEAMMINOR, _BEAMPA, _BMAJ, _BMIN, _BPA,
00135 _BUNIT, _CDELT, _CRPIX, _CRVAL, _CTYPE, _CUNIT, _DATAMAX, _DATAMIN,
00136 _EPOCH, _EQUINOX, _IMTYPE, _MAXPIXPOS, _MAXPOS, _MINPIXPOS,
00137 _MINPOS, _OBJECT, _OBSDATE, _OBSERVER, _PROJECTION,
00138 _RESTFREQ, _REFFREQTYPE, _SHAPE, _TELESCOPE;
00139
00140 virtual SPCIIF _getFloatImage() const = 0;
00141
00142 virtual SPCIIC _getComplexImage() const = 0;
00143
00144 ImageMetaDataBase() : _log() {}
00145
00146 LogIO& _getLog() { return _log; }
00147
00148 virtual const ImageInfo& _getInfo() const = 0;
00149
00150 virtual const CoordinateSystem& _getCoords() const = 0;
00151
00152 virtual Vector<String> _getAxisNames() const = 0;
00153
00154 virtual Vector<String> _getAxisUnits() const = 0;
00155
00156 virtual GaussianBeam _getBeam() const = 0;
00157
00158 virtual String _getBrightnessUnit() const = 0;
00159
00160 virtual String _getImType() const = 0;
00161
00162 virtual vector<Quantity> _getIncrements() const = 0;
00163
00164 virtual Vector<String> _getMasks() const = 0;
00165
00166 virtual String _getObject() const = 0;
00167
00168 virtual String _getEquinox() const = 0;
00169
00170 virtual MEpoch _getObsDate() const = 0;
00171
00172 String _getEpochString() const;
00173
00174 virtual String _getObserver() const = 0;
00175
00176 virtual String _getProjection() const;
00177
00178 virtual String _getRefFreqType() const = 0;
00179
00180 virtual Vector<Double> _getRefPixel() const = 0;
00181
00182 virtual Vector<Quantity> _getRefValue() const = 0;
00183
00184 virtual Quantity _getRestFrequency() const = 0;
00185
00186 IPosition _getShape() const;
00187
00188 virtual Record _getStatistics() const = 0;
00189
00190 virtual String _getTelescope() const = 0;
00191
00192 Record _makeHeader() const;
00193
00194 void _toLog(const Record& header) const;
00195
00196 uInt _getAxisNumber(const String& key) const;
00197
00198 Record _calcStats() const;
00199
00200 const TableRecord _miscInfo() const;
00201
00202 uInt _ndim() const;
00203
00204 virtual Vector<String> _getStokes() const = 0;
00205
00206 private:
00207
00208 mutable LogIO _log;
00209
00210 mutable IPosition _shape;
00211
00212
00213 void _fieldToLog(const Record& header, const String& field, Int precision=-1) const;
00214
00215 String _doStandardFormat(Double value, const String& unit) const;
00216
00217 template <class T> Record _calcStatsT(
00218 SHARED_PTR<const ImageInterface<T> > image
00219 ) const;
00220
00221 Record _worldVectorToRecord(
00222 const CoordinateSystem& csys, const Vector<Double>& world, Int c,
00223 const String& format,
00224 Bool isAbsolute, Bool showAsAbsolute, Bool doVelocity,
00225 MDirection::Types dirFrame, MFrequency::Types freqFrame
00226 ) const;
00227
00228 Record _worldVectorToMeasures(
00229 const CoordinateSystem& csys,
00230 const Vector<Double>& world, Int c, Bool abs, Bool doVelocity,
00231 MDirection::Types dirFrame, MFrequency::Types freqFrame
00232 ) const;
00233
00234 };
00235
00236 }
00237
00238 #endif