OTB  9.0.0
Orfeo Toolbox
otbStreamingTraits.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 otbStreamingTraits_hxx
22 #define otbStreamingTraits_hxx
23 
24 #include "otbStreamingTraits.h"
25 
26 namespace otb
27 {
28 template <class TImage>
30 {
31  unsigned int neededRadius = 0;
32  std::string className;
33 
34  className = interpolator->GetNameOfClass();
35 
36  if (className == "LinearInterpolateImageFunction")
37  {
38  otbMsgDevMacro(<< "Linear Interpolator");
39  neededRadius = 1;
40  }
41  else if (className == "NearestNeighborInterpolateImageFunction")
42  {
43  otbMsgDevMacro(<< "Nearest Neighbor Interpolator");
44  neededRadius = 1;
45  }
46  else if (className == "BSplineInterpolateImageFunction")
47  {
48  otbMsgDevMacro(<< "BSpline Interpolator");
49  neededRadius = 2;
50  }
51  else if (className == "ProlateInterpolateImageFunction")
52  {
53  otbMsgDevMacro(<< "Prolate Interpolator");
54  neededRadius = dynamic_cast<const ProlateInterpolationType*>(interpolator)->GetRadius();
55  }
56  else if (className == "WindowedSincInterpolateImageGaussianFunction")
57  {
58  otbMsgDevMacro(<< "Gaussian Windowed Interpolator");
59  neededRadius = dynamic_cast<const GaussianInterpolationType*>(interpolator)->GetRadius();
60  }
61  else if (className == "WindowedSincInterpolateImageHammingFunction")
62  {
63  otbMsgDevMacro(<< "Hamming Windowed Interpolator");
64  neededRadius = dynamic_cast<const HammingInterpolationType*>(interpolator)->GetRadius();
65  }
66  else if (className == "WindowedSincInterpolateImageCosineFunction")
67  {
68  otbMsgDevMacro(<< "Cosine Windowed Interpolator");
69  neededRadius = dynamic_cast<const CosineInterpolationType*>(interpolator)->GetRadius();
70  }
71  else if (className == "WindowedSincInterpolateImageWelchFunction")
72  {
73  otbMsgDevMacro(<< "Welch Windowed Interpolator");
74  neededRadius = dynamic_cast<const WelchInterpolationType*>(interpolator)->GetRadius();
75  }
76  else if (className == "WindowedSincInterpolateImageLanczosFunction")
77  {
78  otbMsgDevMacro(<< "Lanczos Windowed Interpolator");
79  neededRadius = dynamic_cast<const LanczosInterpolationType*>(interpolator)->GetRadius();
80  }
81  else if (className == "WindowedSincInterpolateImageBlackmanFunction")
82  {
83  otbMsgDevMacro(<< "Blackman Windowed Interpolator");
84  neededRadius = dynamic_cast<const BlackmanInterpolationType*>(interpolator)->GetRadius();
85  }
86  else if (className == "BCOInterpolateImageFunction")
87  {
88  otbMsgDevMacro(<< "BCO Interpolator");
89  neededRadius = dynamic_cast<const BCOInterpolationType*>(interpolator)->GetRadius();
90  }
91  return neededRadius;
92 }
93 
94 template <typename TPixel, unsigned int VImageDimension>
95 unsigned int StreamingTraits<otb::VectorImage<TPixel, VImageDimension>>::CalculateNeededRadiusForInterpolator(const InterpolationType* interpolator)
96 {
97  unsigned int neededRadius = 0;
98  std::string className;
99 
100  className = interpolator->GetNameOfClass();
101 
102  if (className == "LinearInterpolateImageFunction")
103  {
104  otbMsgDevMacro(<< "Linear Interpolator");
105  neededRadius = 1;
106  }
107  else if (className == "NearestNeighborInterpolateImageFunction")
108  {
109  otbMsgDevMacro(<< "Nearest Neighbor Interpolator");
110  neededRadius = 1;
111  }
112  else if (className == "BSplineInterpolateImageFunction")
113  {
114  otbMsgDevMacro(<< "BSpline Interpolator");
115  neededRadius = 2;
116  }
117  else if (className == "WindowedSincInterpolateImageGaussianFunction")
118  {
119  otbMsgDevMacro(<< "Gaussian Windowed Interpolator");
120  neededRadius = dynamic_cast<const GaussianInterpolationType*>(interpolator)->GetRadius();
121  }
122  else if (className == "BCOInterpolateImageFunction")
123  {
124  otbMsgDevMacro(<< "BCO Interpolator");
125  neededRadius = dynamic_cast<const BCOInterpolationType*>(interpolator)->GetRadius();
126  }
127 
128  return neededRadius;
129 }
130 
131 } // End namespace otb
132 
133 #endif
otb::WindowedSincInterpolateImageGaussianFunction
Use the WindowedSincInterpolateImageFunctionBase with a Gaussian Function.
Definition: otbWindowedSincInterpolateImageGaussianFunction.h:94
otb::StreamingTraits::InterpolationType
itk::InterpolateImageFunction< ImageType, double > InterpolationType
Definition: otbStreamingTraits.h:66
otb::WindowedSincInterpolateImageWelchFunction
Use the WindowedSincInterpolateImageFunctionBase with a Welch Function.
Definition: otbWindowedSincInterpolateImageWelchFunction.h:94
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::StreamingTraits
This class provides internal information for streamable filters.
Definition: otbStreamingTraits.h:55
otb::StreamingTraits::CalculateNeededRadiusForInterpolator
static unsigned int CalculateNeededRadiusForInterpolator(const InterpolationType *interpolator)
Definition: otbStreamingTraits.hxx:29
otb::WindowedSincInterpolateImageCosineFunction
Use the WindowedSincInterpolateImageFunctionBase with a Cosine Function.
Definition: otbWindowedSincInterpolateImageCosineFunction.h:94
otb::WindowedSincInterpolateImageLanczosFunction
Use the WindowedSincInterpolateImageFunctionBase with a Lanczos Function.
Definition: otbWindowedSincInterpolateImageLanczosFunction.h:105
otb::StreamingTraits< otb::VectorImage< TPixel, VImageDimension > >::InterpolationType
itk::InterpolateImageFunction< ImageType, double > InterpolationType
Definition: otbStreamingTraits.h:108
otbStreamingTraits.h
otb::WindowedSincInterpolateImageHammingFunction
Use the WindowedSincInterpolateImageFunctionBase with a Hamming Function.
Definition: otbWindowedSincInterpolateImageHammingFunction.h:95
otb::BCOInterpolateImageFunction
Interpolate an image at specified positions using bicubic interpolation.
Definition: otbBCOInterpolateImageFunction.h:151
otbMsgDevMacro
#define otbMsgDevMacro(x)
Definition: otbMacro.h:64
otb::WindowedSincInterpolateImageBlackmanFunction
Use the WindowedSincInterpolateImageFunctionBase with a Blackman Function.
Definition: otbWindowedSincInterpolateImageBlackmanFunction.h:101
otb::ProlateInterpolateImageFunction
Prolate interpolation of an otb::image.
Definition: otbProlateInterpolateImageFunction.h:208