Orfeo Toolbox  3.16
otbMDMDNMFImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbMDMDNMFImageFilter_h
19 #define __otbMDMDNMFImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 #include "itkVariableSizeMatrix.h"
24 
25 #include "vnl/vnl_matrix.h"
26 #include "vnl/vnl_vector.h"
27 
28 namespace otb
29 {
123 template <class TInputImage, class TOutputImage>
125  public itk::ImageToImageFilter<TInputImage, TOutputImage>
126 {
127 public:
128 
134 
136  itkNewMacro(Self);
137 
139  itkTypeMacro(MDMDNMFImageFilter, ImageToImageFilter);
140 
142  typedef TInputImage InputImageType;
143  typedef typename InputImageType::Pointer InputPointerType;
144  typedef typename InputImageType::ConstPointer InputConstPointerType;
145  typedef typename InputImageType::IndexType InputIndexType;
146  typedef typename InputImageType::SizeType InputSizeType;
147 
148  typedef TOutputImage OutputImageType;
149  typedef typename OutputImageType::Pointer OutputPointerType;
150  typedef typename OutputImageType::IndexType OutputIndexType;
151  typedef typename OutputImageType::OffsetType OutputOffsetType;
152  typedef typename OutputImageType::SizeType OutputSizeType;
153  typedef typename OutputImageType::RegionType OutputImageRegionType;
154 
155  /* Matrix type */
156  typedef double PrecisionType;
157  typedef vnl_matrix<PrecisionType> MatrixType;
159 
160  /* vector type */
161  typedef vnl_vector<double> VectorType;
162 
163  MatrixType GetEndmembersMatrix() const
164  {
165  return m_Endmembers;
166  }
167  void SetEndmembersMatrix(const MatrixType& m)
168  {
169  m_Endmembers = m;
170  }
171 
173  itkSetMacro(MaxIter, unsigned int);
174  itkGetMacro(MaxIter, unsigned int);
175 
176  itkSetMacro(CritStopValue, double);
177  itkGetMacro(CritStopValue, double);
178 
179  itkSetMacro(Delt, double);
180  itkGetMacro(Delt, double);
181 
182  itkSetMacro(LambdD, double);
183  itkGetMacro(LambdD, double);
184 
185  itkSetMacro(LambdS, double);
186  itkGetMacro(LambdS, double);
187 
188 protected:
190  virtual ~MDMDNMFImageFilter() {}
191  void PrintSelf(std::ostream& os, itk::Indent indent) const;
192 
193  virtual void GenerateInputRequestedRegion();
194 
198  virtual void GenerateOutputInformation();
199 
201  virtual void GenerateData();
202 
203 
204 private:
205  MDMDNMFImageFilter(const Self&); //purposely not implemented
206  void operator=(const Self&); //purposely not implemented
207 
208  static void AddOneRowOfOnes(const MatrixType & m, MatrixType & M);
209 
210  static double Criterion(const MatrixType & X,
211  const MatrixType & A,
212  const MatrixType & S,
213  const double &delt,
214  const double &lambdS,
215  const double &lambdD);
216 
217  static void EvalGradS(const MatrixType &X,
218  const MatrixType &A,
219  const MatrixType &S,
220  const double &delt,
221  const double &lambdS,
222  MatrixType & gradS);
223 
224  static void EvalGradA(const MatrixType &X,
225  const MatrixType &A,
226  const MatrixType &S,
227  const double &delt,
228  const double &lambdD,
229  MatrixType &gradA);
230 
231  static double Call(const MatrixType & variMat,
232  const MatrixType & fixedMat,
233  const MatrixType & X,
234  const double & delt,
235  const double & lambdS,
236  const double & lambdD, const bool isDirectEvalDirection);
237 
238  static void ProjGradOneStep(
239  const MatrixType & X,
240  const MatrixType & fixedMat,
241  const MatrixType & gradVariMat,
242  const double & sig,
243  const double & betinit,
244  const double & delt,
245  const double & lambdS,
246  const double & lambdD,
247  MatrixType & variMat,
248  double & alph, const bool isDirectEvalDirection );
249 
250  static void SetNegativeCoefficientsToZero(MatrixType & M);
251 
252  static MatrixType TermByTermMatrixProduct(const MatrixType & M1, const MatrixType & M2);
253 
254  static double SumMatrixElements(const MatrixType & M);
255 
256  static bool ArmijoTest(const double & sig,
257  const MatrixType variMat,
258  const MatrixType & newVariMat,
259  const double & evalf,
260  const double & newEvalf,
261  const MatrixType & gradVariMat,
262  const double & alph);
263 
264  // attributes
266  unsigned int m_MaxIter;
268 
269  // Optimized function parameters
270  double m_Delt;
271  double m_LambdD;
272  double m_LambdS;
273 };
274 
275 } // end namespace otb
276 
277 #ifndef OTB_MANUAL_INSTANTIATION
278 #include "otbMDMDNMFImageFilter.txx"
279 #endif
280 
281 #endif

Generated at Sun May 19 2013 00:37:54 for Orfeo Toolbox with doxygen 1.8.3.1