OTB  7.2.0
Orfeo Toolbox
otbRGBAPixelConverter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 
22 #ifndef otbRGBAPixelConverter_h
23 #define otbRGBAPixelConverter_h
24 
25 #include "itkProcessObject.h"
26 #include "itkRGBAPixel.h"
27 #include "itkRGBPixel.h"
28 
29 namespace otb
30 {
44 // RGBA to Scalar
45 template <class TInternalInputPixelType, class TOutputPixelType>
46 class ITK_EXPORT RGBAPixelConverter : public itk::ProcessObject
47 {
48 public:
51  typedef itk::ProcessObject Superclass;
52  typedef itk::SmartPointer<Self> Pointer;
53  typedef itk::SmartPointer<const Self> ConstPointer;
54 
56  itkTypeMacro(RGBAPixelConverter, ProcessObject);
57 
59  itkNewMacro(Self);
60 
61  typedef typename itk::RGBAPixel<TInternalInputPixelType> InputPixelType;
62  typedef TOutputPixelType OutputPixelType;
63 
64  OutputPixelType Convert(InputPixelType input);
65 
66 protected:
68  {
69  }
71  {
72  }
73  void PrintSelf(std::ostream& os, itk::Indent indent) const override
74  {
75  Superclass::PrintSelf(os, indent);
76  }
77 
78 private:
79  RGBAPixelConverter(const Self&) = delete;
80  void operator=(const Self&) = delete;
81 };
82 
83 // RGBA to RGBA
84 template <class TInternalInputPixelType, class TInternalOutputPixelType>
85 class ITK_EXPORT RGBAPixelConverter<TInternalInputPixelType, typename itk::RGBAPixel<TInternalOutputPixelType>> : public itk::ProcessObject
86 {
87 public:
90  typedef itk::ProcessObject Superclass;
91  typedef itk::SmartPointer<Self> Pointer;
92  typedef itk::SmartPointer<const Self> ConstPointer;
93 
95  itkTypeMacro(RGBAPixelConverter, ProcessObject);
96 
98  itkNewMacro(Self);
99 
100  typedef typename itk::RGBAPixel<TInternalInputPixelType> InputPixelType;
101  typedef typename itk::RGBAPixel<TInternalOutputPixelType> OutputPixelType;
102 
103  OutputPixelType Convert(InputPixelType input);
104 
105 protected:
107  {
108  }
110  {
111  }
112  void PrintSelf(std::ostream& os, itk::Indent indent) const override
113  {
114  Superclass::PrintSelf(os, indent);
115  }
116 
117 private:
118  RGBAPixelConverter(const Self&) = delete;
119  void operator=(const Self&) = delete;
120 };
121 
122 // RGBA to RGB
123 template <class TInternalInputPixelType, class TInternalOutputPixelType>
124 class ITK_EXPORT RGBAPixelConverter<TInternalInputPixelType, typename itk::RGBPixel<TInternalOutputPixelType>> : public itk::ProcessObject
125 {
126 public:
129  typedef itk::ProcessObject Superclass;
130  typedef itk::SmartPointer<Self> Pointer;
131  typedef itk::SmartPointer<const Self> ConstPointer;
132 
134  itkTypeMacro(RGBAPixelConverter, ProcessObject);
135 
137  itkNewMacro(Self);
138 
139  typedef typename itk::RGBAPixel<TInternalInputPixelType> InputPixelType;
140  typedef typename itk::RGBPixel<TInternalOutputPixelType> OutputPixelType;
141 
142  OutputPixelType Convert(InputPixelType input);
143 
144 protected:
146  {
147  }
149  {
150  }
151  void PrintSelf(std::ostream& os, itk::Indent indent) const override
152  {
153  Superclass::PrintSelf(os, indent);
154  }
155 
156 private:
157  RGBAPixelConverter(const Self&) = delete;
158  void operator=(const Self&) = delete;
159 };
160 
161 } // end namespace otb
162 
163 #ifndef OTB_MANUAL_INSTANTIATION
164 #include "otbRGBAPixelConverter.hxx"
165 #endif
166 
167 #endif
itk::SmartPointer< const Self > ConstPointer
Convert an itk::RGBApixel<InternalType> into another pixel type.
TOutputPixelType OutputPixelType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
itk::ProcessObject Superclass
void PrintSelf(std::ostream &os, itk::Indent indent) const override
itk::SmartPointer< Self > Pointer
itk::RGBAPixel< TInternalInputPixelType > InputPixelType