ITK  4.6.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 
25 namespace itk
26 {
40 template<
41  typename InputPixelType,
42  typename OutputPixelType,
43  typename OutputConvertTraits
44  >
46 {
47 public:
48 
50  typedef typename OutputConvertTraits::ComponentType OutputComponentType;
52 
54  static void Convert(InputPixelType *inputData,
55  int inputNumberOfComponents,
56  OutputPixelType *outputData, size_t size);
57 
58  static void ConvertVectorImage(InputPixelType *inputData,
59  int inputNumberOfComponents,
60  OutputPixelType *outputData, size_t size);
61 
62 protected:
66  static void ConvertGrayToGray(InputPixelType *inputData,
67  OutputPixelType *outputData, size_t size);
68 
73  static void ConvertRGBToGray(InputPixelType *inputData,
74  OutputPixelType *outputData, size_t size);
75 
80  static void ConvertRGBAToGray(InputPixelType *inputData,
81  OutputPixelType *outputData, size_t size);
82 
83  static void ConvertMultiComponentToGray(InputPixelType *inputData,
84  int inputNumberOfComponents,
85  OutputPixelType *outputData,
86  size_t size);
87 
92  static void ConvertGrayToRGB(InputPixelType *inputData,
93  OutputPixelType *outputData, size_t size);
94 
96  static void ConvertRGBToRGB(InputPixelType *inputData,
97  OutputPixelType *outputData, size_t size);
98 
100  static void ConvertRGBAToRGB(InputPixelType *inputData,
101  OutputPixelType *outputData, size_t size);
102 
111  static void ConvertMultiComponentToRGB(InputPixelType *inputData,
112  int inputNumberOfComponents,
113  OutputPixelType *outputData,
114  size_t size);
115 
117  static void ConvertGrayToRGBA(InputPixelType *inputData,
118  OutputPixelType *outputData, size_t size);
119 
120  static void ConvertRGBToRGBA(InputPixelType *inputData,
121  OutputPixelType *outputData, size_t size);
122 
123  static void ConvertRGBAToRGBA(InputPixelType *inputData,
124  OutputPixelType *outputData, size_t size);
125 
126  static void ConvertMultiComponentToRGBA(InputPixelType *inputData,
127  int inputNumberOfComponents,
128  OutputPixelType *outputData,
129  size_t size);
130 
134  static void ConvertTensor6ToTensor6(InputPixelType *inputData,
135  OutputPixelType *outputData, size_t size);
136 
137  static void ConvertTensor9ToTensor6(InputPixelType *inputData,
138  OutputPixelType *outputData, size_t size);
139 
141  static void ConvertGrayToComplex(InputPixelType *inputData,
142  OutputPixelType *OutputData, size_t size);
143 
144  static void ConvertComplexToComplex(InputPixelType *inputData,
145  OutputPixelType *outputData, size_t size);
146 
147  static void ConvertMultiComponentToComplex(InputPixelType *inputData,
148  int inputNumberOfComponents,
149  OutputPixelType *outputData, size_t size);
150 
151 private:
154 
161  template <typename PixelType>
162  static double MaxAlpha(PixelType &) { return static_cast<double>(NumericTraits<PixelType>::max()); }
163  static double MaxAlpha(double &) { return static_cast<double>(NumericTraits<double>::One); }
164  static double MaxAlpha(float &) { return static_cast<double>(NumericTraits<float>::One); }
166 
167 };
168 } //namespace ITK
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 #include "itkConvertPixelBuffer.hxx"
172 #endif
173 
174 #endif // __itkConvertPixelBuffer_h
static void ConvertGrayToGray(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBAToRGB(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertGrayToRGB(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static double MaxAlpha(double &)
static void ConvertGrayToRGBA(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertGrayToComplex(InputPixelType *inputData, OutputPixelType *OutputData, vcl_size_t size)
Class to convert blocks of data from one type to another.
static void ConvertTensor6ToTensor6(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertVectorImage(InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBAToRGBA(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBAToGray(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBToGray(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static double MaxAlpha(PixelType &)
static void ConvertRGBToRGBA(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void Convert(InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertMultiComponentToRGB(InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertMultiComponentToComplex(InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertRGBToRGB(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
OutputConvertTraits::ComponentType OutputComponentType
static T max(const T &)
static void ConvertMultiComponentToGray(InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static double MaxAlpha(float &)
Define additional traits for native types such as int or float.
static void ConvertTensor9ToTensor6(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)
static void ConvertMultiComponentToRGBA(InputPixelType *inputData, int inputNumberOfComponents, OutputPixelType *outputData, vcl_size_t size)
static void ConvertComplexToComplex(InputPixelType *inputData, OutputPixelType *outputData, vcl_size_t size)