go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLImageFormat.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
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 __itkOpenCLImageFormat_h
19 #define __itkOpenCLImageFormat_h
20 
21 #include "itkOpenCL.h"
22 #include <ostream>
23 
24 namespace itk
25 {
31 // Forward declaration
32 class OpenCLContext;
33 
35 {
36 public:
37 
40 
50  enum ImageType {
51  BUFFER = 0x10F0,
52  IMAGE2D = 0x10F1,
53  IMAGE3D = 0x10F2,
54  IMAGE2D_ARRAY = 0x10F3,
55  IMAGE1D = 0x10F4,
56  IMAGE1D_ARRAY = 0x10F5,
57  IMAGE1D_BUFFER = 0x10F6
58  };
59 
90  enum ChannelOrder {
91  R = 0x10B0,
92  A = 0x10B1,
93  RG = 0x10B2,
94  RA = 0x10B3,
95  RGB = 0x10B4,
96  RGBA = 0x10B5,
97  BGRA = 0x10B6,
98  ARGB = 0x10B7,
99  INTENSITY = 0x10B8,
100  LUMINANCE = 0x10B9,
101  Rx = 0x10BA,
102  RGx = 0x10BB,
103  RGBx = 0x10BC,
104  DEPTH = 0x10BD,
105  DEPTH_STENCIL = 0x10BE
106  };
107 
133  enum ChannelType {
134  SNORM_INT8 = 0x10D0,
135  SNORM_INT16 = 0x10D1,
136  UNORM_INT8 = 0x10D2,
137  UNORM_INT16 = 0x10D3,
138  UNORM_SHORT_565 = 0x10D4,
139  UNORM_SHORT_555 = 0x10D5,
140  UNORM_INT_101010 = 0x10D6,
141  SIGNED_INT8 = 0x10D7,
142  SIGNED_INT16 = 0x10D8,
143  SIGNED_INT32 = 0x10D9,
144  UNSIGNED_INT8 = 0x10DA,
145  UNSIGNED_INT16 = 0x10DB,
146  UNSIGNED_INT32 = 0x10DC,
147  HALF_FLOAT = 0x10DD,
148  FLOAT = 0x10DE,
149  UNORM_INT24 = 0x10DF
150  };
151 
155 
159  const OpenCLImageFormat::ChannelOrder channelOrder,
160  const OpenCLImageFormat::ChannelType channelType );
161 
165  const OpenCLImageFormat::ImageType imageType,
166  const OpenCLImageFormat::ChannelOrder channelOrder,
167  const OpenCLImageFormat::ChannelType channelType );
168 
170  bool IsNull() const;
171 
174  OpenCLImageFormat::ImageType GetImageType() const;
175 
178  OpenCLImageFormat::ChannelOrder GetChannelOrder() const;
179 
182  OpenCLImageFormat::ChannelType GetChannelType() const;
183 
184 private:
185 
186  cl_mem_object_type m_ImageType;
187  cl_image_format m_Format;
188 
190  friend class OpenCLContext;
191  friend class OpenCLImage;
192 };
193 
197 bool ITKOpenCL_EXPORT operator==( const OpenCLImageFormat & lhs, const OpenCLImageFormat & rhs );
198 
202 bool ITKOpenCL_EXPORT operator!=( const OpenCLImageFormat & lhs, const OpenCLImageFormat & rhs );
203 
205 template< typename charT, typename traits >
206 inline
207 std::basic_ostream< charT, traits > &
208 operator<<( std::basic_ostream< charT, traits > & strm,
209  const OpenCLImageFormat & format )
210 {
211  if( format.IsNull() )
212  {
213  strm << "OpenCLImageFormat(null)";
214  return strm;
215  }
216 
217  strm << "OpenCLImageFormat(";
218  switch( int( format.GetImageType() ) )
219  {
221  strm << "BUFFER, "; break;
223  strm << "IMAGE2D, "; break;
225  strm << "IMAGE3D, "; break;
227  strm << "IMAGE2D_ARRAY, "; break;
229  strm << "IMAGE1D, "; break;
231  strm << "IMAGE1D_ARRAY, "; break;
233  strm << "IMAGE1D_BUFFER, "; break;
234  default:
235  strm << int( format.GetImageType() ) << ", "; break;
236  }
237  switch( int( format.GetChannelOrder() ) )
238  {
240  strm << "R, "; break;
242  strm << "A, "; break;
244  strm << "RG, "; break;
246  strm << "RA, "; break;
248  strm << "RGB, "; break;
250  strm << "RGBA, "; break;
252  strm << "BGRA, "; break;
254  strm << "ARGB, "; break;
256  strm << "INTENSITY, "; break;
258  strm << "LUMINANCE, "; break;
260  strm << "Rx, "; break;
262  strm << "RGx, "; break;
264  strm << "RGBx, "; break;
266  strm << "DEPTH, "; break;
268  strm << "DEPTH_STENCIL, "; break;
269  default:
270  strm << int( format.GetChannelOrder() ) << ", "; break;
271  }
272  switch( int( format.GetChannelType() ) )
273  {
275  strm << "SNORM_INT8"; break;
277  strm << "SNORM_INT16"; break;
279  strm << "UNORM_INT8"; break;
281  strm << "UNORM_INT16"; break;
283  strm << "UNORM_SHORT_565"; break;
285  strm << "UNORM_SHORT_555"; break;
287  strm << "UNORM_INT_101010"; break;
289  strm << "SIGNED_INT8"; break;
291  strm << "SIGNED_INT16"; break;
293  strm << "SIGNED_INT32"; break;
295  strm << "UNSIGNED_INT8"; break;
297  strm << "UNSIGNED_INT16"; break;
299  strm << "UNSIGNED_INT32"; break;
301  strm << "HALF_FLOAT"; break;
303  strm << "FLOAT"; break;
305  strm << "UNORM_INT24"; break;
306  default:
307  strm << int( format.GetChannelType() ); break;
308  }
309 
310  strm << ')' << std::endl;
311  return strm;
312 }
313 
314 
315 } // end namespace itk
316 
317 #endif /* __itkOpenCLImageFormat_h */
The OpenCLImage class represents an image object is used to store a one, two or three dimensional tex...
The OpenCLImageFormat class represents the format of a OpenCLImage.
The OpenCLContext class represents an OpenCL context.
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
cl_mem_object_type m_ImageType
#define ITKOpenCL_EXPORT


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo