MaskedArrayModel.h
Classes
- MaskedArrayModel -- base class for models with an internal & external representation as a MaskedArray (full description)
Interface
- Public Members
- MaskedArrayModel()
- MaskedArrayModel(const MaskedArray<T> & model)
- MaskedArrayModel(const Array<T> & model)
- void getModel(Array<T>& model) const
- virtual void getModel(MaskedArray<T>& model) const
- MaskedArray<T> getModel() const
- void setModel(const Array<T>& model)
- virtual void setModel(const MaskedArray<T>& model)
Review Status
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
- MaskedArrays
- LinearModel
- LinearModel/LinearEquation paradigm
Synopsis
An MaskedArrayModel is a base class for Models that can be
represented by arrays with a mask (used to denote which values
are valid) . It is expected that this class will be mainly used
by inheritence from other classes which will then provide the solve()
functions necessary to update the model given an equation.
However this class does not contain any pure virtual functions and hence
can be used "as is". An example of this is given below. For an example of
how this class can be used by derived classes see the
MaskedHogbomCleanModel
class.
This class makes an internal copy of the Array supplied to it (either
when constructed or when using the setModel function). If this is found
to significantly affect performance (execution speed or memory
requirements) this may be changed to a reference, perhaps using a smart
pointer like the COWPtr
Example
MaskedArrayModel<Float> currentModel(); // Cannot use the model yet!
{
Matrix<Float> bestGuess(32,32);
... put your best guess into the Matrix ...
currentModel.setModel(bestGuess); // This does a real copy
}
ConvolutionEquation eqn(psf, dirty); // psf, and dirty are arrays defined
// elsewhere.
eqn.evaluate(result, currentModel); // Here result is the convolution of
// of the model with the psf.
Motivation
All the different image plane based clean algorithms have a common
implementation in that they can use an array to store the current
model. This class provides a way to abstract this functionality, as well
as provide a mechanism to implement "clean boxes"
Template Type Argument Requirements (T)
While the template arguement for this class can be just about anything,
the use of this class with an equation class will significantly restrict
the possible templates. I have used this class (or derivations of it)
with the following data types.
- Float
Thrown Exceptions
This class does not explicitly throw exceptions however the objects used
by this class may
To Do
- Decide whether to copy the input array by reference or stay with
the current scheme.
- Test the class with STokesVectors
Member Description
Default constructor sets the internal arrays to zero size
Construct the model from a masked array. The data is copied.
Construct the model from an array. The mask is set to be fully
transparent.
These functions return the model, either as a masked array or just
the data array itself with the mask removed.
These functions are analogous to the constructors above and must be
called when the default constructor is used. If no mask is specified
then it is by default set to totally transparent.