OTB  6.7.0
Orfeo Toolbox
otbWrapperApplication.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 otbWrapperApplication_hxx
22 #define otbWrapperApplication_hxx
23 
24 
25 #include "otbWrapperApplication.h"
26 
27 
28 namespace otb
29 {
30 
31 
32 namespace Wrapper
33 {
34 
35 
36 template <class TImageType>
37 TImageType*
39 ::GetParameterImage(std::string parameter)
40 
41 {
42  typename TImageType::Pointer ret;
43  Parameter* param = GetParameterByKey(parameter);
44  InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param);
45  if (paramDown)
46  {
47  return paramDown->GetImage<TImageType>();
48  }
49  else
50  {
51  itkExceptionMacro(<<parameter << " parameter can't be casted to ImageType");
52  return nullptr;
53  }
54 }
55 
56 
57 template <class TImageType>
58 void
60 ::SetParameterOutputImage(std::string parameter, TImageType* value)
61 {
62  Parameter* param = GetParameterByKey(parameter);
63 
64  if (dynamic_cast<OutputImageParameter*>(param))
65  {
66  OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param);
67  paramDown->SetValue(value);
68  }
69 }
70 
71 
72 } // End namespace Wrapper
73 
74 } // End namespace otb
75 
76 #endif
FloatVectorImageType * GetParameterImage(std::string parameter)
void SetValue(ImageBaseType *image)
This class represent a parameter for the wrapper framework This class is a high level class represent...
This class represents a OutputImage parameter.
This class represents a InputImage parameter.
ImageBaseType const * GetImage() const
void SetParameterOutputImage(std::string parameter, FloatVectorImageType *value)