OTB  9.0.0
Orfeo Toolbox
otbTransformFactories.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 otbTransformFactory_h
22 #define otbTransformFactory_h
23 
24 #include "otbCast.h"
25 #include "otbImageMetadata.h"
26 #include "otbSensorTransformBase.h"
27 #include "otbTransform.h"
28 
29 #include "otbRPCForwardTransform.h"
30 #include "otbRPCInverseTransform.h"
31 #include "otbSarForwardTransform.h"
32 #include "otbSarInverseTransform.h"
33 
34 namespace otb {
35 
47 namespace TransformFactories {
48 
52 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
55 {
56  if(imd.Has(MDGeom::RPC))
57  {
59  if(transform->getDirection() != direction)
60  return nullptr;
61  transform->SetMetadata(imd);
62  return DynamicCast<typename otb::SensorTransformBase<double, NInputDimensions, NOutputDimensions>>(transform);
63  }
64  return nullptr;
65 }
67 
71 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
74 {
75  if(imd.Has(MDGeom::RPC))
76  {
78  if(transform->getDirection() != direction)
79  return nullptr;
80  transform->SetMetadata(imd);
81  return DynamicCast<typename otb::SensorTransformBase<double, NInputDimensions, NOutputDimensions>>(transform);
82  }
83  return nullptr;
84 }
86 
90 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
93 {
94  if(imd.Has(MDGeom::SAR))
95  {
97  if(transform->getDirection() != direction)
98  return nullptr;
99  transform->SetMetadata(imd);
100  return DynamicCast<typename otb::SensorTransformBase<double, NInputDimensions, NOutputDimensions>>(transform);
101  }
102  return nullptr;
103 }
105 
109 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
112 {
113  if(imd.Has(MDGeom::SAR))
114  {
116  if(transform->getDirection() != direction)
117  return nullptr;
118  transform->SetMetadata(imd);
119  return DynamicCast<typename otb::SensorTransformBase<double, NInputDimensions, NOutputDimensions>>(transform);
120  }
121  return nullptr;
122 }
124 
125 }
126 }
127 
128 #endif
otb::TransformDirection
TransformDirection
Definition: otbTransform.h:30
otb::SarInverseTransform::New
static Pointer New()
otbSarInverseTransform.h
otb::RPCForwardTransform::New
static Pointer New()
otb::RPCInverseTransform::New
static Pointer New()
otb::TransformFactories::SARForwardTransformFactory
otb::SensorTransformBase< double, NInputDimensions, NOutputDimensions >::Pointer SARForwardTransformFactory(const ImageMetadata &imd, TransformDirection direction)
Definition: otbTransformFactories.h:92
otbTransform.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbRPCInverseTransform.h
otb::MDGeom::RPC
@ RPC
TransformFactories
Contains the functions (factories) used to instantiate the transformation classes.
otb::SensorTransformBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSensorTransformBase.h:56
otbSarForwardTransform.h
otb::TransformFactories::RPCForwardTransformFactory
otb::SensorTransformBase< double, NInputDimensions, NOutputDimensions >::Pointer RPCForwardTransformFactory(const ImageMetadata &imd, TransformDirection direction)
Definition: otbTransformFactories.h:54
otb::TransformFactories::SARInverseTransformFactory
otb::SensorTransformBase< double, NInputDimensions, NOutputDimensions >::Pointer SARInverseTransformFactory(const ImageMetadata &imd, TransformDirection direction)
Definition: otbTransformFactories.h:111
otb::ImageMetadataBase::Has
bool Has(MDGeom key) const
otbCast.h
otbSensorTransformBase.h
otb::SarForwardTransform::New
static Pointer New()
otbRPCForwardTransform.h
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::TransformFactories::RPCInverseTransformFactory
otb::SensorTransformBase< double, NInputDimensions, NOutputDimensions >::Pointer RPCInverseTransformFactory(const ImageMetadata &imd, TransformDirection direction)
Definition: otbTransformFactories.h:73
otbImageMetadata.h
otb::MDGeom::SAR
@ SAR