ITK  5.2.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  * 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 itkConvertPixelBuffer_h
19 #define itkConvertPixelBuffer_h
20 #include "ITKIOImageBaseExport.h"
21 
22 #include "itkObject.h"
23 #include "itkNumericTraits.h"
24 #include "itkEnableIf.h"
25 
26 namespace itk
27 {
45 template <typename InputPixelType, typename OutputPixelType, typename OutputConvertTraits>
46 class ITK_TEMPLATE_EXPORT ConvertPixelBuffer
47 {
48 public:
49 
51  using OutputComponentType = typename OutputConvertTraits::ComponentType;
53 
54  // Remove all constructor/ destructor / assignments for class with only static member functions.
55  ConvertPixelBuffer(const ConvertPixelBuffer &) = delete;
58  operator=(const ConvertPixelBuffer &) = delete;
60  operator=(ConvertPixelBuffer &&) = delete;
61  virtual ~ConvertPixelBuffer() = delete;
62 
64  static void
65  Convert(InputPixelType * inputData, int inputNumberOfComponents, OutputPixelType * outputData, size_t size);
66 
67  static void
68  ConvertVectorImage(InputPixelType * inputData,
69  int inputNumberOfComponents,
70  OutputPixelType * outputData,
71  size_t size);
72 
73 protected:
77  static void
78  ConvertGrayToGray(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
79 
84  static void
85  ConvertRGBToGray(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
86 
91  static void
92  ConvertRGBAToGray(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
93 
94  static void
95  ConvertMultiComponentToGray(InputPixelType * inputData,
96  int inputNumberOfComponents,
97  OutputPixelType * outputData,
98  size_t size);
99 
104  static void
105  ConvertGrayToRGB(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
106 
108  static void
109  ConvertRGBToRGB(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
110 
112  static void
113  ConvertRGBAToRGB(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
114 
123  static void
124  ConvertMultiComponentToRGB(InputPixelType * inputData,
125  int inputNumberOfComponents,
126  OutputPixelType * outputData,
127  size_t size);
128 
130  static void
131  ConvertGrayToRGBA(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
132 
133  static void
134  ConvertRGBToRGBA(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
135 
136  static void
137  ConvertRGBAToRGBA(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
138 
139  static void
140  ConvertMultiComponentToRGBA(InputPixelType * inputData,
141  int inputNumberOfComponents,
142  OutputPixelType * outputData,
143  size_t size);
144 
148  static void
149  ConvertTensor6ToTensor6(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
150 
151  static void
152  ConvertTensor9ToTensor6(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
153 
155  static void
156  ConvertGrayToComplex(InputPixelType * inputData, OutputPixelType * OutputData, size_t size);
157 
158  static void
159  ConvertComplexToComplex(InputPixelType * inputData, OutputPixelType * outputData, size_t size);
160 
161  static void
162  ConvertMultiComponentToComplex(InputPixelType * inputData,
163  int inputNumberOfComponents,
164  OutputPixelType * outputData,
165  size_t size);
166 
173  template <typename UComponentType>
174  static typename DisableIfC<NumericTraits<UComponentType>::IsInteger, UComponentType>::Type
175  DefaultAlphaValue();
176 
177  template <typename UComponentType>
178  static typename EnableIfC<NumericTraits<UComponentType>::IsInteger, UComponentType>::Type
179  DefaultAlphaValue();
180 };
181 } // namespace itk
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 # include "itkConvertPixelBuffer.hxx"
185 #endif
186 
187 #endif // itkConvertPixelBuffer_h
itkEnableIf.h
itk::ConvertPixelBuffer::OutputComponentType
typename OutputConvertTraits::ComponentType OutputComponentType
Definition: itkConvertPixelBuffer.h:51
itkObject.h
itk::DisableIfC
An implementation of the negation of the enable if idiom.
Definition: itkEnableIf.h:78
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkNumericTraits.h
itk::ConvertPixelBuffer
Class to convert blocks of data from one type to another.
Definition: itkConvertPixelBuffer.h:46