OTB  5.0.0
Orfeo Toolbox
otbSarParametricMapFunction.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 __otbSarParametricMapFunction_h
19 #define __otbSarParametricMapFunction_h
20 
21 #include "itkImageFunction.h"
22 #include "itkPointSet.h"
23 #include "itkVariableSizeMatrix.h"
24 
25 namespace otb
26 {
27 
39 template <class TInputImage, class TCoordRep = float>
40 class ITK_EXPORT SarParametricMapFunction :
41  public itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::ScalarRealType,
42  TCoordRep>
43 {
44 public:
48  TCoordRep> Superclass;
51 
54 
56  itkNewMacro(Self);
57 
59  typedef TInputImage InputImageType;
60  typedef typename InputImageType::PixelType InputPixelType;
61  typedef typename Superclass::OutputType OutputType;
62  typedef typename Superclass::IndexType IndexType;
63  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
64 
65  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
66 
72 
74 
77 
79  virtual RealType Evaluate(const PointType& point) const;
80 
82  virtual RealType EvaluateAtIndex(const IndexType& index) const
83  {
84  PointType point;
85  point[0] = static_cast<typename PointType::ValueType>(index[0]);
86  point[1] = static_cast<typename PointType::ValueType>(index[1]);
87  return this->Evaluate(point);
88  }
90 
92  const ContinuousIndexType& cindex) const
93  {
94  IndexType index;
95  this->ConvertContinuousIndexToNearestIndex(cindex, index);
96  return this->EvaluateAtIndex(index);
97  }
98 
100  itkGetObjectMacro(PointSet, PointSetType);
101  itkGetConstObjectMacro(PointSet, PointSetType);
103  {
104  m_IsInitialize = false;
105  m_PointSet = val;
106  this->Modified();
107  }
109 
111  itkSetMacro(Coeff, MatrixType);
112  itkGetMacro(Coeff, MatrixType);
113  itkGetConstMacro(Coeff, MatrixType);
115 
117  itkGetConstReferenceMacro(IsInitialize, bool);
118 
120  void SetPolynomalSize(const IndexType PolynomalSize);
121 
123  void EvaluateParametricCoefficient();
124 
126  void SetConstantValue(const RealType& value);
127 
128 protected:
131  void PrintSelf(std::ostream& os, itk::Indent indent) const;
132 
133 private:
134  SarParametricMapFunction(const Self &); //purposely not implemented
135  void operator =(const Self&); //purposely not implemented
136 
137  double Horner(PointType point) const;
138 
142  double m_ProductWidth;
144 };
145 
146 } // end namespace otb
147 
148 #ifndef OTB_MANUAL_INSTANTIATION
150 #endif
151 
152 #endif
itk::ImageFunction< TInputImage, typename itk::NumericTraits< typename TInputImage::PixelType >::ScalarRealType, TCoordRep > Superclass
itk::PointSet< OutputType, ImageDimension > PointSetType
MeshTraits::PixelType PixelType
Superclass::ContinuousIndexType ContinuousIndexType
InputImageType::PixelType InputPixelType
itk::NumericTraits< InputPixelType >::ScalarRealType RealType
virtual RealType EvaluateAtIndex(const IndexType &index) const
RealType ScalarRealType
MeshTraits::PointType PointType
itk::VariableSizeMatrix< double > MatrixType
Evaluates a parametric bidimensionnal polynomial model from a PointSet.
double m_ProductHeight
the width of the complete product (read from metadata)
PointSetType::ConstPointer PointSetConstPointer
virtual RealType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const
itk::SmartPointer< const Self > ConstPointer