OTB  9.0.0
Orfeo Toolbox
otbGenericRSResampleImageFilter.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 otbGenericRSResampleImageFilter_h
22 #define otbGenericRSResampleImageFilter_h
23 
26 #include <string>
27 
28 namespace otb
29 {
30 
55 template <class TInputImage, class TOutputImage>
56 class ITK_EXPORT GenericRSResampleImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
57 {
58 public:
61  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
62  typedef itk::SmartPointer<Self> Pointer;
63  typedef itk::SmartPointer<const Self> ConstPointer;
64 
66  itkNewMacro(Self);
67 
69  itkTypeMacro(GenericRSResampleImageFilter, itk::ImageToImageFilter);
70 
72  typedef TInputImage InputImageType;
73  typedef TOutputImage OutputImageType;
74  typedef typename OutputImageType::InternalPixelType OutputInternalPixelType;
75  typedef typename OutputImageType::PointType OutputPointType;
76 
87 
91 
94 
95 
101 
102  typedef itk::ImageBase<OutputImageType::ImageDimension> ImageBaseType;
103 
105  otbSetObjectMemberMacro(Resampler, DisplacementFieldSpacing, SpacingType);
106 
107  otbGetObjectMemberConstReferenceMacro(Resampler, DisplacementFieldSpacing, SpacingType);
108 
112  void SetOutputOrigin(const OriginType& origin)
113  {
114  m_Resampler->SetOutputOrigin(origin);
115  this->Modified();
116  }
117  otbGetObjectMemberConstReferenceMacro(Resampler, OutputOrigin, OriginType);
119 
121  otbSetObjectMemberMacro(Resampler, OutputStartIndex, IndexType);
122  otbGetObjectMemberConstReferenceMacro(Resampler, OutputStartIndex, IndexType);
124 
126  otbSetObjectMemberMacro(Resampler, OutputSize, SizeType);
127  otbGetObjectMemberConstReferenceMacro(Resampler, OutputSize, SizeType);
129 
131  otbSetObjectMemberMacro(Resampler, OutputSpacing, SpacingType);
132  otbGetObjectMemberConstReferenceMacro(Resampler, OutputSpacing, SpacingType);
134 
136  void SetInterpolator(InterpolatorType* interpolator)
137  {
138  m_Resampler->SetInterpolator(interpolator);
139  this->Modified();
140  }
141  otbGetObjectMemberConstMacro(Resampler, Interpolator, const InterpolatorType*);
143 
145  otbSetObjectMemberMacro(Resampler, EdgePaddingValue, typename OutputImageType::PixelType);
146  otbGetObjectMemberMacro(Resampler, EdgePaddingValue, typename OutputImageType::PixelType);
148 
154  void SetInputProjectionRef(const std::string& ref)
155  {
156  m_Transform->SetOutputProjectionRef(ref);
157  this->Modified();
158  }
160 
161  std::string GetInputProjectionRef() const
162  {
163  return m_Transform->GetOutputProjectionRef();
164  }
165 
166  void SetOutputProjectionRef(const std::string& ref)
167  {
168  m_Transform->SetInputProjectionRef(ref);
169  this->Modified();
170  }
171 
172  std::string GetOutputProjectionRef() const
173  {
174  return m_Transform->GetInputProjectionRef();
175  }
176 
180  {
181  m_Transform->SetOutputImageMetadata(imd);
182  this->Modified();
183  }
185 
187  {
188  return m_Transform->GetOutputImageMetadata();
189  }
190 
194  {
195  m_Transform->SetInputImageMetadata(imd);
196  this->Modified();
197  }
199 
201  {
202  return m_Transform->GetInputImageMetadata();
203  }
204 
206  void SetOutputParametersFromImage(const ImageBaseType* image);
207 
211  template <class TImageType>
212  void SetOutputParametersFromImage(const TImageType* image);
213 
217  void SetOutputParametersFromMap(const std::string& map, const SpacingType& spacing);
218 
222  void SetOutputParametersFromMap(const std::string& projectionRef);
223 
225  void SetInputRpcGridSize(const SizeType& gridSize)
226  {
227  m_InputRpcEstimator->SetGridSize(gridSize);
228  this->Modified();
229  }
230 
232  void SetInputRpcGridSize(unsigned int gridSize)
233  {
234  m_InputRpcEstimator->SetGridSize(gridSize);
235  this->Modified();
236  }
237 
240  {
241  return m_InputRpcEstimator->GetGridSize();
242  }
243 
245  itkSetMacro(EstimateInputRpcModel, bool);
246  itkGetMacro(EstimateInputRpcModel, bool);
247  itkBooleanMacro(EstimateInputRpcModel);
249 
251  void SetOutputRpcGridSize(const SizeType& gridSize)
252  {
253  m_OutputRpcEstimator->SetGridSize(gridSize);
254  this->Modified();
255  }
256 
258  void SetOutputRpcGridSize(unsigned int gridSize)
259  {
260  m_OutputRpcEstimator->SetGridSize(gridSize);
261  this->Modified();
262  }
263 
266  {
267  return m_OutputRpcEstimator->GetGridSize();
268  }
269 
271  itkSetMacro(EstimateOutputRpcModel, bool);
272  itkGetMacro(EstimateOutputRpcModel, bool);
273  itkBooleanMacro(EstimateOutputRpcModel);
275 
277  void SetDisplacementFilterNumberOfThreads(unsigned int nbThread)
278  {
279  m_Resampler->SetDisplacementFilterNumberOfThreads(nbThread);
280  }
281 
283  void PropagateRequestedRegion(itk::DataObject* output) override;
284 
285 protected:
289 
290  void GenerateData() override;
291 
292  void GenerateOutputInformation() override;
293 
294  virtual void UpdateTransform();
295 
296  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
297 
298 private:
299  GenericRSResampleImageFilter(const Self&) = delete;
300  void operator=(const Self&) = delete;
301 
302  // Method to estimate the input & output rpc model
303  void EstimateOutputRpcModel();
304  void EstimateInputRpcModel();
305 
306  // boolean that allow the estimation of the input rpc model
310 
311  // Filters pointers
316 };
317 
318 } // namespace otb
319 
320 #ifndef OTB_MANUAL_INSTANTIATION
322 #endif
323 
324 #endif
otb::GenericRSResampleImageFilter::SetInputRpcGridSize
void SetInputRpcGridSize(const SizeType &gridSize)
Definition: otbGenericRSResampleImageFilter.h:225
otbStreamingResampleImageFilter.h
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::GenericRSResampleImageFilter::InputRpcModelEstimatorPointerType
InputRpcModelEstimatorType::Pointer InputRpcModelEstimatorPointerType
Definition: otbGenericRSResampleImageFilter.h:90
otb::GenericRSResampleImageFilter::GetInputRpcGridSize
const SizeType & GetInputRpcGridSize() const
Definition: otbGenericRSResampleImageFilter.h:239
otb::GenericRSResampleImageFilter::SetInputImageMetadata
void SetInputImageMetadata(const ImageMetadata *imd)
Definition: otbGenericRSResampleImageFilter.h:179
otb::GenericRSResampleImageFilter::m_Transform
GenericRSTransformPointerType m_Transform
Definition: otbGenericRSResampleImageFilter.h:315
otb::PhysicalToRPCSensorModelImageFilter
This filter estimates a RPC sensor models from a physical model.
Definition: otbPhysicalToRPCSensorModelImageFilter.h:62
otb::StreamingResampleImageFilter::OriginType
DisplacementFieldGeneratorType::OriginType OriginType
Definition: otbStreamingResampleImageFilter.h:90
otb::GenericRSResampleImageFilter::m_Resampler
ResamplerPointerType m_Resampler
Definition: otbGenericRSResampleImageFilter.h:312
otb::GenericRSResampleImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbGenericRSResampleImageFilter.h:61
otb::GenericRSResampleImageFilter::GenericRSTransformPointerType
GenericRSTransformType::Pointer GenericRSTransformPointerType
Definition: otbGenericRSResampleImageFilter.h:100
otb::GenericRSResampleImageFilter::OutputRpcModelEstimatorType
PhysicalToRPCSensorModelImageFilter< OutputImageType > OutputRpcModelEstimatorType
Definition: otbGenericRSResampleImageFilter.h:92
otb::GenericRSResampleImageFilter::OutputPointType
OutputImageType::PointType OutputPointType
Definition: otbGenericRSResampleImageFilter.h:75
otb::StreamingResampleImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStreamingResampleImageFilter.h:65
otb::GenericRSResampleImageFilter::SetInputRpcGridSize
void SetInputRpcGridSize(unsigned int gridSize)
Definition: otbGenericRSResampleImageFilter.h:232
otb::GenericRSResampleImageFilter::SetOutputProjectionRef
void SetOutputProjectionRef(const std::string &ref)
Definition: otbGenericRSResampleImageFilter.h:166
otb::GenericRSResampleImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbGenericRSResampleImageFilter.h:73
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::GenericRSResampleImageFilter::ResamplerType
StreamingResampleImageFilter< InputImageType, OutputImageType > ResamplerType
Definition: otbGenericRSResampleImageFilter.h:78
otb::GenericRSResampleImageFilter::m_EstimateOutputRpcModel
bool m_EstimateOutputRpcModel
Definition: otbGenericRSResampleImageFilter.h:308
otb::StreamingResampleImageFilter::TransformType
DisplacementFieldGeneratorType::TransformType TransformType
Definition: otbStreamingResampleImageFilter.h:87
otb::PhysicalToRPCSensorModelImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbPhysicalToRPCSensorModelImageFilter.h:68
otb::StreamingResampleImageFilter::SpacingType
DisplacementFieldGeneratorType::SpacingType SpacingType
Definition: otbStreamingResampleImageFilter.h:89
otb::GenericRSResampleImageFilter::GetOutputProjectionRef
std::string GetOutputProjectionRef() const
Definition: otbGenericRSResampleImageFilter.h:172
otb::GenericRSResampleImageFilter::GetOutputImageMetadata
const ImageMetadata * GetOutputImageMetadata()
Definition: otbGenericRSResampleImageFilter.h:200
otb::GenericRSResampleImageFilter::IndexType
ResamplerType::IndexType IndexType
Definition: otbGenericRSResampleImageFilter.h:84
otb::GenericRSResampleImageFilter::Self
GenericRSResampleImageFilter Self
Definition: otbGenericRSResampleImageFilter.h:60
otb::GenericRSResampleImageFilter
This class is a composite filter that allows you to project an input image from any coordinate system...
Definition: otbGenericRSResampleImageFilter.h:56
otb::GenericRSResampleImageFilter::SetInterpolator
void SetInterpolator(InterpolatorType *interpolator)
Definition: otbGenericRSResampleImageFilter.h:136
otb::GenericRSResampleImageFilter::GetInputImageMetadata
const ImageMetadata * GetInputImageMetadata()
Definition: otbGenericRSResampleImageFilter.h:186
otb::GenericRSResampleImageFilter::OriginType
ResamplerType::OriginType OriginType
Definition: otbGenericRSResampleImageFilter.h:83
otb::GenericRSResampleImageFilter::m_InputRpcEstimator
InputRpcModelEstimatorPointerType m_InputRpcEstimator
Definition: otbGenericRSResampleImageFilter.h:313
otb::GenericRSResampleImageFilter::m_EstimateInputRpcModel
bool m_EstimateInputRpcModel
Definition: otbGenericRSResampleImageFilter.h:307
otb::StreamingResampleImageFilter
This class is a composite filter resampling an input image by setting a transform....
Definition: otbStreamingResampleImageFilter.h:59
otb::StreamingResampleImageFilter::IndexType
DisplacementFieldGeneratorType::IndexType IndexType
Definition: otbStreamingResampleImageFilter.h:91
otb::StreamingResampleImageFilter::InterpolatorType
itk::InterpolateImageFunction< InputImageType, TInterpolatorPrecisionType > InterpolatorType
Definition: otbStreamingResampleImageFilter.h:95
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::StreamingResampleImageFilter::RegionType
DisplacementFieldGeneratorType::RegionType RegionType
Definition: otbStreamingResampleImageFilter.h:92
otb::GenericRSResampleImageFilter::GetInputProjectionRef
std::string GetInputProjectionRef() const
Definition: otbGenericRSResampleImageFilter.h:161
otb::GenericRSResampleImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbGenericRSResampleImageFilter.h:63
otb::GenericRSResampleImageFilter::SetDisplacementFilterNumberOfThreads
void SetDisplacementFilterNumberOfThreads(unsigned int nbThread)
Definition: otbGenericRSResampleImageFilter.h:277
otb::GenericRSResampleImageFilter::SetOutputImageMetadata
void SetOutputImageMetadata(const ImageMetadata *imd)
Definition: otbGenericRSResampleImageFilter.h:193
otb::GenericRSResampleImageFilter::OutputInternalPixelType
OutputImageType::InternalPixelType OutputInternalPixelType
Definition: otbGenericRSResampleImageFilter.h:74
otb::GenericRSResampleImageFilter::InputRpcModelEstimatorType
PhysicalToRPCSensorModelImageFilter< InputImageType > InputRpcModelEstimatorType
Definition: otbGenericRSResampleImageFilter.h:89
otb::GenericRSResampleImageFilter::SetOutputOrigin
void SetOutputOrigin(const OriginType &origin)
Definition: otbGenericRSResampleImageFilter.h:112
otb::GenericRSResampleImageFilter::TransformType
ResamplerType::TransformType TransformType
Definition: otbGenericRSResampleImageFilter.h:80
otb::Wrapper::ImageBaseType
itk::ImageBase< 2 > ImageBaseType
Definition: otbWrapperTypes.h:180
otb::GenericRSResampleImageFilter::SpacingType
ResamplerType::SpacingType SpacingType
Definition: otbGenericRSResampleImageFilter.h:82
otb::GenericRSResampleImageFilter::SetOutputRpcGridSize
void SetOutputRpcGridSize(unsigned int gridSize)
Definition: otbGenericRSResampleImageFilter.h:258
otb::GenericRSResampleImageFilter::SetOutputRpcGridSize
void SetOutputRpcGridSize(const SizeType &gridSize)
Definition: otbGenericRSResampleImageFilter.h:251
otbGetObjectMemberConstReferenceMacro
#define otbGetObjectMemberConstReferenceMacro(object, name, type)
Definition: otbMacro.h:112
otb::GenericRSResampleImageFilter::InterpolatorType
ResamplerType::InterpolatorType InterpolatorType
Definition: otbGenericRSResampleImageFilter.h:86
otb::GenericRSResampleImageFilter::GenericRSTransformType
GenericRSTransform GenericRSTransformType
Definition: otbGenericRSResampleImageFilter.h:99
otb::GenericRSResampleImageFilter::ImageBaseType
itk::ImageBase< OutputImageType::ImageDimension > ImageBaseType
Definition: otbGenericRSResampleImageFilter.h:102
otbGetObjectMemberConstMacro
#define otbGetObjectMemberConstMacro(object, name, type)
Definition: otbMacro.h:100
otb::GenericRSResampleImageFilter::SetInputProjectionRef
void SetInputProjectionRef(const std::string &ref)
Definition: otbGenericRSResampleImageFilter.h:154
otb::GenericRSResampleImageFilter::RegionType
ResamplerType::RegionType RegionType
Definition: otbGenericRSResampleImageFilter.h:85
otb::GenericRSResampleImageFilter::~GenericRSResampleImageFilter
~GenericRSResampleImageFilter() override
Definition: otbGenericRSResampleImageFilter.h:288
otbPhysicalToRPCSensorModelImageFilter.h
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::GenericRSResampleImageFilter::ResamplerPointerType
ResamplerType::Pointer ResamplerPointerType
Definition: otbGenericRSResampleImageFilter.h:79
otb::StreamingResampleImageFilter::SizeType
DisplacementFieldGeneratorType::SizeType SizeType
Definition: otbStreamingResampleImageFilter.h:88
otbGetObjectMemberMacro
#define otbGetObjectMemberMacro(object, name, type)
Definition: otbMacro.h:89
otb::GenericRSResampleImageFilter::OutputRpcModelEstimatorPointerType
OutputRpcModelEstimatorType::Pointer OutputRpcModelEstimatorPointerType
Definition: otbGenericRSResampleImageFilter.h:93
otbSetObjectMemberMacro
#define otbSetObjectMemberMacro(object, name, type)
Definition: otbMacro.h:79
otb::GenericRSResampleImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSResampleImageFilter.h:62
otbGenericRSResampleImageFilter.hxx
otb::GenericRSResampleImageFilter::InputImageType
TInputImage InputImageType
Definition: otbGenericRSResampleImageFilter.h:69
otb::GenericRSResampleImageFilter::m_OutputRpcEstimator
OutputRpcModelEstimatorPointerType m_OutputRpcEstimator
Definition: otbGenericRSResampleImageFilter.h:314
otb::GenericRSResampleImageFilter::SizeType
ResamplerType::SizeType SizeType
Definition: otbGenericRSResampleImageFilter.h:81
otb::GenericRSResampleImageFilter::m_RpcEstimationUpdated
bool m_RpcEstimationUpdated
Definition: otbGenericRSResampleImageFilter.h:309
otb::GenericRSResampleImageFilter::GetOutputRpcGridSize
const SizeType & GetOutputRpcGridSize() const
Definition: otbGenericRSResampleImageFilter.h:265