go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLBuffer.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 /*=========================================================================
19  *
20  * Copyright UMC Utrecht and contributors
21  *
22  * Licensed under the Apache License, Version 2.0 (the "License");
23  * you may not use this file except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  * http://www.apache.org/licenses/LICENSE-2.0.txt
27  *
28  * Unless required by applicable law or agreed to in writing, software
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  *=========================================================================*/
35 #ifndef __itkOpenCLBuffer_h
36 #define __itkOpenCLBuffer_h
37 
38 #include "itkOpenCLMemoryObject.h"
39 #include "itkOpenCLEvent.h"
40 
41 namespace itk
42 {
50 // Forward declaration
51 class OpenCLImage;
52 
54 {
55 public:
56 
58  typedef OpenCLBuffer Self;
59 
62 
67  OpenCLBuffer( OpenCLContext * context, const cl_mem id );
68 
70  OpenCLBuffer( const OpenCLBuffer & other );
71 
73  OpenCLBuffer & operator=( const OpenCLBuffer & other );
74 
80  bool Read( void * data, const std::size_t size, const std::size_t offset = 0 );
81 
88  OpenCLEvent ReadAsync( void * data, const std::size_t size,
89  const OpenCLEventList & event_list = OpenCLEventList(),
90  const std::size_t offset = 0 );
91 
98  bool Write( const void * data, const std::size_t size, const std::size_t offset = 0 );
99 
106  OpenCLEvent WriteAsync( const void * data, const std::size_t size,
107  const OpenCLEventList & event_list = OpenCLEventList(),
108  const std::size_t offset = 0 );
109 
117  bool ReadRect( void * data, const RectangleType & rect,
118  const std::size_t bufferBytesPerLine, const std::size_t hostBytesPerLine );
119 
126  OpenCLEvent ReadRectAsync( void * data, const RectangleType & rect,
127  const std::size_t bufferBytesPerLine, const std::size_t hostBytesPerLine,
128  const OpenCLEventList & event_list = OpenCLEventList() );
129 
138  bool ReadRect( void * data,
139  const std::size_t origin[ 3 ], const std::size_t size[ 3 ],
140  const std::size_t bufferBytesPerLine, const std::size_t bufferBytesPerSlice,
141  const std::size_t hostBytesPerLine, const std::size_t hostBytesPerSlice );
142 
149  OpenCLEvent ReadRectAsync( void * data,
150  const std::size_t origin[ 3 ], const std::size_t size[ 3 ],
151  const std::size_t bufferBytesPerLine, const std::size_t bufferBytesPerSlice,
152  const std::size_t hostBytesPerLine, const std::size_t hostBytesPerSlice,
153  const OpenCLEventList & event_list = OpenCLEventList() );
154 
161  bool WriteRect( const void * data, const RectangleType & rect,
162  const std::size_t bufferBytesPerLine, const std::size_t hostBytesPerLine );
163 
170  OpenCLEvent WriteRectAsync( const void * data, const RectangleType & rect,
171  const std::size_t bufferBytesPerLine, const std::size_t hostBytesPerLine,
172  const OpenCLEventList & event_list = OpenCLEventList() );
173 
181  bool WriteRect( const void * data,
182  const std::size_t origin[ 3 ], const std::size_t size[ 3 ],
183  const std::size_t bufferBytesPerLine, const std::size_t bufferBytesPerSlice,
184  const std::size_t hostBytesPerLine, const std::size_t hostBytesPerSlice );
185 
192  OpenCLEvent WriteRectAsync( const void * data,
193  const std::size_t origin[ 3 ], const std::size_t size[ 3 ],
194  const std::size_t bufferBytesPerLine, const std::size_t bufferBytesPerSlice,
195  const std::size_t hostBytesPerLine, const std::size_t hostBytesPerSlice,
196  const OpenCLEventList & event_list = OpenCLEventList() );
197 
204  bool CopyToBuffer( const OpenCLBuffer & dest, const std::size_t size,
205  const std::size_t dst_offset = 0, const std::size_t offset = 0 );
206 
213  OpenCLEvent CopyToBufferAsync( const OpenCLBuffer & dest,
214  const std::size_t size,
215  const OpenCLEventList & event_list = OpenCLEventList(),
216  const std::size_t dst_offset = 0,
217  const std::size_t offset = 0 );
218 
224  bool CopyToImage( const OpenCLImage & dest,
225  const OpenCLSize & origin, const OpenCLSize & region,
226  const std::size_t src_offset = 0 );
227 
234  OpenCLEvent CopyToImageAsync( const OpenCLImage & dest,
235  const OpenCLSize & origin, const OpenCLSize & region,
236  const OpenCLEventList & event_list = OpenCLEventList(),
237  const std::size_t src_offset = 0 );
238 
246  bool CopyToRect( const OpenCLBuffer & dest,
247  const RectangleType & rect, const PointType & destPoint,
248  const std::size_t bufferBytesPerLine, std::size_t destBytesPerLine );
249 
256  OpenCLEvent CopyToRectAsync( const OpenCLBuffer & dest,
257  const RectangleType & rect, const PointType & destPoint,
258  const std::size_t bufferBytesPerLine, const std::size_t destBytesPerLine,
259  const OpenCLEventList & event_list = OpenCLEventList() );
260 
269  bool CopyToRect( const OpenCLBuffer & dest,
270  const std::size_t origin[ 3 ], const std::size_t size[ 3 ],
271  const std::size_t destOrigin[ 3 ],
272  const std::size_t bufferBytesPerLine, const std::size_t bufferBytesPerSlice,
273  const std::size_t destBytesPerLine, const std::size_t destBytesPerSlice );
274 
281  OpenCLEvent CopyToRectAsync( const OpenCLBuffer & dest,
282  const std::size_t origin[ 3 ], const std::size_t size[ 3 ],
283  const std::size_t destOrigin[ 3 ],
284  const std::size_t bufferBytesPerLine, const std::size_t bufferBytesPerSlice,
285  const std::size_t destBytesPerLine, const std::size_t destBytesPerSlice,
286  const OpenCLEventList & event_list = OpenCLEventList() );
287 
294  void * Map( const OpenCLMemoryObject::Access access,
295  const std::size_t size, const std::size_t offset = 0 );
296 
303  OpenCLEvent MapAsync( void ** ptr, const OpenCLMemoryObject::Access access,
304  const std::size_t size, const OpenCLEventList & event_list = OpenCLEventList(),
305  const std::size_t offset = 0 );
306 
310  void * Map( const OpenCLMemoryObject::Access access );
311 
317  OpenCLBuffer CreateSubBuffer
318  ( const OpenCLMemoryObject::Access access,
319  const std::size_t size, const std::size_t offset = 0 );
320 
323  OpenCLBuffer GetParentBuffer() const;
324 
328  std::size_t GetOffset() const;
329 
330 };
331 
332 } // end namespace itk
333 
334 #endif /* __itkOpenCLBuffer_h */
The OpenCLImage class represents an image object is used to store a one, two or three dimensional tex...
OpenCLBuffer Self
OpenCLEventList class represents a list of OpenCLEvent objects.
The OpenCLSize class defines the size of an item of work for an OpenCL kernel.
Definition: itkOpenCLSize.h:49
The OpenCLBuffer class represents an OpenCL buffer object.
The OpenCLContext class represents an OpenCL context.
The OpenCLMemoryObject class represents all common memory objects such as buffers and image objects...
#define ITKOpenCL_EXPORT
OpenCLEvent class represents an OpenCL event object.


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