OTB  9.0.0
Orfeo Toolbox
otbSarTransformBase.hxx
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 otbSarTransformBase_hxx
22 #define otbSarTransformBase_hxx
23 
24 #include "otbSarTransformBase.h"
25 #include "otbLogger.h"
26 #define UNUSED(x) [&x]{}()
27 
28 namespace otb
29 {
30 
31 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
33 {
34  if (!imd.Has(MDGeom::SAR))
35  return false;
36  const boost::any any_Sar = imd[MDGeom::SAR];
37  if (any_Sar.empty())
38  return false;
39  try
40  {
41  this->m_SarParam = std::make_unique<SARParam>(boost::any_cast<SARParam>(imd[MDGeom::SAR]));
42  }
43  catch (const boost::bad_any_cast&)
44  {
45  return false;
46  }
47 
48  this->m_Transformer = std::make_unique<SarSensorModel>(imd);
49  return true;
50 }
51 
52 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
54 {
55  return m_Transformer != nullptr;
56 }
57 
61 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
63 {
64  Superclass::PrintSelf(os, indent);
65  os << indent << "Sar Model" << std::endl;
66 }
68 
69 template <class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
71 {
72  // A Standard definition of this function is available for RPC sensor model in RPCTransformBase class
73  otbLogMacro(Warning, << "Optimize parameters function not implemented for SAR sensor model. The sensor model parameters will NOT be modified");
74 }
75 
76 } // namespace otb
77 
78 #endif
otb::SarTransformBase::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbSarTransformBase.hxx:62
otb::SensorTransformBase::TiePointsType
std::vector< std::pair< InputPointType, OutputPointType > > TiePointsType
Definition: otbSensorTransformBase.h:61
otbSarTransformBase.h
otbLogMacro
#define otbLogMacro(level, msg)
Definition: otbMacro.h:52
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SarTransformBase::OptimizeParameters
void OptimizeParameters(ImageMetadata &imd, const TiePointsType &tiepoints, double &rmsError) final
Definition: otbSarTransformBase.hxx:70
otb::ImageMetadataBase::Has
bool Has(MDGeom key) const
otb::SarTransformBase::SetMetadata
bool SetMetadata(const ImageMetadata &imd) override
Definition: otbSarTransformBase.hxx:32
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otbLogger.h
otb::MDGeom::SAR
@ SAR
otb::SarTransformBase::IsValidSensorModel
bool IsValidSensorModel() const override
Definition: otbSarTransformBase.hxx:53