OTB  9.0.0
Orfeo Toolbox
otbStereorectificationDisplacementFieldSource.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 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);
137  itkGetObjectMacro(LeftImage, InputImageType);
139 
141  itkSetObjectMacro(RightImage, InputImageType);
142  itkGetObjectMacro(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:
187  StereorectificationDisplacementFieldSource(const Self&); // purposely
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
otb::StereorectificationDisplacementFieldSource::RSTransformPointerType
RSTransformType::Pointer RSTransformPointerType
Definition: otbStereorectificationDisplacementFieldSource.h:114
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::StereorectificationDisplacementFieldSource::Superclass
itk::ImageSource< TOutputImage > Superclass
Definition: otbStereorectificationDisplacementFieldSource.h:95
otb::StereorectificationDisplacementFieldSource::m_OutputOriginInLeftImage
TDPointType m_OutputOriginInLeftImage
Definition: otbStereorectificationDisplacementFieldSource.h:220
otb::StereorectificationDisplacementFieldSource::TDPointType
RSTransformType::InputPointType TDPointType
Definition: otbStereorectificationDisplacementFieldSource.h:117
otb::StereorectificationDisplacementFieldSource::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbStereorectificationDisplacementFieldSource.h:103
otb::StereorectificationDisplacementFieldSource::m_MeanBaselineRatio
double m_MeanBaselineRatio
Definition: otbStereorectificationDisplacementFieldSource.h:224
otb::StereorectificationDisplacementFieldSource::m_ElevationOffset
double m_ElevationOffset
Definition: otbStereorectificationDisplacementFieldSource.h:193
otb::StereorectificationDisplacementFieldSource::m_LeftImage
InputImagePointerType m_LeftImage
Definition: otbStereorectificationDisplacementFieldSource.h:205
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::StereorectificationDisplacementFieldSource::m_RightToLeftTransform
RSTransformPointerType m_RightToLeftTransform
Definition: otbStereorectificationDisplacementFieldSource.h:214
otb::StereorectificationDisplacementFieldSource::SizeType
OutputImageType::SizeType SizeType
Definition: otbStereorectificationDisplacementFieldSource.h:106
otbMacro.h
otb::StereorectificationDisplacementFieldSource::m_UseDEM
bool m_UseDEM
Definition: otbStereorectificationDisplacementFieldSource.h:229
otb::StereorectificationDisplacementFieldSource::m_RightImage
InputImagePointerType m_RightImage
Definition: otbStereorectificationDisplacementFieldSource.h:208
otb::StereorectificationDisplacementFieldSource::RegionType
OutputImageType::RegionType RegionType
Definition: otbStereorectificationDisplacementFieldSource.h:109
otb::StereorectificationDisplacementFieldSource::InputImageType
TInputImage InputImageType
Definition: otbStereorectificationDisplacementFieldSource.h:100
otbStereorectificationDisplacementFieldSource.hxx
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::StereorectificationDisplacementFieldSource::m_Scale
double m_Scale
Definition: otbStereorectificationDisplacementFieldSource.h:197
otb::StereorectificationDisplacementFieldSource::SpacingType
OutputImageType::SpacingType SpacingType
Definition: otbStereorectificationDisplacementFieldSource.h:108
otb::StereorectificationDisplacementFieldSource::m_GridStep
double m_GridStep
Definition: otbStereorectificationDisplacementFieldSource.h:202
otb::StereorectificationDisplacementFieldSource::m_LeftToRightTransform
RSTransformPointerType m_LeftToRightTransform
Definition: otbStereorectificationDisplacementFieldSource.h:211
otb::StereorectificationDisplacementFieldSource::~StereorectificationDisplacementFieldSource
~StereorectificationDisplacementFieldSource(void) override
Definition: otbStereorectificationDisplacementFieldSource.h:172
otb::GenericRSTransform::InputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
Definition: otbGenericRSTransform.h:72
otb::StereorectificationDisplacementFieldSource::Self
StereorectificationDisplacementFieldSource Self
Definition: otbStereorectificationDisplacementFieldSource.h:94
otb::StereorectificationDisplacementFieldSource::InputImagePointerType
InputImageType::Pointer InputImagePointerType
Definition: otbStereorectificationDisplacementFieldSource.h:101
otb::StereorectificationDisplacementFieldSource::RSTransformType
otb::GenericRSTransform< double, 3, 3 > RSTransformType
Definition: otbStereorectificationDisplacementFieldSource.h:113
otbGenericRSTransform.h
otb::StereorectificationDisplacementFieldSource::m_RectifiedImageSize
SizeType m_RectifiedImageSize
Definition: otbStereorectificationDisplacementFieldSource.h:217
otb::StereorectificationDisplacementFieldSource
Compute the deformation fields for stereo-rectification.
Definition: otbStereorectificationDisplacementFieldSource.h:90
otb::StereorectificationDisplacementFieldSource::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStereorectificationDisplacementFieldSource.h:97
otb::StereorectificationDisplacementFieldSource::PointType
OutputImageType::PointType PointType
Definition: otbStereorectificationDisplacementFieldSource.h:107
otb::StereorectificationDisplacementFieldSource::OutputImageType
TOutputImage OutputImageType
Definition: otbStereorectificationDisplacementFieldSource.h:102
otb::StereorectificationDisplacementFieldSource::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStereorectificationDisplacementFieldSource.h:96