Line data Source code
1 : //# ImageMetaData.h: Meta information for Images 2 : //# Copyright (C) 2009 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# $Id$ 27 : 28 : #ifndef IMAGEANALYSIS_IMAGEMETADATA_H 29 : #define IMAGEANALYSIS_IMAGEMETADATA_H 30 : 31 : #include <imageanalysis/ImageAnalysis/ImageMetaDataBase.h> 32 : 33 : #include <casacore/images/Images/ImageInterface.h> 34 : #include <casacore/casa/aips.h> 35 : 36 : #include <memory> 37 : 38 : namespace casa { 39 : 40 : // <summary> 41 : // A class in which to store and allow read-only access to image metadata. 42 : // </summary> 43 : 44 : // <use visibility=export> 45 : 46 : // <reviewed reviewer="" date="" tests="" demos=""> 47 : // </reviewed> 48 : 49 : // <prerequisite> 50 : // <li> <linkto class=casacore::ImageInterface>ImageInterface</linkto> 51 : // </prerequisite> 52 : 53 : // <etymology> 54 : // The ImageMetaData class name is derived from its role as holding image metadata. 55 : // </etymology> 56 : 57 : // <synopsis> 58 : // The ImageMetaData object is meant to allow access to image metadata (eg, shape, 59 : // coordinate system info such as spectral and polarization axes numbers, etc). 60 : // </synopsis> 61 : 62 : // <example> 63 : // Construct an object of this class by passing the associated image to the constructor. 64 : // <srcblock> 65 : // casacore::PagedImage<casacore::Float> myImage("myImage"); 66 : // ImageMetaData<casacore::Float> myImageMetaData(myImage); 67 : // </srcblock> 68 : // </example> 69 : 70 : // <motivation> 71 : // This class is meant to provide an object-oriented interface for accessing 72 : // image metadata without polluting the casacore::ImageInterface and CoordinateSystem 73 : // classes with these methods. 74 : // </motivation> 75 : // <todo> 76 : // Merge casacore::ImageInfo class into this class. 77 : // </todo> 78 : 79 : template <class T> class ImageMetaData : public ImageMetaDataBase<T> { 80 : 81 : public: 82 : 83 : ImageMetaData() = delete; 84 : 85 : ImageMetaData(SPCIIT image); 86 : 87 0 : ~ImageMetaData() {} 88 : 89 : casacore::Record toRecord(casacore::Bool verbose) const; 90 : 91 : // For ia.summary() moved from ImageAnalysis 92 : casacore::Record summary( 93 : const casacore::String& doppler, const casacore::Bool list, 94 : const casacore::Bool pixelorder, const casacore::Bool verbose 95 : ); 96 : 97 : protected: 98 : 99 0 : const casacore::ImageInfo& _getInfo() const { return _info; } 100 : 101 0 : const casacore::CoordinateSystem& _getCoords() const { return _csys; } 102 : 103 : casacore::Vector<casacore::String> _getAxisNames() const; 104 : 105 : casacore::Vector<casacore::String> _getAxisUnits() const; 106 : 107 : casacore::GaussianBeam _getBeam() const; 108 : 109 : casacore::String _getBrightnessUnit() const; 110 : 111 : casacore::String _getImType() const; 112 : 113 : std::vector<casacore::Quantity> _getIncrements() const; 114 : 115 : casacore::Vector<casacore::String> _getMasks() const; 116 : 117 : casacore::String _getObject() const; 118 : 119 : casacore::String _getEquinox() const; 120 : 121 : casacore::MEpoch _getObsDate() const; 122 : 123 : casacore::String _getObserver() const; 124 : 125 : casacore::String _getProjection() const; 126 : 127 : casacore::String _getRefFreqType() const; 128 : 129 : casacore::Vector<casacore::Double> _getRefPixel() const; 130 : 131 : casacore::Vector<casacore::Quantity> _getRefValue() const; 132 : 133 : casacore::Quantity _getRestFrequency() const; 134 : 135 : casacore::Record _getStatistics() const; 136 : 137 : casacore::String _getTelescope() const; 138 : 139 : casacore::Vector<casacore::String> _getStokes() const; 140 : 141 : private: 142 : SPCIIT _image; 143 : 144 : const casacore::ImageInfo _info; 145 : const casacore::CoordinateSystem _csys; 146 : 147 : // These are mutable because they are only to be set once and 148 : // then cached. If this contract is broken, and they are set elsewhere 149 : // defects will likely occur. 150 : mutable casacore::Record _header; 151 : mutable casacore::String _bunit, _imtype, _object, _equinox, 152 : _projection, _observer, _telescope, _reffreqtype; 153 : mutable casacore::MEpoch _obsdate; 154 : mutable casacore::Quantity _restFreq; 155 : mutable casacore::GaussianBeam _beam; 156 : mutable casacore::Vector<casacore::String> _masks, _stokes; 157 : mutable casacore::Vector<casacore::String> _axisNames, _axisUnits; 158 : mutable casacore::Vector<casacore::Double> _refPixel; 159 : mutable std::vector<casacore::Quantity> _refVal, _increment; 160 : mutable casacore::Record _stats; 161 : }; 162 : 163 : } 164 : 165 : #ifndef AIPS_NO_TEMPLATE_SRC 166 : #include <imageanalysis/ImageAnalysis/ImageMetaData.tcc> 167 : #endif //# AIPS_NO_TEMPLATE_SRC 168 : 169 : #endif