Line data Source code
1 : //# SDAlgorithmBase.h: Definition for SDAlgorithmBase 2 : //# Copyright (C) 1996,1997,1998,1999,2000,2002 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be adressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : //# $Id$ 28 : 29 : #ifndef SYNTHESIS_SDALGORITHMBASE_H 30 : #define SYNTHESIS_SDALGORITHMBASE_H 31 : 32 : #include <casacore/ms/MeasurementSets/MeasurementSet.h> 33 : //#include <synthesis/MeasurementComponents/SkyModel.h> 34 : #include <casacore/casa/Arrays/Matrix.h> 35 : #include <casacore/images/Images/ImageInterface.h> 36 : #include <casacore/images/Images/PagedImage.h> 37 : #include <casacore/images/Images/TempImage.h> 38 : #include <casacore/casa/Logging/LogMessage.h> 39 : #include <casacore/casa/Logging/LogSink.h> 40 : #include <casacore/casa/System/PGPlotter.h> 41 : 42 : #include <casacore/casa/aips.h> 43 : #include <casacore/images/Images/ImageInterface.h> 44 : #include <components/ComponentModels/ComponentList.h> 45 : #include <casacore/casa/BasicSL/String.h> 46 : #include <synthesis/TransformMachines/StokesImageUtil.h> 47 : 48 : #include<synthesis/ImagerObjects/SDMaskHandler.h> 49 : #include<synthesis/ImagerObjects/SIImageStore.h> 50 : #include<synthesis/ImagerObjects/SIImageStoreMultiTerm.h> 51 : 52 : namespace casa { //# NAMESPACE CASA - BEGIN 53 : 54 : /* Forware Declaration */ 55 : class SIMinorCycleController; 56 : 57 : 58 : class SDAlgorithmBase { 59 : public: 60 : 61 : // Empty constructor 62 : SDAlgorithmBase(); 63 : virtual ~SDAlgorithmBase(); 64 : 65 : // Non virtual. Wrapper function implemented only in the base class. 66 : void deconvolve( SIMinorCycleController& loopController, 67 : std::shared_ptr<SIImageStore> &imagestore, 68 : casacore::Int deconvolverid, 69 : casacore::Bool isautomasking=false, 70 : //casacore::Bool fastnoise=true); 71 : casacore::Bool fastnoise=true, 72 : casacore::Record robuststats=casacore::Record(), 73 : bool fullsummary=false); 74 : 75 : void setRestoringBeam( casacore::GaussianBeam restbeam, casacore::String usebeam ); 76 : // void setMaskOptions( casacore::String maskstring ); 77 : 78 : // Base Class contains standard restoration. Overload for more complex behaviour. 79 : virtual void restore( std::shared_ptr<SIImageStore> imagestore ); 80 : virtual void pbcor( std::shared_ptr<SIImageStore> imagestore ); 81 : 82 797 : virtual casacore::String getAlgorithmName(){return itsAlgorithmName;}; 83 : 84 0 : virtual casacore::uInt getNTaylorTerms(){return 1;}; 85 : ///returns the estimate of memory used in kilobytes (kB); 86 : virtual casacore::Long estimateRAM(const std::vector<int>& imsize); 87 : protected: 88 : 89 : // Pure virtual functions to be implemented by various algorithm deconvolvers. 90 : virtual void takeOneStep( casacore::Float loopgain, casacore::Int cycleNiter, casacore::Float cycleThreshold, 91 : casacore::Float &peakresidual, casacore::Float &modelflux, casacore::Int& iterdone )=0; 92 : // virtual void initializeDeconvolver( casacore::Float &peakresidual, casacore::Float &modelflux )=0; 93 : virtual void initializeDeconvolver()=0; 94 : virtual void finalizeDeconvolver()=0; 95 : 96 : // Base Class implements the option of single-plane images for the minor cycle. 97 : virtual void queryDesiredShape(casacore::Int &nchanchunks, casacore::Int& npolchunks, casacore::IPosition imshape); 98 : 99 : 100 : // Non virtual. Implemented only in the base class. 101 : casacore::Int checkStop( SIMinorCycleController &loopcontrols, casacore::Float currentresidual ); 102 : casacore::Bool findMaxAbs(const casacore::Array<casacore::Float>& lattice,casacore::Float& maxAbs,casacore::IPosition& posMaxAbs); 103 : casacore::Bool findMaxAbsMask(const casacore::Array<casacore::Float>& lattice,const casacore::Array<casacore::Float>& mask, 104 : casacore::Float& maxAbs,casacore::IPosition& posMaxAbs); 105 : 106 : // Algorithm name 107 : casacore::String itsAlgorithmName; 108 : 109 : std::shared_ptr<SIImageStore> itsImages; //sOriginalImages; 110 : 111 : // casacore::Vector<casacore::Slicer> itsDecSlices; 112 : // casacore::SubImage<casacore::Float> itsResidual, itsPsf, itsModel, itsImage; 113 : 114 : casacore::IPosition itsMaxPos; 115 : casacore::Float itsPeakResidual; 116 : casacore::Float itsModelFlux; 117 : 118 : SDMaskHandler itsMaskHandler; 119 : //casacore::Array<casacore::Float> itsMatMask; 120 : 121 : casacore::GaussianBeam itsRestoringBeam; 122 : casacore::String itsUseBeam; 123 : // casacore::String itsMaskString; 124 : // casacore::Bool itsIsMaskLoaded; // Annoying state variable. Remove if possible. 125 : 126 : }; 127 : 128 : } //# NAMESPACE CASA - END 129 : 130 : #endif