Line data Source code
1 : //# WPConvFunc.h: Definition for WPConvFunc 2 : //# Copyright (C) 2007-2016 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 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 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: aips2-request@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_TRANSFORM2_WPCONVFUNC_H 30 : #define SYNTHESIS_TRANSFORM2_WPCONVFUNC_H 31 : 32 : #include <casacore/casa/Arrays/Vector.h> 33 : #include <casacore/casa/Containers/Block.h> 34 : #include <casacore/casa/Utilities/CountedPtr.h> 35 : #include <casacore/casa/Arrays/ArrayFwd.h> 36 : 37 : namespace casacore{ 38 : 39 : template<class T> class ImageInterface; 40 : 41 : } 42 : 43 : namespace casa{ 44 : namespace vi{class VisBuffer2;} 45 : 46 : namespace refim{// namespace for imaging refactoring 47 : 48 : // <summary> A class to support FTMachines get their convolution casacore::Function </summary> 49 : 50 : // <use visibility=export> 51 : // <prerequisite> 52 : // <li> <linkto class=VisBuffer>VisBuffer</linkto> module 53 : // </prerequisite> 54 : // <etymology> 55 : // WP for W-casacore::Projection 56 : // ConvFunc => returns the convolution functions 57 : // </etymology> 58 : // 59 : // <synopsis> 60 : // FTMachines like WProjection and MosaicFT need convolution functions to 61 : // deal with directional dependent issues... 62 : // this class and related ones provide and cache such functions for re-use 63 : //</synopsis> 64 : 65 : class WPConvFunc 66 : { 67 : public: 68 : WPConvFunc(const casacore::Double minW=-1.0, const casacore::Double maxW=-1.0, const casacore::Double rmsW=-1.0); 69 : WPConvFunc(const casacore::RecordInterface& rec); 70 : //Copy constructor 71 : WPConvFunc(const WPConvFunc& other); 72 : // 73 : WPConvFunc& operator=(const WPConvFunc&other); 74 : 75 : 76 : virtual ~WPConvFunc(); 77 : 78 : // Inputs are the image, visbuffer, wConvsize 79 : // findconv return a cached convolution function appropriate for this 80 : // visbuffer and number of w conv plane 81 : void findConvFunction(const casacore::ImageInterface<casacore::Complex>& iimage, 82 : const vi::VisBuffer2& vb, 83 : const casacore::Int& wConvSize, 84 : const casacore::Vector<casacore::Double>& uvScale, 85 : const casacore::Vector<casacore::Double>& uvOffset, 86 : const casacore::Float& padding, 87 : casacore::Int& convSampling, 88 : casacore::Cube<casacore::Complex>& convFunc, 89 : casacore::Int& convsize, 90 : casacore::Vector<casacore::Int>& convSupport, 91 : casacore::Double& wScale); 92 : 93 : casacore::Bool findSupport(casacore::Array<casacore::Complex>& /*func*/, casacore::Float& /*threshold*/,casacore::Int& /*origin*/, casacore::Int& /*R*/) 94 : {throw(casacore::AipsError("IlluminationConvFunc::findSupport() not implemented"));}; 95 0 : virtual casacore::Bool makeAverageResponse(const vi::VisBuffer2& /*vb*/, 96 : const casacore::ImageInterface<casacore::Complex>& /*image*/, 97 : // casacore::TempImage<casacore::Float>& theavgPB, 98 : casacore::ImageInterface<casacore::Float>& /*theavgPB*/, 99 : casacore::Bool /*reset=true*/) 100 0 : {throw(casacore::AipsError("WPConvFunc::makeAverageRes() called"));}; 101 : //Serialization 102 : casacore::Bool toRecord(casacore::RecordInterface& rec); 103 : casacore::Bool fromRecord(casacore::String& err, const casacore::RecordInterface& rec); 104 : private: 105 : casacore::Bool checkCenterPix(const casacore::ImageInterface<casacore::Complex>& image); 106 : void makeGWplane(casacore::Matrix<casacore::Complex>& screen, const casacore::Int iw, casacore::Double s0, casacore::Double s1, casacore::Float *& wsaveptr, casacore::Int& lsav, casacore::Int& inner, casacore::Complex*& cor, casacore::Double&cpWscale); 107 : casacore::Block <casacore::CountedPtr<casacore::Cube<casacore::Complex> > > convFunctions_p; 108 : casacore::Block <casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSupportBlock_p; 109 : std::map <casacore::String, casacore::Int> convFunctionMap_p; 110 : casacore::Vector<casacore::Int> convSizes_p; 111 : 112 : casacore::Int actualConvIndex_p; 113 : casacore::Int convSize_p; 114 : casacore::Vector<casacore::Int> convSupport_p; 115 : casacore::Cube<casacore::Complex> convFunc_p; 116 : casacore::Double wScaler_p; 117 : casacore::Int convSampling_p; 118 : casacore::Int nx_p, ny_p; 119 : casacore::Double minW_p, maxW_p, rmsW_p; 120 : 121 : }; 122 : } //end of namespace refim 123 : } // end namespace casa 124 : #endif