casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FITSErrorImage.h
Go to the documentation of this file.
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: FITSErrorImage.h 20495 2009-01-19 00:50:41Z Malte.Marquarding $
00027 
00028 #ifndef IMAGES_FITSERRORIMAGE_H
00029 #define IMAGES_FITSERRORIMAGE_H
00030 
00031 
00032 //# Includes
00033 #include <images/Images/FITSImage.h>
00034 #include <casa/BasicSL/String.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 //# Forward Declarations
00039 template <class T> class Array;
00040 
00041 //
00042 class MaskSpecifier;
00043 class IPosition;
00044 class Slicer;
00045 
00046 // <summary>
00047 // Class providing native access to FITS Error images.
00048 // </summary>
00049 
00050 // <use visibility=export>
00051 
00052 // <reviewed reviewer="" date="" tests="tFITSErrorImage.cc">
00053 // </reviewed>
00054 
00055 // <prerequisite>
00056 //   <li> <linkto class=FITSImage>FITSImage</linkto>
00057 //   <li> <linkto class=FITSMask>FITSMask</linkto>
00058 // </prerequisite>
00059 
00060 // <etymology>
00061 // </etymology>
00062 
00063 // <synopsis> 
00064 // </synopsis> 
00065 
00066 // <example>
00067 // <srcblock>
00068 // </srcblock>
00069 // </example>
00070 
00071 // <motivation>
00072 // This provides native access to FITS error images.
00073 // </motivation>
00074 
00075 //# <todo asof="2011/08/17">
00076 //# </todo>
00077 
00078 class FITSErrorImage: public FITSImage
00079 {
00080 public: 
00081 
00082         // The enum describes which types of error images exist. The type is fixed
00083         // during object creation and can not be changed at a later time.
00084         enum ErrorType
00085         {
00086                 MSE,          // the values are "mean squared error" (=variance)
00087                 RMSE,         // the values are "root mean squared error" (=sigma)
00088                 INVMSE,       // the values are inverse "means squared error"
00089                 INVRMSE,      // the values are inverse "root mean squared error"
00090                 UNKNOWN,      // unknown type
00091                 DEFAULT=MSE
00092         };
00093 
00094         // Construct a FITSImage from the disk FITS file name  and extension and apply mask.
00095   explicit FITSErrorImage(const String& name, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE);
00096 
00097   // Construct a FITSImage from the disk FITS file name and extension and apply mask or not.
00098   FITSErrorImage(const String& name, const MaskSpecifier& mask, uInt whichRep=0, uInt whichHDU=0, FITSErrorImage::ErrorType errtype=MSE);
00099 
00100   // Copy constructor (reference semantics)
00101   FITSErrorImage(const FITSErrorImage& other);
00102 
00103   // Destructor
00104   virtual ~FITSErrorImage();
00105 
00106   // Assignment (reference semantics)
00107   FITSErrorImage& operator=(const FITSErrorImage& other);
00108 
00109   // Make a copy of the object with new (reference semantics).
00110   virtual ImageInterface<Float>* cloneII() const;
00111 
00112   // Get the image type (returns "FITSErrorImage").
00113   virtual String imageType() const;
00114 
00115   // Do the actual get of the data.
00116   // Returns False as the data do not reference another Array
00117   virtual Bool doGetSlice (Array<Float>& buffer, const Slicer& theSlice);
00118 
00119   // The FITSImage is not writable, so this throws an exception.
00120   virtual void doPutSlice (const Array<Float>& sourceBuffer,
00121                            const IPosition& where,
00122                            const IPosition& stride);
00123 
00124   // Return the error type.
00125   virtual FITSErrorImage::ErrorType errorType() const
00126                   {return errtype_p;};
00127 
00128   // Convert an image type to String.
00129   static FITSErrorImage::ErrorType stringToErrorType(String errorTypeStr);
00130 
00131   // Convert a String to an image type.
00132   static String errorTypeToString(FITSErrorImage::ErrorType errType);
00133 
00134 private:
00135 
00136   // Set the correct masking.
00137   void setupMask();
00138 
00139   Array<Float>              buffer_p;
00140   FITSErrorImage::ErrorType errtype_p;
00141 };
00142 
00143 
00144 
00145 } //# NAMESPACE CASA - END
00146 
00147 #endif
00148 
00149