Line data Source code
1 : //# LatticeModel.h: this defines LatticeModel 2 : //# Copyright (C) 1996,1997,1999,2000 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 addressed 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_LATTICEMODEL_H 30 : #define SYNTHESIS_LATTICEMODEL_H 31 : 32 : #include <casacore/casa/aips.h> 33 : #include <synthesis/MeasurementEquations/LinearModel.h> 34 : #include <casacore/lattices/Lattices/Lattice.h> 35 : 36 : namespace casa { //# NAMESPACE CASA - BEGIN 37 : 38 : // <summary> models with an internal & external representation as an casacore::Lattice </summary> 39 : 40 : // <use visibility=export> 41 : 42 : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 43 : // </reviewed> 44 : 45 : // <prerequisite> 46 : // <li> <linkto module="Lattices">Lattices</linkto> module 47 : // <li> <linkto class="LinearModel">LinearModel</linkto> class 48 : // <li> LinearModel/LinearEquation paradigm 49 : // </prerequisite> 50 : // 51 : // <synopsis> 52 : // An LatticeModel is a base class for Models that can be 53 : // represented by Lattices. It is expected that this class will be mainly 54 : // used as base classes for other classes which will then provide the solve() 55 : // functions necessary to update the model given an equation. 56 : // 57 : // However this class does not contain any pure virtual functions and hence 58 : // can be used "as is". An example of this is given below. For an example of 59 : // how this class can be used by derived classes see the 60 : // <linkto class=HogbomCleanModel>HogbomCleanModel</linkto> 61 : // class. 62 : // 63 : // </synopsis> 64 : // 65 : // <example> 66 : // <srcblock> 67 : // LatticeModel<casacore::Float> currentModel(); // Cannot use the model yet! 68 : // { 69 : // casacore::PagedImage<casacore::Float> bestGuess(Iposition(2,32,32)); 70 : // ... put your best guess into the casacore::Matrix ... 71 : // currentModel.setModel(bestGuess); // This does a real copy 72 : // } 73 : // ConvolutionEquation eqn(psf, dirty); // psf, and dirty are PagedImages defined 74 : // // elsewhere. 75 : // eqn.evaluate(result, currentModel); // Here result is the convolution of 76 : // // of the model with the psf. 77 : // </srcblock> 78 : // </example> 79 : // 80 : // <motivation> 81 : // All the different image plane based clean algorithms have a common 82 : // implementation in that they can use an casacore::Lattice (ie, casacore::PagedImage) 83 : // to store the current 84 : // model. This class provides a way to abstract this functionality. 85 : // </motivation> 86 : // 87 : // <templating arg=T> 88 : // While the template arguement for this class can be just about anything, 89 : // the use of this class with an equation class will significantly restrict 90 : // the possible templates. I have used this class (or derivations of it) 91 : // with the following data types. 92 : // <li> Float 93 : // <li> StokesVector 94 : // </templating> 95 : // 96 : // <thrown> 97 : // This class does not explicitly throw exceptions however the objects used 98 : // by this class may 99 : // </thrown> 100 : // 101 : // <todo asof="1998/11/06"> 102 : // <li> We don't have any "set" or "constructor" methods which 103 : // take constants. We work in terms of pointers now because of 104 : // casacore::Lattice::operator= is protected, and Ger said it was the right thing. 105 : // </todo> 106 : 107 : class LatticeModel 108 : :public LinearModel<casacore::Lattice<casacore::Float> > { 109 : public: 110 : 111 : LatticeModel(casacore::Lattice<casacore::Float>& mod); 112 : 113 : // The destructor does nothing. 114 : virtual ~LatticeModel(); 115 : 116 : // returns a reference to the model 117 0 : virtual const casacore::Lattice<casacore::Float> & getModel() const { return *itsModelPtr;} 118 : 119 : // Change the underlying Model to to the one specified. Reference semantics 120 : // are used so that no data is copied. 121 0 : virtual void setModel(const casacore::Lattice<casacore::Float> & model) { itsModelPtr = model.clone(); } 122 : 123 : private: 124 : 125 : casacore::Lattice<casacore::Float> * itsModelPtr; 126 : }; 127 : 128 : 129 : } //# NAMESPACE CASA - END 130 : 131 : #endif