OTB  9.0.0
Orfeo Toolbox
otbBSplineDecompositionImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 otbBSplineDecompositionImageFilter_h
22 #define otbBSplineDecompositionImageFilter_h
23 
24 #include <vector>
25 
26 #include "itkImageLinearIteratorWithIndex.h"
27 #include "vnl/vnl_matrix.h"
28 
29 #include "itkImageToImageFilter.h"
30 
31 namespace otb
32 {
42 template <class TInputImage, class TOutputImage>
43 class ITK_EXPORT BSplineDecompositionImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
44 {
45 public:
48  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
49  typedef itk::SmartPointer<Self> Pointer;
50  typedef itk::SmartPointer<const Self> ConstPointer;
51 
53  itkTypeMacro(BSplineDecompositionImageFilter, ImageToImageFilter);
54 
56  itkNewMacro(Self);
57 
59  typedef typename Superclass::InputImageType InputImageType;
60  typedef typename Superclass::InputImagePointer InputImagePointer;
61  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
62  typedef typename Superclass::OutputImagePointer OutputImagePointer;
63 
65  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
66  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
68 
70  typedef itk::ImageLinearIteratorWithIndex<TOutputImage> OutputLinearIterator;
71 
74  void SetSplineOrder(unsigned int SplineOrder);
75  itkGetMacro(SplineOrder, int);
77 
78 protected:
81  {
82  }
83  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
84 
85  void GenerateData() override;
86 
88  std::vector<double> m_Scratch; // temp storage for processing of Coefficients
89  typename TInputImage::SizeType m_DataLength; // Image size
90  unsigned int m_SplineOrder; // User specified spline order (3rd or cubic is the default)
91  double m_SplinePoles[3]; // Poles calculated for a given spline order
92  int m_NumberOfPoles; // number of poles
93  double m_Tolerance; // Tolerance used for determining initial causal coefficient
94  unsigned int m_IteratorDirection; // Direction for iterator incrementing
95 
96 private:
97  BSplineDecompositionImageFilter(const Self&) = delete;
98  void operator=(const Self&) = delete;
99 
101  virtual void SetPoles();
102 
104  virtual bool DataToCoefficients1D();
105 
108  void DataToCoefficientsND();
109 
111  virtual void SetInitialCausalCoefficient(double z);
112 
114  virtual void SetInitialAntiCausalCoefficient(double z);
115 
117  void CopyImageToImage();
118 
120  void CopyCoefficientsToScratch(OutputLinearIterator&);
121 
123  void CopyScratchToCoefficients(OutputLinearIterator&);
124 };
125 
126 } // namespace itk
127 
128 #ifndef OTB_MANUAL_INSTANTIATION
130 #endif
131 
132 #endif
otb::BSplineDecompositionImageFilter::m_DataLength
TInputImage::SizeType m_DataLength
Definition: otbBSplineDecompositionImageFilter.h:89
otb::BSplineDecompositionImageFilter::OutputLinearIterator
itk::ImageLinearIteratorWithIndex< TOutputImage > OutputLinearIterator
Definition: otbBSplineDecompositionImageFilter.h:70
otbBSplineDecompositionImageFilter.hxx
otb::BSplineDecompositionImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbBSplineDecompositionImageFilter.h:50
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::BSplineDecompositionImageFilter
This class is an evolution of the itk::BSplineDecompositionImageFilter to handle huge images with thi...
Definition: otbBSplineDecompositionImageFilter.h:43
otb::BSplineDecompositionImageFilter::m_IteratorDirection
unsigned int m_IteratorDirection
Definition: otbBSplineDecompositionImageFilter.h:94
otb::BSplineDecompositionImageFilter::m_SplineOrder
unsigned int m_SplineOrder
Definition: otbBSplineDecompositionImageFilter.h:90
otb::BSplineDecompositionImageFilter::Self
BSplineDecompositionImageFilter Self
Definition: otbBSplineDecompositionImageFilter.h:47
otb::BSplineDecompositionImageFilter::~BSplineDecompositionImageFilter
~BSplineDecompositionImageFilter() override
Definition: otbBSplineDecompositionImageFilter.h:80
otb::BSplineDecompositionImageFilter::InputImageConstPointer
Superclass::InputImageConstPointer InputImageConstPointer
Definition: otbBSplineDecompositionImageFilter.h:61
otb::BSplineDecompositionImageFilter::m_Scratch
std::vector< double > m_Scratch
Definition: otbBSplineDecompositionImageFilter.h:88
otb::BSplineDecompositionImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbBSplineDecompositionImageFilter.h:48
otb::BSplineDecompositionImageFilter::InputImagePointer
Superclass::InputImagePointer InputImagePointer
Definition: otbBSplineDecompositionImageFilter.h:60
otb::BSplineDecompositionImageFilter::m_NumberOfPoles
int m_NumberOfPoles
Definition: otbBSplineDecompositionImageFilter.h:92
otb::BSplineDecompositionImageFilter::InputImageType
Superclass::InputImageType InputImageType
Definition: otbBSplineDecompositionImageFilter.h:56
otb::BSplineDecompositionImageFilter::m_Tolerance
double m_Tolerance
Definition: otbBSplineDecompositionImageFilter.h:93
otb::BSplineDecompositionImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbBSplineDecompositionImageFilter.h:49
otb::BSplineDecompositionImageFilter::OutputImagePointer
Superclass::OutputImagePointer OutputImagePointer
Definition: otbBSplineDecompositionImageFilter.h:62