Line data Source code
1 : //# Copyright (C) 1998,1999,2000,2001,2003 2 : //# Associated Universities, Inc. Washington DC, USA. 3 : //# 4 : //# This program is free software; you can redistribute it and/or modify it 5 : //# under the terms of the GNU General Public License as published by the Free 6 : //# Software Foundation; either version 2 of the License, or (at your option) 7 : //# any later version. 8 : //# 9 : //# This program is distributed in the hope that it will be useful, but WITHOUT 10 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 : //# more details. 13 : //# 14 : //# You should have received a copy of the GNU General Public License along 15 : //# with this program; if not, write to the Free Software Foundation, Inc., 16 : //# 675 Massachusetts Ave, Cambridge, MA 02139, USA. 17 : //# 18 : //# Correspondence concerning AIPS++ should be addressed as follows: 19 : //# Internet email: casa-feedback@nrao.edu. 20 : //# Postal address: AIPS++ Project Office 21 : //# National Radio Astronomy Observatory 22 : //# 520 Edgemont Road 23 : //# Charlottesville, VA 22903-2475 USA 24 : //# 25 : 26 : #ifndef IMAGEANALYSIS_IMAGEREGRIDDERBASE_H 27 : #define IMAGEANALYSIS_IMAGEREGRIDDERBASE_H 28 : 29 : #include <imageanalysis/ImageAnalysis/ImageTask.h> 30 : #include <casacore/scimath/Mathematics/Interpolate2D.h> 31 : #include <casacore/casa/namespace.h> 32 : 33 : namespace casa { 34 : 35 : template <class T> class ImageRegridderBase : public ImageTask<T> { 36 : // <summary> 37 : // casacore::Data store of ImageRegridder and ComplexImageRegridder 38 : // TODO ComplexImageRegridder has been removed so this class can probably 39 : // be merged into ImageRegridder 40 : // </summary> 41 : 42 : // <reviewed reviewer="" date="" tests="" demos=""> 43 : // </reviewed> 44 : 45 : // <prerequisite> 46 : // </prerequisite> 47 : 48 : // <etymology> 49 : // casacore::Data for image regridder. 50 : // </etymology> 51 : 52 : // <synopsis> 53 : // </synopsis> 54 : 55 : template<typename U> friend class ImageRegridderBase; 56 : 57 : public: 58 : 59 : ImageRegridderBase() = delete; 60 : 61 : // destructor 62 : virtual ~ImageRegridderBase(); 63 : 64 : // regrid the spectral axis in velocity space rather than frequency space? 65 : void setSpecAsVelocity(casacore::Bool v) { _specAsVelocity = v; } 66 : 67 : // Set interpolation method. 68 0 : void setMethod(const casacore::String& method) { 69 0 : _method = casacore::Interpolate2D::stringToMethod(method); 70 0 : } 71 : 72 70 : void setMethod(casacore::Interpolate2D::Method method) { _method = method; } 73 : 74 : void setDoRefChange(casacore::Bool d) { _doRefChange = d; } 75 : 76 0 : void setReplicate(casacore::Bool r) { _replicate = r; } 77 : 78 : // throws exception if 3*decimate > length of an axis that will be regridded 79 : void setDecimate(casacore::Int d); 80 : 81 : void setForceRegrid(casacore::Bool f) { _forceRegrid = f; } 82 : 83 0 : void setShape(const casacore::IPosition s) { _shape = s; } 84 : 85 : virtual SPIIT regrid() const = 0; 86 : 87 : template <class U> void setConfiguration(const ImageRegridderBase<U>& that); 88 : 89 : protected: 90 : 91 : ImageRegridderBase( 92 : const SPCIIT image, const casacore::Record *const regionRec, 93 : const casacore::String& maskInp, const casacore::String& outname, 94 : casacore::Bool overwrite, const casacore::CoordinateSystem& csys, 95 : const casacore::IPosition& axes, const casacore::IPosition& shape 96 : ); 97 : 98 0 : casacore::Interpolate2D::Method _getMethod() const { return _method; } 99 : 100 0 : casacore::Bool _getDoRefChange() const { return _doRefChange; } 101 : 102 0 : casacore::Bool _getReplicate() const { return _replicate; } 103 : 104 0 : casacore::Int _getDecimate() const { return _decimate;} 105 : 106 0 : casacore::Bool _getForceRegrid() const { return _forceRegrid; } 107 : 108 0 : inline CasacRegionManager::StokesControl _getStokesControl() const { 109 0 : return CasacRegionManager::USE_ALL_STOKES; 110 : } 111 : 112 0 : inline std::vector<casacore::Coordinate::Type> _getNecessaryCoordinates() const { 113 0 : return std::vector<casacore::Coordinate::Type>(0); 114 : } 115 : 116 0 : casacore::Bool _getSpecAsVelocity() const { return _specAsVelocity; } 117 : 118 0 : casacore::IPosition _getShape() const {return _shape;} 119 : 120 0 : const casacore::CoordinateSystem& _getTemplateCoords() const { 121 0 : return _csysTo; 122 : } 123 : 124 0 : casacore::IPosition _getAxes() const { return _axes; } 125 : 126 0 : casacore::IPosition _getKludgedShape() const { return _kludgedShape; } 127 : 128 0 : std::vector<casacore::String> _getOutputStokes() const { return _outputStokes; } 129 : 130 0 : casacore::uInt _getNReplicatedChans() const { return _nReplicatedChans; } 131 : 132 : casacore::Bool _regriddingDirectionAxes() const; 133 : 134 : private: 135 : const casacore::CoordinateSystem _csysTo; 136 : casacore::IPosition _axes, _shape, _kludgedShape; 137 : casacore::Bool _specAsVelocity, _doRefChange, _replicate, _forceRegrid; 138 : casacore::Int _decimate; 139 : casacore::Interpolate2D::Method _method; 140 : std::vector<casacore::String> _outputStokes; 141 : casacore::uInt _nReplicatedChans; 142 : 143 : void _finishConstruction(); 144 : 145 : }; 146 : } 147 : 148 : #ifndef AIPS_NO_TEMPLATE_SRC 149 : #include <imageanalysis/ImageAnalysis/ImageRegridderBase.tcc> 150 : #endif //# AIPS_NO_TEMPLATE_SRC 151 : 152 : #endif