OTB  10.0.0
Orfeo Toolbox
otbCastImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef otbCastImageFilter_h
19 #define otbCastImageFilter_h
20 
21 #include "itkUnaryFunctorImageFilter.h"
22 #include "itkProgressReporter.h"
23 
24 #include <type_traits>
25 
26 namespace otb
27 {
28 
63 template< typename TInputImage, typename TOutputImage >
64 class ITK_TEMPLATE_EXPORT CastImageFilter:
65  public itk::InPlaceImageFilter< TInputImage, TOutputImage >
66 {
67 public:
69 
72  using Superclass = itk::InPlaceImageFilter< TInputImage, TOutputImage >;
73  using Pointer = itk::SmartPointer< Self >;
74  using ConstPointer = itk::SmartPointer< const Self >;
75 
76  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
77  using InputPixelType = typename TInputImage::PixelType;
78  using OutputPixelType = typename TOutputImage::PixelType;
79 
81  itkNewMacro(Self);
82 
84  itkTypeMacro(CastImageFilter, InPlaceImageFilter);
85 
86 protected:
88  virtual ~CastImageFilter() = default;
89 
90  void GenerateOutputInformation() override;
91 
92  void GenerateData() override;
93 
94  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
95 
96  template<typename TInputPixelType>
97  void DynamicThreadedGenerateDataDispatched(const OutputImageRegionType & outputRegionForThread, std::true_type isConvertible);
98 
99  template<typename TInputPixelType>
100  void DynamicThreadedGenerateDataDispatched(const OutputImageRegionType & outputRegionForThread, std::false_type isConvertible);
101 };
102 } // end namespace otb
103 
104 #endif
105 
106 #ifndef OTB_MANUAL_INSTANTIATION
107 #include "otbCastImageFilter.hxx"
108 #endif
109 
Casts input pixels to output pixel type.
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
ITK_DISALLOW_COPY_AND_ASSIGN(CastImageFilter)
virtual ~CastImageFilter()=default
itk::SmartPointer< const Self > ConstPointer
itk::SmartPointer< Self > Pointer
typename Superclass::OutputImageRegionType OutputImageRegionType
typename TInputImage::PixelType InputPixelType
typename TOutputImage::PixelType OutputPixelType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.