OTB  9.0.0
Orfeo Toolbox
otbRGBAPixelConverter.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 
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
otb::RGBAPixelConverter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbRGBAPixelConverter.h:73
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::Self
RGBAPixelConverter Self
Definition: otbRGBAPixelConverter.h:128
otbRGBAPixelConverter.hxx
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbRGBAPixelConverter.h:131
otb::RGBAPixelConverter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbRGBAPixelConverter.h:52
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::OutputPixelType
itk::RGBPixel< TInternalOutputPixelType > OutputPixelType
Definition: otbRGBAPixelConverter.h:140
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::~RGBAPixelConverter
~RGBAPixelConverter() override
Definition: otbRGBAPixelConverter.h:148
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::~RGBAPixelConverter
~RGBAPixelConverter() override
Definition: otbRGBAPixelConverter.h:109
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::InputPixelType
itk::RGBAPixel< TInternalInputPixelType > InputPixelType
Definition: otbRGBAPixelConverter.h:137
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::Self
RGBAPixelConverter Self
Definition: otbRGBAPixelConverter.h:89
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbRGBAPixelConverter.h:91
otb::RGBAPixelConverter::~RGBAPixelConverter
~RGBAPixelConverter() override
Definition: otbRGBAPixelConverter.h:70
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbRGBAPixelConverter.h:151
otb::RGBAPixelConverter
Convert an itk::RGBApixel<InternalType> into another pixel type.
Definition: otbRGBAPixelConverter.h:46
otb::RGBAPixelConverter::InputPixelType
itk::RGBAPixel< TInternalInputPixelType > InputPixelType
Definition: otbRGBAPixelConverter.h:59
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::Superclass
itk::ProcessObject Superclass
Definition: otbRGBAPixelConverter.h:90
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbRGBAPixelConverter.h:92
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::RGBAPixelConverter
RGBAPixelConverter()
Definition: otbRGBAPixelConverter.h:145
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::Superclass
itk::ProcessObject Superclass
Definition: otbRGBAPixelConverter.h:129
otb::RGBAPixelConverter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbRGBAPixelConverter.h:53
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::InputPixelType
itk::RGBAPixel< TInternalInputPixelType > InputPixelType
Definition: otbRGBAPixelConverter.h:98
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::RGBAPixelConverter
RGBAPixelConverter()
Definition: otbRGBAPixelConverter.h:106
itk
Definition: otbNoDataHelper.h:31
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbRGBAPixelConverter.h:112
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBPixel< TInternalOutputPixelType > >::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbRGBAPixelConverter.h:130
otb::RGBAPixelConverter::RGBAPixelConverter
RGBAPixelConverter()
Definition: otbRGBAPixelConverter.h:67
otb::RGBAPixelConverter::Self
RGBAPixelConverter Self
Definition: otbRGBAPixelConverter.h:50
otb::RGBAPixelConverter< TInternalInputPixelType, itk::RGBAPixel< TInternalOutputPixelType > >::OutputPixelType
itk::RGBAPixel< TInternalOutputPixelType > OutputPixelType
Definition: otbRGBAPixelConverter.h:101
otb::RGBAPixelConverter::OutputPixelType
TOutputPixelType OutputPixelType
Definition: otbRGBAPixelConverter.h:62
otb::RGBAPixelConverter::Superclass
itk::ProcessObject Superclass
Definition: otbRGBAPixelConverter.h:51