4 #include <cuda_runtime.h>
10 template <
typename PixelType>
14 static PixelType* alloc(
unsigned int width,
unsigned int height,
unsigned int depth,
size_t *pitch)
16 if ((width==0) || (height==0) || (depth==0))
17 throw IuException(
"width, height or depth is 0", __FILE__,__FUNCTION__, __LINE__);
18 PixelType *buffer =
new PixelType[width*height*depth];
19 *pitch = width *
sizeof(PixelType);
23 static void free(PixelType *buffer)
28 static void copy(
const PixelType *src,
size_t src_pitch,
31 size_t src_stride = src_pitch/
sizeof(PixelType);
32 size_t dst_stride = dst_pitch/
sizeof(PixelType);
34 for(
unsigned int z=0; z<size.
depth; ++z)
36 for(
unsigned int y=0; y<size.
height; ++y)
38 for(
unsigned int x=0; x<size.
width; ++x)
40 dst[z*dst_stride*size.
height + y*dst_stride + x] =
41 src[z*src_stride*size.
height + y*src_stride + x];
unsigned int & depth
Definition: vector.h:613
unsigned int & height
Definition: vector.h:611
Exceptions with additional error information.
Definition: coredefs.h:32
Template specialization for 3-d unsigned int vectors (size vectors).
Definition: vector.h:605
unsigned int & width
Definition: vector.h:609
Definition: volume_allocator_cpu.h:11