casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ImageSourceFinder.h
Go to the documentation of this file.
00001 //# ImageSourceFinder.h: find sources in image
00002 //# Copyright (C) 1996,1997,1998,1999,2000,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 //#
00027 //# $Id: ImageSourceFinder.h 20299 2008-04-03 05:56:44Z gervandiepen $
00028 
00029 #ifndef IMAGES_IMAGESOURCEFINDER_H
00030 #define IMAGES_IMAGESOURCEFINDER_H
00031 
00032 
00033 //# Includes
00034 #include <casa/aips.h>
00035 #include <measures/Measures/Stokes.h>      
00036 #include <components/ComponentModels/ComponentType.h>      
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 //# Forward Declarations
00041 template <class T> class ImageInterface;
00042 template <class T> class Vector;
00043 class ComponentList;
00044 class SkyComponent;
00045 class LogIO;
00046 
00047 
00048 // <summary>
00049 // Provides functionality to find sources in an image
00050 // </summary>
00051 
00052 // <use visibility=export>
00053 
00054 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00055 // </reviewed>
00056 
00057 // <prerequisite>
00058 //   <li> <linkto class=ImageInterface>ImageInterface</linkto>
00059 //   <li> <linkto module=Coordinates>Coordinates</linkto> 
00060 // </prerequisite>
00061 
00062 // <etymology>
00063 // It finds sources.
00064 // </etymology>
00065 
00066 
00067 // <synopsis>
00068 // This class provides methods to find sources in an image.
00069 // 
00070 // The finding procedes in two stages.  First, strong point sources
00071 // are found via an efficient algorithm producing POINT components. 
00072 // If you wish, you can further request a Gaussian fit to these 
00073 // found point sources and then return the parameters of the 
00074 // fit (as a GAUSIAN component).
00075 // </synopsis>
00076 
00077 // <example>
00078 // <srcBlock>
00079 // </srcBlock>
00080 // </example>
00081 
00082 // <motivation>
00083 // This complements source fitting by providing an initial estimate
00084 // </motivation>
00085 
00086 // <todo asof="2000/11/08">
00087 // </todo>
00088  
00089 
00090 template <class T> class ImageSourceFinder
00091 {
00092 public:
00093 // Constructor
00094    ImageSourceFinder (const ImageInterface<T>&);
00095 
00096 // Copy constructor
00097    ImageSourceFinder (const ImageSourceFinder<T> &other);
00098 
00099 // Destructor
00100   ~ImageSourceFinder();
00101 
00102 // Assignment operator
00103    ImageSourceFinder<T> &operator=(const ImageSourceFinder<T> &other);
00104 
00105 // Find strong sources.  nMax specifies the maximum number of sources to find.
00106 // cutoff is the fractional cutoff (of peak) and soiurces below this limit
00107 // will not be found. If absFind is True, only positive sources are found, else
00108 // positive and negative are found. If doPoint=True, the returned components
00109 // are of type POINT.  If doPoint=False, the position and shape information is 
00110 // returned via a Gaussian fit (and components will be of
00111 // type GAUSSIAN) to the point sources initially found.    The parameter width
00112 // specifies the half-width of a square grid of pixels centered on the initial
00113 // point source location to be used in the fit.  If you set doPoint=False and width=0,
00114 // a default width of 3 and position angle 0 is returned in the GAUSSIAN component.
00115 // Because  the flux of the component is integrated, this rough shape influences the 
00116 // flux values as well.  
00117    ComponentList findSources (LogIO& os, Int nMax, Double cutoff=0.1, 
00118                               Bool absFind=True, Bool doPoint=True,
00119                               Int width=4);
00120 
00121 // Find one source in sky plane.  Exception if no sky
00122    SkyComponent findSourceInSky (LogIO& os, Vector<Double>& absPixel,
00123                                  Double cutoff=0.1, Bool absFind=True, 
00124                                  Bool doPoint=True, Int width=4);
00125 
00126 // Set a new image
00127    Bool setNewImage (const ImageInterface<T>& image);
00128 
00129 private:
00130    const ImageInterface<T>* pImage_p;
00131 
00132 // Find strong (point) sources
00133    ComponentList findSources (LogIO& os, const ImageInterface<T>& image,
00134                               Int nMax, 
00135                               Double cutoff, Bool absFind, Bool doPoint,
00136                               Int width);
00137 };
00138 
00139 
00140 } //# NAMESPACE CASA - END
00141 
00142 #ifndef CASACORE_NO_AUTO_TEMPLATES
00143 #include <imageanalysis/ImageAnalysis/ImageSourceFinder.tcc>
00144 #endif //# CASACORE_NO_AUTO_TEMPLATES
00145 #endif