00001 //# FITSErrorImage.h: Class providing native access to FITS images 00002 //# Copyright (C) 2001,2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef IMAGES_FITSERRORIMAGE_H 00029 #define IMAGES_FITSERRORIMAGE_H 00030 00031 00032 //# Includes 00033 #include <casacore/casa/aips.h> 00034 #include <casacore/images/Images/FITSImage.h> 00035 #include <casacore/casa/BasicSL/String.h> 00036 00037 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00038 00039 //# Forward Declarations 00040 template <class T> class Array; 00041 00042 // 00043 class MaskSpecifier; 00044 class IPosition; 00045 class Slicer; 00046 00047 // <summary> 00048 // Class providing native access to FITS Error images. 00049 // </summary> 00050 00051 // <use visibility=export> 00052 00053 // <reviewed reviewer="" date="" tests="tFITSErrorImage.cc"> 00054 // </reviewed> 00055 00056 // <prerequisite> 00057 // <li> <linkto class=FITSImage>FITSImage</linkto> 00058 // <li> <linkto class=FITSMask>FITSMask</linkto> 00059 // </prerequisite> 00060 00061 // <etymology> 00062 // </etymology> 00063 00064 // <synopsis> 00065 // </synopsis> 00066 00067 // <example> 00068 // <srcblock> 00069 // </srcblock> 00070 // </example> 00071 00072 // <motivation> 00073 // This provides native access to FITS error images. 00074 // </motivation> 00075 00076 //# <todo asof="2011/08/17"> 00077 //# </todo> 00078 00079 class FITSErrorImage: public FITSImage 00080 { 00081 public: 00082 00083 // The enum describes which types of error images exist. The type is fixed 00084 // during object creation and can not be changed at a later time. 00085 enum ErrorType 00086 { 00087 MSE, // the values are "mean squared error" (=variance) 00088 RMSE, // the values are "root mean squared error" (=sigma) 00089 INVMSE, // the values are inverse "means squared error" 00090 INVRMSE, // the values are inverse "root mean squared error" 00091 UNKNOWN, // unknown type 00092 DEFAULT=MSE 00093 }; 00094 00095 // Construct a FITSImage from the disk FITS file name and extension and apply mask. 00096 explicit FITSErrorImage(const String& name, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE); 00097 00098 // Construct a FITSImage from the disk FITS file name and extension and apply mask or not. 00099 FITSErrorImage(const String& name, const MaskSpecifier& mask, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE); 00100 00101 // Copy constructor (reference semantics) 00102 FITSErrorImage(const FITSErrorImage& other); 00103 00104 // Destructor 00105 virtual ~FITSErrorImage(); 00106 00107 // Assignment (reference semantics) 00108 FITSErrorImage& operator=(const FITSErrorImage& other); 00109 00110 // Make a copy of the object with new (reference semantics). 00111 virtual ImageInterface<Float>* cloneII() const; 00112 00113 // Get the image type (returns "FITSErrorImage"). 00114 virtual String imageType() const; 00115 00116 // Do the actual get of the data. 00117 // Returns False as the data do not reference another Array 00118 virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice); 00119 00120 // The FITSImage is not writable, so this throws an exception. 00121 virtual void doPutSlice (const Array<Float>& sourceBuffer, 00122 const IPosition& where, 00123 const IPosition& stride); 00124 00125 // Return the error type. 00126 virtual FITSErrorImage::ErrorType errorType() const 00127 {return errtype_p;}; 00128 00129 // Convert an image type to String. 00130 static FITSErrorImage::ErrorType stringToErrorType(String errorTypeStr); 00131 00132 // Convert a String to an image type. 00133 static String errorTypeToString(FITSErrorImage::ErrorType errType); 00134 00135 private: 00136 00137 // Set the correct masking. 00138 void setupMask(); 00139 00140 Array<Float> buffer_p; 00141 FITSErrorImage::ErrorType errtype_p; 00142 }; 00143 00144 00145 00146 } //# NAMESPACE CASACORE - END 00147 00148 #endif 00149 00150