casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MomentFit.h
Go to the documentation of this file.
1 //# MomentFit.h:
2 //# Copyright (C) 1997,1999,2000,2001,2002
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 //# $Id: MomentCalculator.h 20299 2008-04-03 05:56:44Z gervandiepen $
27 
28 #ifndef IMAGEANALYSIS_MOMENTFIT_H
29 #define IMAGEANALYSIS_MOMENTFIT_H
30 
31 #include <casa/aips.h>
37 #include <casa/Arrays/Vector.h>
38 #include <casa/Logging/LogIO.h>
39 
40 namespace casa {
41 
42 template <class T> class MomentsBase;
43 
44 // <summary> Compute moments from a Gaussian fitted to a profile</summary>
45 // <use visibility=export>
46 //
47 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
48 // </reviewed>
49 //
50 // <prerequisite>
51 // <li> <linkto class="MomentsBase">MomentsBase</linkto>
52 // <li> <linkto class="ImageMoments">ImageMoments</linkto>
53 // <li> <linkto class="MSMoments">MSMoments</linkto>
54 // <li> <linkto class="casacore::LatticeApply">casacore::LatticeApply</linkto>
55 // <li> <linkto class="MomentCalcBase">MomentCalcBase</linkto>
56 // <li> <linkto class="casacore::LineCollapser">casacore::LineCollapser</linkto>
57 // </prerequisite>
58 //
59 // <synopsis>
60 // This concrete class is derived from the abstract base class MomentCalcBase
61 // which provides an interface layer to the ImageMoments or MSMoments driver class.
62 // ImageMoments or MSMoments creates a MomentFit object and passes it to the LatticeApply
63 // function, lineMultiApply. This function iterates through a given lattice,
64 // and invokes the <src>multiProcess</src> member function of MomentFit on each vector
65 // of pixels that it extracts from the input lattice. The <src>multiProcess</src>
66 // function returns a vector of moments which are inserted into the output
67 // lattices also supplied to the casacore::LatticeApply function.
68 //
69 // MomentFit computes moments by fitting a Gaussian to each profile. The
70 // moments are then computed from that fit. The fitting can be done either
71 // interactively or automatically.
72 //
73 // The constructor takes MomentsBase object that is actually an ImageMoments or
74 // an MSMoments object; the one that is constructing
75 // the MomentFit object of course. There is much control information embodied
76 // in the state of the ImageMoments object. This information is extracted by the
77 // MomentCalcBase class and passed on to MomentFit for consumption.
78 //
79 // See the <linkto class="MomentsBase">MomentsBase</linkto>,
80 // <linkto class="ImageMoments">ImageMoments</linkto>, and
81 // <linkto class="MSMoments">MSMoments</linkto>
82 // for discussion about the moments that are available for computation.
83 //
84 // </synopsis>
85 //
86 // <example>
87 // This example comes from ImageMoments. outPt is a pointer block holding
88 // pointers to the output lattices. os_P is a casacore::LogIO object.
89 //
90 // <srcBlock>
91 //
94 //
95 // MomentCalcBase<T>* pMomentCalculator = 0;
96 // if (clipMethod || smoothClipMethod) {
97 // pMomentCalculator = new MomentClip<T>(pSmoothedImage, *this, os_p, outPt.nelements());
98 // } else if (windowMethod) {
99 // pMomentCalculator = new MomentWindow<T>(pSmoothedImage, *this, os_p, outPt.nelements());
100 // } else if (fitMethod) {
101 // pMomentCalculator = new MomentFit<T>(*this, os_p, outPt.nelements());
102 // }
103 //
105 //
106 // casacore::LatticeApply<T>::lineMultiApply(outPt, *pInImage_p, *pMomentCalculator,
107 // momentAxis_p, pProgressMeter);
108 // delete pMomentCalculator;
109 // </srcBlock>
110 // </example>
111 //
112 // <motivation>
113 // </motivation>
114 //
115 // <note role=tip>
116 // Note that there are is assignment operator or copy constructor.
117 // Do not use the ones the system would generate either.
118 // </note>
119 //
120 // <todo asof="yyyy/mm/dd">
121 // </todo>
122 
123 template <class T> class MomentFit : public MomentCalcBase<T>
124 {
125 public:
126 
127 // Constructor. We need the ImageMoments or MSMoments object which is calling us,
128 // its logger, and the number of output lattices it has created.
130  casacore::LogIO& os,
131  const casacore::uInt nLatticeOut);
132 
133 // Destructor (does nothing).
134  virtual ~MomentFit();
135 
136 // This function is not implemented and throws an exception.
137  virtual void process(T& out,
138  casacore::Bool& outMask,
139  const casacore::Vector<T>& in,
140  const casacore::Vector<casacore::Bool>& inMask,
141  const casacore::IPosition& pos);
142 
143 // This function returns a vector of numbers from each input vector.
144 // the output vector contains the moments known to the ImageMoments
145 // or MSMoments object passed into the constructor.
146  virtual void multiProcess(casacore::Vector<T>& out,
148  const casacore::Vector<T>& in,
149  const casacore::Vector<casacore::Bool>& inMask,
150  const casacore::IPosition& pos);
151 
152 private:
158 
159  //# Make members of parent class known.
160 protected:
179 };
180 
181 }
182 
183 #ifndef CASACORE_NO_AUTO_TEMPLATES
184 #include <imageanalysis/ImageAnalysis/MomentFit.tcc>
185 #endif
186 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A 1-D Specialization of the Array class.
This class is a base class for generating moments from an image or a spectral data.
virtual void process(T &out, casacore::Bool &outMask, const casacore::Vector< T > &in, const casacore::Vector< casacore::Bool > &inMask, const casacore::IPosition &pos)
This function is not implemented and throws an exception.
Compute moments from a Gaussian fitted to a profile.
Definition: MomentFit.h:123
Abstract base class for moment calculator classes.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
virtual void multiProcess(casacore::Vector< T > &out, casacore::Vector< casacore::Bool > &outMask, const casacore::Vector< T > &in, const casacore::Vector< casacore::Bool > &inMask, const casacore::IPosition &pos)
This function returns a vector of numbers from each input vector.
A one dimensional Gaussian class.
Definition: Gaussian1D.h:135
MomentFit(MomentsBase< T > &iMom, casacore::LogIO &os, const casacore::uInt nLatticeOut)
Constructor.
casacore::Bool doFit_p
Definition: MomentFit.h:156
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Gaussian1D< T > gauss_p
Definition: MomentFit.h:157
casacore::LogIO os_p
Definition: MomentFit.h:154
MomentsBase< T > & iMom_p
Definition: MomentFit.h:153
virtual ~MomentFit()
Destructor (does nothing).
unsigned int uInt
Definition: aipstype.h:51