ImageNACleaner.h

Go to the documentation of this file.
00001 //# ImageNACleaner.h: this defines Cleaner a class for doing deconvolution
00002 //# Copyright (C) 2015
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 General Public License as published by
00007 //# the Free Software Foundation; either version 3 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: $
00028 
00029 #ifndef SYNTHESIS_IMAGENACLEANER_H
00030 #define SYNTHESIS_IMAGENACLEANER_H
00031 
00032 //# Includes
00033 #include <synthesis/MeasurementEquations/MatrixNACleaner.h>
00034 #include <casa/Utilities/CountedPtr.h>
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward Declarations
00038 template <class T> class Matrix;
00039 template <class T> class ImageInterface;
00040 
00041 
00042 
00043 // <summary>A class interfacing images to MatrixNACleaner </summary>
00044 
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="" date="yyyy/mm/dd" tests="tLatticeCleaner">
00048 // </reviewed>
00049 
00050 // <prerequisite>
00051 //  <li> ImageInterface
00052 //  <li> MatrixNACleaner
00053 // </prerequisite>
00054 //
00055 // <etymology>
00056 
00057 // The ImageCleaner class will use Non Amnesiac on Images.
00058 
00059 // </etymology>
00060 //
00061 // <synopsis>
00062 // This class will perform some kind  of Clean deconvolution
00063 // on Lattices.
00064 //
00065 // </synopsis>
00066 //
00067 // <example>
00068 // <srcblock>
00069 // </srcblock> 
00070 // </example>
00071 //
00072 // <motivation>
00073 // </motivation>
00074 //
00075 // <thrown>
00076 // <li> AipsError: if psf has more dimensions than the model. 
00077 // </thrown>
00078 //
00079 
00080 class ImageNACleaner
00081 
00082 {
00083 
00084  public:
00085   //Default
00086   ImageNACleaner();
00087   // Create a cleaner with a psf and dirty image
00088   ImageNACleaner(ImageInterface<Float>& psf, ImageInterface<Float>& dirty);
00089   //assignmemnt constructor
00090   ImageNACleaner(const ImageNACleaner& other);
00091   //assignment operator
00092   ImageNACleaner & operator=(const ImageNACleaner & other);
00093 
00094   //The destructor
00095   ~ImageNACleaner();
00096   
00097   // Update the dirty image only
00098   void setDirty(ImageInterface<Float> & dirty);
00099   // Change the psf image 
00100   void setPsf(ImageInterface<Float> & psf);
00101 
00102  
00103  
00104   // niter - number of iterations
00105   // gain - loop gain used in cleaning (a fraction of the maximum 
00106   //        subtracted at every iteration)
00107   // aThreshold - absolute threshold to stop iterations
00108   // masksupport is +-number of pixel around a peak to remember
00109   // memtype is memory function to use 0- no memory standard clean, 1 weak memory, 2 medium, 3 strong
00110   // numsigma: keep memory of position if peak is above this value 
00111   void setcontrol(const Int niter,
00112                   const Float gain, const Quantity& aThreshold,
00113                   const Int masksupp=3, const Int memtype=2, const Float numSigma=5.0);
00114   
00115   
00116   // return how many iterations we did do
00117   Int iteration() const ;
00118  
00119   
00120   // what iteration number to start on
00121   void startingIteration(const Int starting = 0);
00122 
00123   // Clean an image. 
00124   //return value gives you a hint of what's happening
00125   //  1 = converged
00126   //  0 = not converged but behaving normally
00127   // -1 = not converged and stopped on cleaning consecutive smallest scale
00128   // -2 = not converged and either large scale hit negative or diverging 
00129   // -3 = clean is diverging rather than converging 
00130   Int clean(ImageInterface<Float> & model, 
00131             const Int niter, const Float gain, const Quantity& threshold, const Int masksupp=3,
00132             const Int memType=2, const Float numsigma=5.0);
00133   // Set the mask
00134   // mask - input mask lattice
00135   // This is where the algorithm searched...the value of the mask shows the weight 
00136   //importance
00137   // code is exactly the same as before this parameter has been introduced.
00138   void setMask(ImageInterface<Float> & mask);
00139   //Max residual after last clean
00140   Float maxResidual() {return maxResidual_p;};
00141 
00142  private:
00143   //Helper function to setup some param
00144   Bool setupMatCleaner(const Int niter, const Float gain, 
00145                        const Quantity& threshold, const Int supp=3, const Int memType=2, const Float numsigma=5.0);
00146   MatrixNACleaner matClean_p;
00147   CountedPtr<ImageInterface<Float> > psf_p;
00148   CountedPtr<ImageInterface<Float> >dirty_p;
00149   CountedPtr<ImageInterface<Float> > mask_p;
00150   Int nPsfChan_p;
00151   Int nImChan_p;
00152   Int nPsfPol_p;
00153   Int nImPol_p;
00154   Int chanAxis_p;
00155   Int polAxis_p;
00156   Int nMaskChan_p;
00157   Int nMaskPol_p;
00158   Float maxResidual_p;
00159 
00160 };
00161 
00162 } //# NAMESPACE CASA - END
00163 
00164 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1