OTB  6.1.0
Orfeo Toolbox
otbSarParametricMapFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbSarParametricMapFunction_h
22 #define otbSarParametricMapFunction_h
23 
24 #include "itkImageFunction.h"
25 #include "itkPointSet.h"
26 #include "itkVariableSizeMatrix.h"
27 
28 namespace otb
29 {
30 
42 template <class TInputImage, class TCoordRep = float>
43 class ITK_EXPORT SarParametricMapFunction :
44  public itk::ImageFunction<TInputImage, typename itk::NumericTraits<typename TInputImage::PixelType>::ScalarRealType,
45  TCoordRep>
46 {
47 public:
51  TCoordRep> Superclass;
54 
57 
59  itkNewMacro(Self);
60 
62  typedef TInputImage InputImageType;
63  typedef typename InputImageType::PixelType InputPixelType;
64  typedef typename Superclass::OutputType OutputType;
65  typedef typename Superclass::IndexType IndexType;
66  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
67 
68  itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
69 
75 
77 
80 
82  RealType Evaluate(const PointType& point) const ITK_OVERRIDE;
83 
85  RealType EvaluateAtIndex(const IndexType& index) const ITK_OVERRIDE
86  {
87  PointType point;
88  point[0] = static_cast<typename PointType::ValueType>(index[0]);
89  point[1] = static_cast<typename PointType::ValueType>(index[1]);
90  return this->Evaluate(point);
91  }
93 
95  const ContinuousIndexType& cindex) const ITK_OVERRIDE
96  {
97  IndexType index;
98  this->ConvertContinuousIndexToNearestIndex(cindex, index);
99  return this->EvaluateAtIndex(index);
100  }
101 
103  itkGetObjectMacro(PointSet, PointSetType);
104  itkGetConstObjectMacro(PointSet, PointSetType);
106  {
107  m_IsInitialize = false;
108  m_PointSet = val;
109  this->Modified();
110  }
112 
114  itkSetMacro(Coeff, MatrixType);
115  itkGetMacro(Coeff, MatrixType);
116  itkGetConstMacro(Coeff, MatrixType);
118 
120  itkGetConstReferenceMacro(IsInitialize, bool);
121 
123  void SetPolynomalSize(const IndexType PolynomalSize);
124 
126  void EvaluateParametricCoefficient();
127 
129  void SetConstantValue(const RealType& value);
130 
131 protected:
133  ~SarParametricMapFunction() ITK_OVERRIDE{}
134  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
135 
136 private:
137  SarParametricMapFunction(const Self &); //purposely not implemented
138  void operator =(const Self&); //purposely not implemented
139 
140  double Horner(PointType point) const;
141 
145  double m_ProductWidth;
147 };
148 
149 } // end namespace otb
150 
151 #ifndef OTB_MANUAL_INSTANTIATION
153 #endif
154 
155 #endif
RealType EvaluateAtIndex(const IndexType &index) const ITK_OVERRIDE
RealType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const ITK_OVERRIDE
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::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:142
itk::NumericTraits< InputPixelType >::ScalarRealType RealType
Monteverdi_FLOATING_TYPE RealType
Definition: mvdTypes.h:93
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
VectorImageType::PointType PointType
Definition: mvdTypes.h:198
itk::SmartPointer< const Self > ConstPointer