OTB  10.0.0
Orfeo Toolbox
otbStereorectificationDisplacementFieldSource.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 otbStereorectificationDisplacementFieldSource_h
22 #define otbStereorectificationDisplacementFieldSource_h
23 
24 #include "itkImageSource.h"
25 #include "otbGenericRSTransform.h"
26 #include "itkImageRegionIteratorWithIndex.h"
27 #include "itkVector.h"
28 #include "otbMacro.h"
29 
30 namespace otb
31 {
89 template <class TInputImage, class TOutputImage>
90 class ITK_EXPORT StereorectificationDisplacementFieldSource : public itk::ImageSource<TOutputImage>
91 {
92 public:
95  typedef itk::ImageSource<TOutputImage> Superclass;
96  typedef itk::SmartPointer<Self> Pointer;
97  typedef itk::SmartPointer<const Self> ConstPointer;
98 
99  // Inputs and outputs relative typedefs
100  typedef TInputImage InputImageType;
101  typedef typename InputImageType::Pointer InputImagePointerType;
102  typedef TOutputImage OutputImageType;
103  typedef typename OutputImageType::Pointer OutputImagePointerType;
104 
105  // Image related typedefs
106  typedef typename OutputImageType::SizeType SizeType;
107  typedef typename OutputImageType::PointType PointType;
108  typedef typename OutputImageType::SpacingType SpacingType;
109  typedef typename OutputImageType::RegionType RegionType;
110 
111  // 3D RS transform
112  // TODO: Allow tuning precision (i.e. double or float)
115 
116  // 3D points
118 
120  itkNewMacro(Self);
121 
123  itkTypeMacro(StereorectificationDisplacementFieldSource, ImageSource);
124 
126  itkSetMacro(Scale, double);
127  itkGetConstReferenceMacro(Scale, double);
129 
131  itkSetMacro(GridStep, double);
132  itkGetMacro(GridStep, double);
134 
136  itkSetObjectMacro(LeftImage, InputImageType);
139 
141  itkSetObjectMacro(RightImage, InputImageType);
144 
146  itkGetConstReferenceMacro(RectifiedImageSize, SizeType);
147 
149  itkGetConstReferenceMacro(MeanBaselineRatio, double);
150 
152  const OutputImageType* GetLeftDisplacementFieldOutput() const;
153 
155  OutputImageType* GetLeftDisplacementFieldOutput();
156 
158  const OutputImageType* GetRightDisplacementFieldOutput() const;
159 
161  OutputImageType* GetRightDisplacementFieldOutput();
162 
163  itkSetMacro(UseDEM, bool);
164  itkGetMacro(UseDEM, bool);
165  itkBooleanMacro(UseDEM);
166 
167 protected:
170 
173 
175  void GenerateOutputInformation() override;
176 
178  void EnlargeOutputRequestedRegion(itk::DataObject* itkNotUsed(output)) override;
179 
181  void GenerateData() override;
182 
184  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
185 
186 private:
188  // not
189  // implemented
190  void operator=(const Self&) = delete;
191 
194 
197  double m_Scale;
198 
202  double m_GridStep;
203 
206 
209 
212 
215 
218 
221 
225 
229  bool m_UseDEM;
230 };
232 
233 } // End namespace otb
234 
235 #ifndef OTB_MANUAL_INSTANTIATION
237 #endif
238 
239 #endif
This is the class to handle generic remote sensing transform.
itk::SmartPointer< Self > Pointer
itk::Point< ScalarType, NInputDimensions > InputPointType
Compute the deformation fields for stereo-rectification.
itkGetObjectMacro(RightImage, InputImageType)
itkGetObjectMacro(LeftImage, InputImageType)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.