OTB  9.0.0
Orfeo Toolbox
otbWrapperCastImage.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 otbWrapperCastimage_h
22 #define otbWrapperCastimage_h
23 
24 
25 #include "otbClampImageFilter.h"
26 
27 #include "OTBApplicationEngineExport.h"
28 
29 #include "otbWrapperTypes.h"
30 
31 
32 namespace otb
33 {
34 namespace Wrapper
35 {
36 namespace details
37 {
38 
45 template <typename TOutputImage, typename TInputImage>
46 struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage
47 {
49 
50  CastImage(TInputImage *in)
51  : ocif(InOutClampImageFilter::New())
52  , out(ocif->GetOutput())
53  {
54  assert(in);
55  ocif->SetInput(in);
56  }
57 
60 
62  TOutputImage* out;
63 };
64 
65 
72 template <typename TOutputImage>
73 struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage<TOutputImage, DoubleVectorImageType>
74 {
77 
80  : ocif(OutputClampImageFilter::New())
81  , out(ocif->GetOutput())
82  {
83  assert(in);
84 
85  ocif->SetInput(in);
86  }
87 
90 
92  TOutputImage* out;
93 };
94 
95 
102 template <typename T>
103 struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage<T, T>
104 {
105  CastImage(T* in) : out(in)
106  {
107  assert(in);
108  }
109 
110  itk::ProcessObject::Pointer ocif;
111  T* out;
112 };
113 
114 
121 template <>
122 struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage<DoubleVectorImageType, DoubleVectorImageType>
123 {
125  {
126  assert(in);
127  }
128 
129  itk::ProcessObject::Pointer ocif;
131 };
132 
133 } // namespace details.
134 
135 } // namespace Wrapper
136 
137 } // namespace otb
138 
139 #endif
otb::Wrapper::details::CastImage< DoubleVectorImageType, DoubleVectorImageType >::ocif
itk::ProcessObject::Pointer ocif
Definition: otbWrapperCastImage.h:129
otb::Wrapper::details::CastImage::out
TOutputImage * out
Definition: otbWrapperCastImage.h:62
otb::Wrapper::details::CastImage< DoubleVectorImageType, DoubleVectorImageType >::out
DoubleVectorImageType * out
Definition: otbWrapperCastImage.h:130
otb::Wrapper::details::CastImage::CastImage
CastImage(TInputImage *in)
Definition: otbWrapperCastImage.h:50
otb::Wrapper::details::CastImage< TOutputImage, DoubleVectorImageType >::out
TOutputImage * out
Definition: otbWrapperCastImage.h:92
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Wrapper::details::CastImage< DoubleVectorImageType, DoubleVectorImageType >::CastImage
CastImage(DoubleVectorImageType *in)
Definition: otbWrapperCastImage.h:124
otb::ClampImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbClampImageFilter.h:56
otb::Wrapper::details::CastImage
Helper class (private) which casts and clamps input-image type into output-image type.
Definition: otbWrapperCastImage.h:46
otb::Wrapper::details::CastImage< TOutputImage, DoubleVectorImageType >::ocif
OutputClampImageFilter::Pointer ocif
Definition: otbWrapperCastImage.h:89
otbClampImageFilter.h
otb::Wrapper::details::CastImage< TOutputImage, DoubleVectorImageType >::CastImage
CastImage(DoubleVectorImageType *in)
Definition: otbWrapperCastImage.h:79
otb::Wrapper::details::CastImage< T, T >::out
T * out
Definition: otbWrapperCastImage.h:111
otb::ClampImageFilter
Clamp image values to be below, over, or between threshold values.
Definition: otbClampImageFilter.h:48
otb::Wrapper::details::CastImage< T, T >::CastImage
CastImage(T *in)
Definition: otbWrapperCastImage.h:105
otb::Wrapper::details::CastImage< T, T >::ocif
itk::ProcessObject::Pointer ocif
Definition: otbWrapperCastImage.h:110
otb::VectorImage
Creation of an "otb" vector image which contains metadata.
Definition: otbVectorImage.h:45
otb::Wrapper::details::CastImage::ocif
InOutClampImageFilter::Pointer ocif
Definition: otbWrapperCastImage.h:59
otbWrapperTypes.h