ITK  6.0.0
Insight Toolkit
itkConvertPixelBuffer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkConvertPixelBuffer_h
19#define itkConvertPixelBuffer_h
20#include "ITKIOImageBaseExport.h"
21
22#include "itkObject.h"
23#include "itkNumericTraits.h"
24#include <type_traits> // for enable_if
25
26namespace itk
27{
45template <typename InputPixelType, typename OutputPixelType, typename OutputConvertTraits>
46class ITK_TEMPLATE_EXPORT ConvertPixelBuffer
47{
48public:
49
51 using OutputComponentType = typename OutputConvertTraits::ComponentType;
53
54 // Remove all constructor/ destructor / assignments for class with only static member functions.
58 operator=(const ConvertPixelBuffer &) = delete;
61 virtual ~ConvertPixelBuffer() = delete;
62
64 static void
65 Convert(const InputPixelType * inputData, int inputNumberOfComponents, OutputPixelType * outputData, size_t size);
66
67 static void
68 ConvertVectorImage(const InputPixelType * inputData,
69 int inputNumberOfComponents,
70 OutputPixelType * outputData,
71 size_t size);
72
73protected:
77 static void
78 ConvertGrayToGray(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
79
84 static void
85 ConvertRGBToGray(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
86
91 static void
92 ConvertRGBAToGray(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
93
94 static void
95 ConvertMultiComponentToGray(const InputPixelType * inputData,
96 int inputNumberOfComponents,
97 OutputPixelType * outputData,
98 size_t size);
99
104 static void
105 ConvertGrayToRGB(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
106
108 static void
109 ConvertRGBToRGB(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
110
112 static void
113 ConvertRGBAToRGB(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
114
123 static void
124 ConvertMultiComponentToRGB(const InputPixelType * inputData,
125 int inputNumberOfComponents,
126 OutputPixelType * outputData,
127 size_t size);
128
130 static void
131 ConvertGrayToRGBA(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
132
133 static void
134 ConvertRGBToRGBA(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
135
136 static void
137 ConvertRGBAToRGBA(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
138
139 static void
140 ConvertMultiComponentToRGBA(const InputPixelType * inputData,
141 int inputNumberOfComponents,
142 OutputPixelType * outputData,
143 size_t size);
144
146 static void
147 ConvertVectorToVector(const InputPixelType * inputData,
148 int inputNumberOfComponents,
149 OutputPixelType * outputData,
150 size_t size);
151
155 static void
156 ConvertTensor6ToTensor6(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
157
158 static void
159 ConvertTensor9ToTensor6(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
160
162 static void
163 ConvertGrayToComplex(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
164
165 static void
166 ConvertComplexToComplex(const InputPixelType * inputData, OutputPixelType * outputData, size_t size);
167
168 static void
169 ConvertMultiComponentToComplex(const InputPixelType * inputData,
170 int inputNumberOfComponents,
171 OutputPixelType * outputData,
172 size_t size);
173
180 template <typename UComponentType>
181 static std::enable_if_t<!std::is_integral_v<UComponentType>, UComponentType>
183
184 template <typename UComponentType>
185 static std::enable_if_t<std::is_integral_v<UComponentType>, UComponentType>
187};
188} // namespace itk
189
190#ifndef ITK_MANUAL_INSTANTIATION
191# include "itkConvertPixelBuffer.hxx"
192#endif
193
194#endif // itkConvertPixelBuffer_h
Class to convert blocks of data from one type to another.
ConvertPixelBuffer & operator=(ConvertPixelBuffer &&)=delete
ConvertPixelBuffer & operator=(const ConvertPixelBuffer &)=delete
static std::enable_if_t< std::is_integral_v< UComponentType >, UComponentType > DefaultAlphaValue()
static void ConvertVectorToVector(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertVectorImage(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBToRGBA(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertGrayToRGB(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBAToRGB(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void Convert(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertGrayToRGBA(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertComplexToComplex(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertMultiComponentToRGBA(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertGrayToGray(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertMultiComponentToRGB(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBAToGray(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
ConvertPixelBuffer(const ConvertPixelBuffer &)=delete
static void ConvertTensor6ToTensor6(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBToRGB(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
typename OutputConvertTraits::ComponentType OutputComponentType
static void ConvertMultiComponentToComplex(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
virtual ~ConvertPixelBuffer()=delete
static void ConvertTensor9ToTensor6(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertGrayToComplex(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
ConvertPixelBuffer(ConvertPixelBuffer &&)=delete
static void ConvertRGBToGray(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBAToRGBA(const InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertMultiComponentToGray(const InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static std::enable_if_t<!std::is_integral_v< UComponentType >, UComponentType > DefaultAlphaValue()
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....