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: 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_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 : 94 0 : virtual casacore::Bool makeAverageResponse(const vi::VisBuffer2& /*vb*/, 95 : const casacore::ImageInterface<casacore::Complex>& /*image*/, 96 : // casacore::TempImage<casacore::Float>& theavgPB, 97 : casacore::ImageInterface<casacore::Float>& /*theavgPB*/, 98 : casacore::Bool /*reset=true*/) 99 0 : {throw(casacore::AipsError("WPConvFunc::makeAverageRes() called"));}; 100 : ///Make full WConfFunction, despite it being circularly symmetric; can be used along 101 : // with A-term convolution for a Vector of W values 102 : // is the coordinateSystem to get the scale of pixels 103 : // csys is the image based csys it will be returned in the UV domain 104 : casacore::Bool makeWConvFuncs(casacore::Cube<casacore::Complex>& wconv, casacore::Vector<casacore::Int>& supports, casacore::CoordinateSystem& cs, const casacore::Int& npix, const casacore::Vector<casacore::Double>& wVals); 105 : 106 : // wVal is the w-value in lambda 107 : casacore::Bool makeSkyWFunc(casacore::Matrix<casacore::Complex>& wSkyFunc, const casacore::CoordinateSystem& cs, const casacore::Int& npix, const casacore::Double& wVal); 108 : 109 : //Serialization 110 : casacore::Bool toRecord(casacore::RecordInterface& rec); 111 : casacore::Bool fromRecord(casacore::String& err, const casacore::RecordInterface& rec); 112 : private: 113 : casacore::Bool checkCenterPix(const casacore::ImageInterface<casacore::Complex>& image); 114 : 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); 115 : casacore::Int findSupport(casacore::Matrix<casacore::Complex>& scr); 116 : casacore::Block <casacore::CountedPtr<casacore::Cube<casacore::Complex> > > convFunctions_p; 117 : casacore::Block <casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSupportBlock_p; 118 : std::map <casacore::String, casacore::Int> convFunctionMap_p; 119 : casacore::Vector<casacore::Int> convSizes_p; 120 : 121 : casacore::Int actualConvIndex_p; 122 : casacore::Int convSize_p; 123 : casacore::Vector<casacore::Int> convSupport_p; 124 : casacore::Cube<casacore::Complex> convFunc_p; 125 : casacore::Double wScaler_p; 126 : casacore::Int convSampling_p; 127 : casacore::Int nx_p, ny_p; 128 : casacore::Double minW_p, maxW_p, rmsW_p; 129 : 130 : }; 131 : } //end of namespace refim 132 : } // end namespace casa 133 : #endif