casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ImageTwoPtCorr.h
Go to the documentation of this file.
00001 //# ImageTwoPtCorr.h: Compute two point correlation function of an image
00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2003
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: ImageTwoPtCorr.h 20229 2008-01-29 15:19:06Z gervandiepen $
00027 
00028 #ifndef IMAGES_IMAGETWOPTCORR_H
00029 #define IMAGES_IMAGETWOPTCORR_H
00030 
00031 #include <casa/aips.h>
00032 #include <images/Images/ImageInterface.h>
00033 #include <lattices/Lattices/LatticeTwoPtCorr.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 class IPosition;
00038 
00039 // <summary>
00040 // Compute two point correlation functions from images
00041 // </summary>
00042 
00043 // <use visibility=export>
00044 
00045 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> <linkto class=LatticeTwoPtCorr>LatticeTwoPtCorr</linkto> 
00050 //   <li> <linkto class=ImageInterface>ImageInterface</linkto> 
00051 //   <li> <linkto class=TempImage>TempImage</linkto> 
00052 // </prerequisite>
00053 
00054 // <etymology>
00055 // Compute the two point correlation function of an image
00056 // </etymology>
00057 
00058 // <synopsis>
00059 // This class allows you to compute two point correlation functions
00060 // from an image  over planes of the specified two axes. Presently
00061 // only autocorrelations and in particualt the structure function are implemented.  
00062 //
00063 // The structure function is  <src>S(x,y) = < [image(i,j) - image(i+x,j+y)]**2 ></src>
00064 // where x and y are absolute integer shifts (or lags) and the
00065 // ensemble average is for each lag pair, x&y.
00066 // </synopsis>
00067 //
00068 // <example>
00069 // <srcblock>
00070 // </srcblock>
00071 // </example>
00072 
00073 
00074 // <motivation>
00075 // Taking the Structure Function of an image is a basic part of image analysis
00076 // </motivation>
00077 
00078 // <todo asof="2003/12/13">
00079 //   <li> Add more types
00080 //   <li> Add crosscorrelation
00081 // </todo>
00082 
00083 
00084 template <class T> class ImageTwoPtCorr 
00085 {
00086 public:
00087 
00088 // Default constructor
00089    ImageTwoPtCorr ();
00090 
00091 // Copy constructor (reference semantics)
00092    ImageTwoPtCorr(const ImageTwoPtCorr& other);
00093 
00094 // Assignment (reference semantics)
00095    ImageTwoPtCorr& operator=(const ImageTwoPtCorr& other);
00096 
00097 // Destructor
00098    ~ImageTwoPtCorr();
00099 
00100 // Compute the desired autocorrelation function for the specified plane.  You specify 
00101 // which two axes to compute the structure function over.  If the 
00102 // axes array is empty (or not an argument), then the Sky plane 
00103 // is selected if it exists, otherwise 
00104 // the first two axes are selected.  The CoordinateSystem of the output image 
00105 // is overwritten.  The miscellaneous items (ImageInfo, MiscInfo, Logger)
00106 // are copied from the input image to the output.
00107 // <group>
00108    void autoCorrelation (ImageInterface<T>& out,
00109                          const ImageInterface<T>& in,
00110                          const IPosition& axes, 
00111                          typename LatticeTwoPtCorr<T>::Method method,
00112                          Bool progress=True) const;
00113    void autoCorrelation (ImageInterface<T>& out,
00114                          const ImageInterface<T>& in,
00115                          typename LatticeTwoPtCorr<T>::Method method,
00116                          Bool progress=True) const;
00117 // </group>
00118 
00119 // Helper function to set up the axes vector.  If axes is of length 0,
00120 // it looks for the Sky (DirectionCoordinate). If that's not there,
00121 // you get the first two axes in the image.
00122    static IPosition setUpAxes (const IPosition& axes,
00123                                const CoordinateSystem& cSys);
00124 
00125 // Helper function to provide output image shape given the input shape
00126 // and the axes to find the structure function over.
00127    static IPosition setUpShape (const IPosition& inShape, const IPosition& axes);
00128 
00129 
00130 
00131 private:
00132 
00133 
00134 // Copy MiscInfo, ImageInfo, and logSInk to output
00135    void copyMiscellaneous (ImageInterface<T>& out,
00136                            const ImageInterface<T>& in) const;
00137 
00138 // Overwrite the CoordinateSystem
00139    void setCoordinateSystem (ImageInterface<T>& out,
00140                              const ImageInterface<T>& in,
00141                              const IPosition& axes) const;
00142 
00143 // Set the brightness unit
00144    void setUnit (ImageInterface<T>& out) const;
00145 
00146 };
00147 
00148 } //# NAMESPACE CASA - END
00149 
00150 #ifndef CASACORE_NO_AUTO_TEMPLATES
00151 #include <imageanalysis/ImageAnalysis/ImageTwoPtCorr.tcc>
00152 #endif //# CASACORE_NO_AUTO_TEMPLATES
00153 #endif