casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageSummary.h
Go to the documentation of this file.
1 //# ImageSummary.h: List descriptive information from an image
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002
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: aips2-request@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 //#
27 //# $Id$
28 
29 #ifndef IMAGES_IMAGESUMMARY_H
30 #define IMAGES_IMAGESUMMARY_H
31 
32 
33 //# Includes
34 #include <casacore/casa/aips.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 //# Forward Declarations
45 template <class T> class ImageInterface;
46 template <class T> class Vector;
47 class IPosition;
48 class Unit;
49 class LogIO;
50 class Coordinate;
51 
52 
53 // <summary>
54 // Provides and lists information about the header of an image.
55 // </summary>
56 
57 // <use visibility=export>
58 
59 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
60 // </reviewed>
61 
62 // <prerequisite>
63 // <li> <linkto class=ImageInterface>ImageInterface</linkto>
64 // <li> <linkto module=Coordinates>Coordinates</linkto>
65 // </prerequisite>
66 
67 // <etymology>
68 // This class lists the ancilliary descriptive information from an image
69 // </etymology>
70 
71 // <synopsis>
72 // Images consist of pixel values and descriptive information.
73 // This information describes the coordinate system, the image
74 // units etc. This class enables you to
75 // retrieve the descriptive information and/or list it.
76 // <p>
77 // The functions that retrieve specific coordinate information in vectors
78 // (e.g. <src>referenceValues</src>) return it in the order of the (pixel) axes of
79 // the image. Note that this can be different from the order in which
80 // the <linkto class=CoordinateSystem>CoordinateSystem</linkto>
81 // functions of similar name might return them. This is because the
82 // order of the coordinates in the CoordinateSystem is not necessarily
83 // the same order as the pixel axes in the associated image, although
84 // of course there is a known association.
85 //
86 // <note role=tip>
87 // This class lists information about the coordinates in the image.
88 // The Coordinates classes can maintain the information in a variety
89 // of units. For example, angular quantities are by default in radians,
90 // but the manipulator of a <linkto class=CoordinateSystem>CoordinateSystem</linkto>
91 // may have converted to some other unit such as arcseconds. This
92 // means that when this class fetches coordinate information and returns
93 // it to you (such as the <src>referenceValues()</src> function,
94 // the information is returned to you in whatever units the coordinates
95 // are currently in. It does not convert it.
96 // </note>
97 // </synopsis>
98 
99 // <example>
100 // <srcBlock>
101 // PagedImage<Float> inImage(fileName);
102 // ImageSummary<Float> summary(inImage);
103 // LogOrigin or("myClass", "myFunction(...)", WHERE);
104 // LogIO os(or);
105 // summary.list(os);
106 // </srcBlock>
107 // A <src>PagedImage</src> object is constructed and then logged to the
108 // supplied <src>LogIO</src> object.
109 // </example>
110 
111 // <motivation>
112 // The viewing of the descriptive image information is a basic capability.
113 // </motivation>
114 
115 //# <todo asof="1998/08/31">
116 //# None that I know of.
117 //# </todo>
118 
119 
120 template <class T> class ImageSummary
121 {
122 public:
123 // Constructor
124  ImageSummary (const ImageInterface<T>&);
125 
126 // Copy constructor
127  ImageSummary (const ImageSummary<T> &other);
128 
129 // Destructor
130  ~ImageSummary();
131 
132 // Assignment operator
133  ImageSummary<T> &operator=(const ImageSummary<T> &other);
134 
135 // Retrieve number of image dimension
136  Int ndim () const;
137 
138 // Retrieve image shape
139  IPosition shape () const;
140 
141 // Retrieve tile shape with which image is stored on disk
142  IPosition tileShape () const;
143 
144 // Retrieve axis names in pixel or world axis order.
145  Vector<String> axisNames (Bool pixelOrder=True) const;
146 
147 // Retrieve reference pixels (0 or 1 rel)
148  Vector<Double> referencePixels (Bool oneRel=True) const;
149 
150 // Retrieve reference values in pixel or world axis order.
151  Vector<Double> referenceValues (Bool pixelOrder=True) const;
152 
153 // Retrieve axis increments in pixel or world axis order.
154  Vector<Double> axisIncrements (Bool pixelOrder=True) const;
155 
156 // Retrieve axis units in pixel or world axis order.
157  Vector<String> axisUnits(Bool pixelOrder=True) const;
158 
159 // Retrieve image units
160  Unit units () const;
161 
162 // Retrieve image name. Any prepended path is stripped off.
163  String name() const;
164 
165 // Retrieve observer name
166  String observer() const;
167 
168 // Return epoch of observation as MEpoch or formatted string
169  String obsDate(MEpoch& date) const;
170 
171 // Return telescope
172  String telescope() const;
173 
174 // Return rest frequency. Returns False if none.
175  Bool restFrequency(String& restFreqString, Quantum<Double>& restFreq) const;
176 
177 // Return frequency system. Returns False if none.
178  Bool frequencySystem(String& freqTypeString, MFrequency::Types& freqType) const;
179 
180 // Return direction system. Returns False if none.
181  Bool directionSystem(String& dirTypeString, MDirection::Types& dirType) const;
182 
183 // Retrieve whether image has mask or not
184  Bool hasAMask () const;
185 
186 // Retrieve mask names
187  Vector<String> maskNames() const;
188 
189 // Retrieve region names
190  Vector<String> regionNames() const;
191 
192 // Retrieve default mask name. Empty if none
193  String defaultMaskName() const;
194 
195 
196 // Retrieve image type
197  String imageType () const;
198 
199 // List all header information. By default, the reference
200 // values and pixel increments are converted to a "nice" unit before
201 // formatting (e.g. RA is shown as HH:MM:SS.S).
202 // For spectral axes, both frequency and velocity information is listed. You
203 // can specify what velocity definition you want with <src>velocityType</src>
204 // If postLocally is True, the formatted strings are returned in the return value
205  Vector<String> list(
206  LogIO& os, const MDoppler::Types velocityType=MDoppler::RADIO,
207  Bool postLocally=False, const Bool verbose=False
208  );
209 
210 // Set a new image
211  Bool setNewImage (const ImageInterface<T>& image);
212 
213 
214 private:
219 
220  String makeMasksString() const;
221  String makeRegionsString() const;
222 };
223 
224 
225 } //# NAMESPACE CASACORE - END
226 
227 #ifndef CASACORE_NO_AUTO_TEMPLATES
228 #include <casacore/images/Images/ImageSummary.tcc>
229 #endif //# CASACORE_NO_AUTO_TEMPLATES
230 #endif
ImageSummary(const ImageInterface< T > &)
Constructor.
int Int
Definition: aipstype.h:50
std::vector< double > Vector
Definition: ds9context.h:24
Bool setNewImage(const ImageInterface< T > &image)
Set a new image.
Unit units() const
Retrieve image units.
Vector< String > axisNames(Bool pixelOrder=True) const
Retrieve axis names in pixel or world axis order.
Bool restFrequency(String &restFreqString, Quantum< Double > &restFreq) const
Return rest frequency.
String obsDate(MEpoch &date) const
Return epoch of observation as MEpoch or formatted string.
CoordinateSystem cSys_p
Definition: ImageSummary.h:215
String observer() const
Retrieve observer name.
Store miscellaneous information related to an observation.
Definition: ObsInfo.h:97
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Vector< Double > referenceValues(Bool pixelOrder=True) const
Retrieve reference values in pixel or world axis order.
IPosition tileShape() const
Retrieve tile shape with which image is stored on disk.
Vector< String > regionNames() const
Retrieve region names.
A base class for astronomical images.
Vector< String > maskNames() const
Retrieve mask names.
Int ndim() const
Retrieve number of image dimension.
const ImageInterface< T > * pImage_p
Definition: ImageSummary.h:218
ImageSummary< T > & operator=(const ImageSummary< T > &other)
Assignment operator.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
String imageType() const
Retrieve image type.
Vector< String > axisUnits(Bool pixelOrder=True) const
Retrieve axis units in pixel or world axis order.
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
const Bool False
Definition: aipstype.h:44
~ImageSummary()
Destructor.
Bool hasAMask() const
Retrieve whether image has mask or not.
IPosition shape() const
Retrieve image shape.
String makeMasksString() const
Vector< String > list(LogIO &os, const MDoppler::Types velocityType=MDoppler::RADIO, Bool postLocally=False, const Bool verbose=False)
List all header information.
String makeRegionsString() const
Bool frequencySystem(String &freqTypeString, MFrequency::Types &freqType) const
Return frequency system.
Bool directionSystem(String &dirTypeString, MDirection::Types &dirType) const
Return direction system.
String name() const
Retrieve image name.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
Vector< Double > axisIncrements(Bool pixelOrder=True) const
Retrieve axis increments in pixel or world axis order.
Vector< Double > referencePixels(Bool oneRel=True) const
Retrieve reference pixels (0 or 1 rel)
String telescope() const
Return telescope.
Miscellaneous information related to an image.
Definition: ImageInfo.h:92
String defaultMaskName() const
Retrieve default mask name.
const Bool True
Definition: aipstype.h:43
Interconvert pixel and world coordinates.
TableExprNode date(const TableExprNode &node)
Definition: ExprNode.h:1468
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42