casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageMetaDataBase.h
Go to the documentation of this file.
1 //# Copyright (C) 2009
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 //# $Id$
26 
27 #ifndef IMAGEANALYSIS_IMAGEMETADATABASE_H
28 #define IMAGEANALYSIS_IMAGEMETADATABASE_H
29 
32 #include <casa/aips.h>
33 
34 namespace casa {
35 
36 // <summary>
37 // Base class for image metadata access.
38 // </summary>
39 
40 // <use visibility=export>
41 
42 // <reviewed reviewer="" date="" tests="" demos="">
43 // </reviewed>
44 
45 // <prerequisite>
46 // <li> <linkto class=casacore::ImageInterface>ImageInterface</linkto>
47 // </prerequisite>
48 
49 // <etymology>
50 // </etymology>
51 
52 // <synopsis>
53 // </synopsis>
54 
55 // <example>
56 // </example>
57 
58 // <motivation>
59 
60 // </motivation>
61 
63 public:
64  const static casacore::String MASKS;
65 
71 
72 };
73 
74 template <class T> class ImageMetaDataBase {
75 
76 public:
77 
78 
79  ImageMetaDataBase() = delete;
80 
81  virtual ~ImageMetaDataBase() {}
82 
83  casacore::CoordinateSystem coordsys(const std::vector<casacore::Int>& axes) const;
84 
85  casacore::DataType dataType() const;
86 
87  casacore::uInt nChannels() const;
88 
89  // Is the specified channel number valid for this image?
91 
92  // Get the pixel number on the polarization axis of the specified stokes parameter.
93  // If the specified stokes parameter does not exist in the image, the value returned
94  // is not gauranteed to be anything other than outside the range of 0 to nStokes-1
95  // inclusive. Return -1 if the specified stokes parameter is not present or
96  // if this image does not have a polarization axis.
97 
98  casacore::Int stokesPixelNumber(const casacore::String& stokesString) const;
99 
100  // get the stokes parameter at the specified pixel value on the polarization axis.
101  // returns "" if the specified pixel is out of range or if no polarization axis.
102 
103  casacore::String stokesAtPixel(const casacore::uInt pixel) const;
104 
105  // Get the number of stokes parameters in this image.
106  casacore::uInt nStokes() const;
107 
108  // is the specified stokes parameter present in the image?
109  casacore::Bool isStokesValid(const casacore::String& stokesString) const;
110 
111  // Get the shape of the direction axes. Returns a two element
112  // casacore::Vector if there is a direction coordinate, if not returns a zero element
113  // vector.
114 
116 
117  // if the specified stokes parameter is valid. A message suitable for
118  // error notification is returned in the form of an in-out parameter
119  //if one or both of these is invalid.
121  casacore::String& message, const casacore::uInt chan, const casacore::String& stokesString
122  ) const;
123 
124  // get the bounding box in the image for the specified region.
125  casacore::Record* getBoundingBox(const casacore::Record& region) const;
126 
127  // convert the header info to a casacore::Record and list to logger if verbose=true
128  virtual casacore::Record toRecord(casacore::Bool verbose) const = 0;
129 
130  // get the value of the datum corresponding to the given casacore::FITS keyword.
132 
133  // if doVelocity=true, compute spectral velocities as well as frequencies, if false, only
134  // compute frequencies.
135  // <src>dirFrame</src> and <src>freqFrame</src> are the codes for the
136  // frames for which it is desired that the returned measures should be specified.
137  // In both cases, one can specify "native" for the native coordinate frame,
138  // "cl" for the conversion layer frame, or any valid frame string from casacore::MDirection::showType()
139  // or casacore::MFrequency::showType().
141  const casacore::Vector<double>& value, const casacore::String& format = "n",
142  casacore::Bool doVelocity=true, const casacore::String& dirFrame="cl",
143  const casacore::String& freqFrame="cl"
144  ) const;
145 
146 protected:
148 
149  casacore::LogIO& _getLog() { return _log; }
150 
151  virtual const casacore::ImageInfo& _getInfo() const = 0;
152 
153  virtual const casacore::CoordinateSystem& _getCoords() const = 0;
154 
156 
158 
159  virtual casacore::GaussianBeam _getBeam() const = 0;
160 
161  virtual casacore::String _getBrightnessUnit() const = 0;
162 
163  virtual casacore::String _getImType() const = 0;
164 
165  virtual std::vector<casacore::Quantity> _getIncrements() const = 0;
166 
167  virtual casacore::Vector<casacore::String> _getMasks() const = 0;
168 
169  virtual casacore::String _getObject() const = 0;
170 
171  virtual casacore::String _getEquinox() const = 0;
172 
173  virtual casacore::MEpoch _getObsDate() const = 0;
174 
176 
177  virtual casacore::String _getObserver() const = 0;
178 
179  virtual casacore::String _getProjection() const;
180 
181  virtual casacore::String _getRefFreqType() const = 0;
182 
184 
186 
187  virtual casacore::Quantity _getRestFrequency() const = 0;
188 
190 
191  virtual casacore::Record _getStatistics() const = 0;
192 
193  virtual casacore::String _getTelescope() const = 0;
194 
196 
197  void _toLog(const casacore::Record& header) const;
198 
200 
202 
203  const casacore::TableRecord _miscInfo() const;
204 
205  casacore::uInt _ndim() const;
206 
208 
209 private:
213 
214  // precision < 0 => use default precision when printing numbers
215  void _fieldToLog(const casacore::Record& header, const casacore::String& field, casacore::Int precision=-1) const;
216 
218 
220  std::shared_ptr<const casacore::ImageInterface<T> > image
221  ) const;
222 
225  const casacore::String& format,
226  casacore::Bool isAbsolute, casacore::Bool showAsAbsolute, casacore::Bool doVelocity,
228  );
229 
231  const casacore::CoordinateSystem& csys,
234  );
235 
236 };
237 
238 }
239 
240 #ifndef AIPS_NO_TEMPLATE_SRC
241 #include <imageanalysis/ImageAnalysis/ImageMetaDataBase.tcc>
242 #endif //# AIPS_NO_TEMPLATE_SRC
243 
244 #endif
virtual casacore::Quantity _getRestFrequency() const =0
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
static const casacore::String _TELESCOPE
virtual casacore::String _getRefFreqType() const =0
static casacore::Record _worldVectorToMeasures(const casacore::CoordinateSystem &csys, const casacore::Vector< casacore::Double > &world, casacore::Int c, casacore::Bool abs, casacore::Bool doVelocity, casacore::MDirection::Types dirFrame, casacore::MFrequency::Types freqFrame)
casacore::Record toWorld(const casacore::Vector< double > &value, const casacore::String &format="n", casacore::Bool doVelocity=true, const casacore::String &dirFrame="cl", const casacore::String &freqFrame="cl") const
if doVelocity=true, compute spectral velocities as well as frequencies, if false, only compute freque...
int Int
Definition: aipstype.h:50
casacore::uInt _getAxisNumber(const casacore::String &key) const
static const casacore::String _MINPIXPOS
static const casacore::String _CUNIT
static const casacore::String _PROJECTION
virtual casacore::MEpoch _getObsDate() const =0
casacore::Record _calcStatsT(std::shared_ptr< const casacore::ImageInterface< T > > image) const
casacore::Int stokesPixelNumber(const casacore::String &stokesString) const
Get the pixel number on the polarization axis of the specified stokes parameter.
virtual const casacore::CoordinateSystem & _getCoords() const =0
casacore::IPosition _shape
casacore::Vector< casacore::Int > directionShape() const
Get the shape of the direction axes.
static const casacore::String _CTYPE
virtual casacore::Vector< casacore::String > _getMasks() const =0
virtual casacore::String _getImType() const =0
virtual casacore::Vector< casacore::String > _getAxisNames() const =0
casacore::String _doStandardFormat(casacore::Double value, const casacore::String &unit) const
casacore::DataType dataType() const
const casacore::TableRecord _miscInfo() const
virtual casacore::String _getObserver() const =0
casacore::Bool isChannelNumberValid(const casacore::uInt chan) const
Is the specified channel number valid for this image?
static const casacore::String _BPA
virtual casacore::String _getEquinox() const =0
virtual casacore::String _getObject() const =0
casacore::Record _calcStats() const
void _toLog(const casacore::Record &header) const
static const casacore::String _DATAMAX
ostream-like interface to creating log messages.
Definition: LogIO.h:167
static const casacore::String _BMIN
static const casacore::String _BEAMPA
static const casacore::String _OBJECT
static const casacore::String _MAXPOS
static const casacore::String MASKS
virtual casacore::Record _getStatistics() const =0
casacore::String _getEpochString() const
A Measure: instant in time.
Definition: MEpoch.h:104
virtual casacore::Vector< casacore::String > _getAxisUnits() const =0
virtual casacore::Vector< casacore::Quantity > _getRefValue() const =0
casacore::ValueHolder getFITSValue(const casacore::String &key) const
get the value of the datum corresponding to the given casacore::FITS keyword.
static const casacore::String _OBSERVER
Represents a Gaussian restoring beam associated with an image.
Definition: GaussianBeam.h:68
void _fieldToLog(const casacore::Record &header, const casacore::String &field, casacore::Int precision=-1) const
precision &lt; 0 =&gt; use default precision when printing numbers
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
virtual casacore::String _getBrightnessUnit() const =0
static const casacore::String _CRVAL
A base class for astronomical images.
Base class for image metadata access.
virtual casacore::Vector< casacore::Double > _getRefPixel() const =0
static const casacore::String _SHAPE
static const casacore::String _REFFREQTYPE
double Double
Definition: aipstype.h:55
LatticeExprNode abs(const LatticeExprNode &expr)
Numerical 1-argument functions which result in a real number regardless of input expression type...
static const casacore::String _BEAMMINOR
A holder for a value of any basic Casacore data type.
Definition: ValueHolder.h:67
static const casacore::String _DATAMIN
casacore::Bool isStokesValid(const casacore::String &stokesString) const
is the specified stokes parameter present in the image?
static const casacore::String _BUNIT
casacore::uInt _ndim() const
static const casacore::String _BMAJ
casacore::IPosition _getShape() const
virtual const casacore::ImageInfo & _getInfo() const =0
static const casacore::String _BEAMMAJOR
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static const casacore::String _EQUINOX
virtual casacore::Vector< casacore::String > _getStokes() const =0
casacore::String stokesAtPixel(const casacore::uInt pixel) const
get the stokes parameter at the specified pixel value on the polarization axis.
casacore::Bool areChannelAndStokesValid(casacore::String &message, const casacore::uInt chan, const casacore::String &stokesString) const
if the specified stokes parameter is valid.
#define SPCIIT
Definition: ImageTypedefs.h:35
static casacore::Record _worldVectorToRecord(const casacore::CoordinateSystem &csys, const casacore::Vector< casacore::Double > &world, casacore::Int c, const casacore::String &format, casacore::Bool isAbsolute, casacore::Bool showAsAbsolute, casacore::Bool doVelocity, casacore::MDirection::Types dirFrame, casacore::MFrequency::Types freqFrame)
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
casacore::uInt nStokes() const
Get the number of stokes parameters in this image.
virtual casacore::String _getProjection() const
casacore::uInt nChannels() const
static const casacore::String _MINPOS
virtual casacore::GaussianBeam _getBeam() const =0
casacore::LogIO & _getLog()
casacore::Record * getBoundingBox(const casacore::Record &region) const
get the bounding box in the image for the specified region.
static const casacore::String _RESTFREQ
static const casacore::String _CDELT
const Double c
Fundamental physical constants (SI units):
virtual casacore::Record toRecord(casacore::Bool verbose) const =0
convert the header info to a casacore::Record and list to logger if verbose=true
virtual std::vector< casacore::Quantity > _getIncrements() const =0
casacore::Record _makeHeader() const
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static const casacore::String _CRPIX
virtual casacore::String _getTelescope() const =0
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
static const casacore::String _EPOCH
Miscellaneous information related to an image.
Definition: ImageInfo.h:92
casacore::CoordinateSystem coordsys(const std::vector< casacore::Int > &axes) const
Interconvert pixel and world coordinates.
static const casacore::String _OBSDATE
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
unsigned int uInt
Definition: aipstype.h:51
static const casacore::String _IMTYPE
static const casacore::String _MAXPIXPOS