casacore
FITSErrorImage.h
Go to the documentation of this file.
1 //# FITSErrorImage.h: Class providing native access to FITS images
2 //# Copyright (C) 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 //# $Id$
27 
28 #ifndef IMAGES_FITSERRORIMAGE_H
29 #define IMAGES_FITSERRORIMAGE_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/images/Images/FITSImage.h>
35 #include <casacore/casa/Arrays/ArrayFwd.h>
36 #include <casacore/casa/BasicSL/String.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class MaskSpecifier;
42 class IPosition;
43 class Slicer;
44 
45 // <summary>
46 // Class providing native access to FITS Error images.
47 // </summary>
48 
49 // <use visibility=export>
50 
51 // <reviewed reviewer="" date="" tests="tFITSErrorImage.cc">
52 // </reviewed>
53 
54 // <prerequisite>
55 // <li> <linkto class=FITSImage>FITSImage</linkto>
56 // <li> <linkto class=FITSMask>FITSMask</linkto>
57 // </prerequisite>
58 
59 // <etymology>
60 // </etymology>
61 
62 // <synopsis>
63 // </synopsis>
64 
65 // <example>
66 // <srcblock>
67 // </srcblock>
68 // </example>
69 
70 // <motivation>
71 // This provides native access to FITS error images.
72 // </motivation>
73 
74 //# <todo asof="2011/08/17">
75 //# </todo>
76 
78 {
79 public:
80 
81  // The enum describes which types of error images exist. The type is fixed
82  // during object creation and can not be changed at a later time.
83  enum ErrorType
84  {
85  MSE, // the values are "mean squared error" (=variance)
86  RMSE, // the values are "root mean squared error" (=sigma)
87  INVMSE, // the values are inverse "means squared error"
88  INVRMSE, // the values are inverse "root mean squared error"
89  UNKNOWN, // unknown type
90  DEFAULT=MSE
91  };
92 
93  // Construct a FITSImage from the disk FITS file name and extension and apply mask.
94  explicit FITSErrorImage(const String& name, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE);
95 
96  // Construct a FITSImage from the disk FITS file name and extension and apply mask or not.
98 
99  // Copy constructor (reference semantics)
101 
102  // Destructor
103  virtual ~FITSErrorImage();
104 
105  // Assignment (reference semantics)
107 
108  // Make a copy of the object with new (reference semantics).
109  virtual ImageInterface<Float>* cloneII() const;
110 
111  // Get the image type (returns "FITSErrorImage").
112  virtual String imageType() const;
113 
114  // Do the actual get of the data.
115  // Returns False as the data do not reference another Array
116  virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice);
117 
118  // The FITSImage is not writable, so this throws an exception.
119  virtual void doPutSlice (const Array<Float>& sourceBuffer,
120  const IPosition& where,
121  const IPosition& stride);
122 
123  // Return the error type.
125  {return errtype_p;};
126 
127  // Convert an image type to String.
129 
130  // Convert a String to an image type.
132 
133 private:
134 
135  // Set the correct masking.
136  void setupMask();
137 
140 };
141 
142 
143 
144 } //# NAMESPACE CASACORE - END
145 
146 #endif
147 
148 
FITSErrorImage(const String &name, const MaskSpecifier &mask, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE)
Construct a FITSImage from the disk FITS file name and extension and apply mask or not.
virtual String imageType() const
Get the image type (returns "FITSErrorImage").
virtual ~FITSErrorImage()
Destructor.
FITSErrorImage(const FITSErrorImage &other)
Copy constructor (reference semantics)
FITSErrorImage & operator=(const FITSErrorImage &other)
Assignment (reference semantics)
FITSErrorImage::ErrorType errtype_p
virtual FITSErrorImage::ErrorType errorType() const
Return the error type.
static FITSErrorImage::ErrorType stringToErrorType(String errorTypeStr)
Convert an image type to String.
virtual ImageInterface< Float > * cloneII() const
Make a copy of the object with new (reference semantics).
void setupMask()
Set the correct masking.
ErrorType
The enum describes which types of error images exist.
static String errorTypeToString(FITSErrorImage::ErrorType errType)
Convert a String to an image type.
FITSErrorImage(const String &name, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE)
Construct a FITSImage from the disk FITS file name and extension and apply mask.
virtual void doPutSlice(const Array< Float > &sourceBuffer, const IPosition &where, const IPosition &stride)
The FITSImage is not writable, so this throws an exception.
virtual Bool doGetSlice(Array< Float > &buffer, const Slicer &theSlice)
Do the actual get of the data.
uInt whichHDU() const
Return the HDU number.
Definition: FITSImage.h:234
virtual String name(Bool stripPath=False) const
Returns the name of the disk file.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42