casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaskedArrayModel.h
Go to the documentation of this file.
1 //# MaskedArrayModel.h: this defines MaskedArrayModel
2 //# Copyright (C) 1996,1997,1999
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: 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_MASKEDARRAYMODEL_H
30 #define SYNTHESIS_MASKEDARRAYMODEL_H
31 
32 
33 #include <casa/aips.h>
35 #include <casa/Arrays/Array.h>
37 
38 namespace casa { //# NAMESPACE CASA - BEGIN
39 
40 // <summary>
41 // base class for models with an internal & external representation
42 // as a casacore::MaskedArray
43 // </summary>
44 
45 // <use visibility=export>
46 
47 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
48 // </reviewed>
49 
50 // <prerequisite>
51 // <li> MaskedArrays
52 // <li> LinearModel
53 // <li> LinearModel/LinearEquation paradigm
54 // </prerequisite>
55 //
56 // <synopsis>
57 // An MaskedArrayModel is a base class for Models that can be
58 // represented by arrays with a mask (used to denote which values
59 // are valid) . It is expected that this class will be mainly used
60 // by inheritence from other classes which will then provide the solve()
61 // functions necessary to update the model given an equation.
62 //
63 // However this class does not contain any pure virtual functions and hence
64 // can be used "as is". An example of this is given below. For an example of
65 // how this class can be used by derived classes see the
66 // <linkto class=MaskedHogbomCleanModel>MaskedHogbomCleanModel</linkto>
67 // class.
68 //
69 // This class makes an internal copy of the casacore::Array supplied to it (either
70 // when constructed or when using the setModel function). If this is found
71 // to significantly affect performance (execution speed or memory
72 // requirements) this may be changed to a reference, perhaps using a smart
73 // pointer like the <linkto class=casacore::COWPtr>COWPtr</linkto>
74 // </synopsis>
75 //
76 // <example>
77 // <srcblock>
78 // MaskedArrayModel<casacore::Float> currentModel(); // Cannot use the model yet!
79 // {
80 // casacore::Matrix<casacore::Float> bestGuess(32,32);
81 // ... put your best guess into the casacore::Matrix ...
82 // currentModel.setModel(bestGuess); // This does a real copy
83 // }
84 // ConvolutionEquation eqn(psf, dirty); // psf, and dirty are arrays defined
85 // // elsewhere.
86 // eqn.evaluate(result, currentModel); // Here result is the convolution of
87 // // of the model with the psf.
88 // </srcblock>
89 // </example>
90 //
91 // <motivation>
92 // All the different image plane based clean algorithms have a common
93 // implementation in that they can use an array to store the current
94 // model. This class provides a way to abstract this functionality, as well
95 // as provide a mechanism to implement "clean boxes"
96 // </motivation>
97 //
98 // <templating arg=T>
99 // While the template arguement for this class can be just about anything,
100 // the use of this class with an equation class will significantly restrict
101 // the possible templates. I have used this class (or derivations of it)
102 // with the following data types.
103 // <li> Float
104 // </templating>
105 //
106 // <thrown>
107 // This class does not explicitly throw exceptions however the objects used
108 // by this class may
109 // </thrown>
110 //
111 // <todo asof="1996/05/14">
112 // <li> Decide whether to copy the input array by reference or stay with
113 // the current scheme.
114 // <li> Test the class with STokesVectors
115 // </todo>
116 
117 template<class T> class MaskedArrayModel:
118  public LinearModel< casacore::MaskedArray<T> > {
119 public:
120  // Default constructor sets the internal arrays to zero size
122  // Construct the model from a masked array. The data is copied.
124  // Construct the model from an array. The mask is set to be fully
125  // transparent.
126  MaskedArrayModel(const casacore::Array<T> & model);
127 
128  // These functions return the model, either as a masked array or just
129  // the data array itself with the mask removed.
130  // <group>
131  void getModel(casacore::Array<T>& model) const;
132  virtual void getModel(casacore::MaskedArray<T>& model) const;
134  // </group>
135  // These functions are analogous to the constructors above and must be
136  // called when the default constructor is used. If no mask is specified
137  // then it is by default set to totally transparent.
138  // <group>
139  void setModel(const casacore::Array<T>& model);
140  virtual void setModel(const casacore::MaskedArray<T>& model);
141  // </group>
142 
143 protected:
145 };
146 
147 
148 } //# NAMESPACE CASA - END
149 
150 #ifndef AIPS_NO_TEMPLATE_SRC
151 #include <synthesis/MeasurementEquations/MaskedArrayModel.tcc>
152 #endif //# AIPS_NO_TEMPLATE_SRC
153 #endif
void setModel(const casacore::Array< T > &model)
These functions are analogous to the constructors above and must be called when the default construct...
MaskedArrayModel()
Default constructor sets the internal arrays to zero size.
casacore::MaskedArray< T > getModel() const
Return the current model.
Class for masking an Array for operations on that Array.
base class for models with an internal &amp; external representation as a casacore::MaskedArray ...
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
casacore::MaskedArray< T > theModel
Provides a model for use in model fitting applications.