OTB  10.0.0
Orfeo Toolbox
otbBSplineDecompositionImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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:
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
This class is an evolution of the itk::BSplineDecompositionImageFilter to handle huge images with thi...
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
BSplineDecompositionImageFilter(const Self &)=delete
void operator=(const Self &)=delete
itk::ImageLinearIteratorWithIndex< TOutputImage > OutputLinearIterator
Superclass::InputImageConstPointer InputImageConstPointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.