ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkConvertPixelBuffer.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 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 {
41 template<
42  typename InputPixelType,
43  typename OutputPixelType,
44  typename OutputConvertTraits
45  >
46 class ITK_TEMPLATE_EXPORT ConvertPixelBuffer
47 {
48 public:
49 
51  typedef typename OutputConvertTraits::ComponentType OutputComponentType;
53 
55  static void Convert(InputPixelType *inputData,
56  int inputNumberOfComponents,
57  OutputPixelType *outputData, size_t size);
58 
59  static void ConvertVectorImage(InputPixelType *inputData,
60  int inputNumberOfComponents,
61  OutputPixelType *outputData, size_t size);
62 
63 protected:
67  static void ConvertGrayToGray(InputPixelType *inputData,
68  OutputPixelType *outputData, size_t size);
69 
74  static void ConvertRGBToGray(InputPixelType *inputData,
75  OutputPixelType *outputData, size_t size);
76 
81  static void ConvertRGBAToGray(InputPixelType *inputData,
82  OutputPixelType *outputData, size_t size);
83 
84  static void ConvertMultiComponentToGray(InputPixelType *inputData,
85  int inputNumberOfComponents,
86  OutputPixelType *outputData,
87  size_t size);
88 
93  static void ConvertGrayToRGB(InputPixelType *inputData,
94  OutputPixelType *outputData, size_t size);
95 
97  static void ConvertRGBToRGB(InputPixelType *inputData,
98  OutputPixelType *outputData, size_t size);
99 
101  static void ConvertRGBAToRGB(InputPixelType *inputData,
102  OutputPixelType *outputData, size_t size);
103 
112  static void ConvertMultiComponentToRGB(InputPixelType *inputData,
113  int inputNumberOfComponents,
114  OutputPixelType *outputData,
115  size_t size);
116 
118  static void ConvertGrayToRGBA(InputPixelType *inputData,
119  OutputPixelType *outputData, size_t size);
120 
121  static void ConvertRGBToRGBA(InputPixelType *inputData,
122  OutputPixelType *outputData, size_t size);
123 
124  static void ConvertRGBAToRGBA(InputPixelType *inputData,
125  OutputPixelType *outputData, size_t size);
126 
127  static void ConvertMultiComponentToRGBA(InputPixelType *inputData,
128  int inputNumberOfComponents,
129  OutputPixelType *outputData,
130  size_t size);
131 
135  static void ConvertTensor6ToTensor6(InputPixelType *inputData,
136  OutputPixelType *outputData, size_t size);
137 
138  static void ConvertTensor9ToTensor6(InputPixelType *inputData,
139  OutputPixelType *outputData, size_t size);
140 
142  static void ConvertGrayToComplex(InputPixelType *inputData,
143  OutputPixelType *OutputData, size_t size);
144 
145  static void ConvertComplexToComplex(InputPixelType *inputData,
146  OutputPixelType *outputData, size_t size);
147 
148  static void ConvertMultiComponentToComplex(InputPixelType *inputData,
149  int inputNumberOfComponents,
150  OutputPixelType *outputData, size_t size);
151 
158  template <typename UComponentType>
159  static typename DisableIfC<
160  NumericTraits< UComponentType >::IsInteger, UComponentType>::Type
161  DefaultAlphaValue( void );
162 
163  template <typename UComponentType>
164  static typename EnableIfC<
165  NumericTraits< UComponentType >::IsInteger, UComponentType>::Type
166  DefaultAlphaValue( void );
167 
168 private:
171 
172 };
173 } //namespace ITK
174 
175 #ifndef ITK_MANUAL_INSTANTIATION
176 #include "itkConvertPixelBuffer.hxx"
177 #endif
178 
179 #endif // itkConvertPixelBuffer_h
Class to convert blocks of data from one type to another.
OutputConvertTraits::ComponentType OutputComponentType
Define additional traits for native types such as int or float.
An implementation of the negation of the enable if idiom.
Definition: itkEnableIf.h:71