4 #include "volume_allocator_gpu.h"
5 #include <thrust/device_ptr.h>
11 template<
typename PixelType,
class Allocator>
24 data_(0), pitch_(0), ext_data_pointer_(false)
31 if(!ext_data_pointer_)
34 Allocator::free(data_);
45 VolumeGpu(
unsigned int _width,
unsigned int _height,
unsigned int _depth) :
46 Volume(_width, _height, _depth), data_(0), pitch_(0),
47 ext_data_pointer_(false)
49 data_ = Allocator::alloc(this->
size(), &pitch_);
56 Volume(size), data_(0), pitch_(0),
57 ext_data_pointer_(false)
59 data_ = Allocator::alloc(this->
size(), &pitch_);
70 VolumeGpu(PixelType* _data,
unsigned int _width,
unsigned int _height,
unsigned int _depth,
71 size_t _pitch,
bool ext_data_pointer =
false) :
72 Volume(_width, _height, _depth), data_(0), pitch_(0),
73 ext_data_pointer_(ext_data_pointer)
87 data_ = Allocator::alloc(this->
size(), &pitch_);
113 return pitch_/
sizeof(PixelType);
119 return height()*pitch_/
sizeof(PixelType);
125 return 8*
sizeof(PixelType);
141 PixelType*
data(
int ox = 0,
int oy = 0,
int oz = 0)
152 const PixelType*
data(
int ox = 0,
int oy = 0,
int oz = 0)
const
154 return reinterpret_cast<const PixelType*
>(
172 thrust::device_ptr<PixelType>
begin(
void)
174 return thrust::device_ptr<PixelType>(
data());
180 thrust::device_ptr<PixelType>
end(
void)
262 bool ext_data_pointer_;
const PixelType * data(int ox=0, int oy=0, int oz=0) const
Definition: volume_gpu.h:152
ImageGpu< PixelType, iuprivate::ImageAllocatorGpu< PixelType > > getSlice(int oz)
Definition: volume_gpu.h:163
PixelType pixel_type
Definition: volume_gpu.h:19
VolumeGpu()
Definition: volume_gpu.h:22
size_t slice_stride() const
Definition: volume_gpu.h:117
size_t bytes() const
Definition: volume_gpu.h:93
thrust::device_ptr< PixelType > end(void)
Definition: volume_gpu.h:180
unsigned int width() const
Definition: volume.h:81
VolumeGpu(unsigned int _width, unsigned int _height, unsigned int _depth)
Definition: volume_gpu.h:45
IUCORE_DLLAPI void copy(const LinearHostMemory_8u_C1 *src, LinearHostMemory_8u_C1 *dst)
int stride_
Definition: volume_gpu.h:228
VolumeGpu(const iu::Size< 3 > &size)
Definition: volume_gpu.h:55
size_t pitch() const
Definition: volume_gpu.h:99
virtual ~VolumeGpu()
Definition: volume_gpu.h:29
PixelType * data_
Definition: volume_gpu.h:220
Template specialization for 3-d unsigned int vectors (size vectors).
Definition: vector.h:605
unsigned int height() const
Definition: volume.h:89
Definition: image_cpu.h:7
unsigned int depth() const
Definition: volume.h:97
PixelType * data(int ox=0, int oy=0, int oz=0)
Definition: volume_gpu.h:141
__host__ KernelData(const VolumeGpu< PixelType, Allocator > &vol)
Definition: volume_gpu.h:242
int width_
Definition: volume_gpu.h:222
int height_
Definition: volume_gpu.h:224
thrust::device_ptr< PixelType > begin(void)
Definition: volume_gpu.h:172
Base class for 3D volumes (pitched memory).
Definition: volume.h:29
VolumeGpu(PixelType *_data, unsigned int _width, unsigned int _height, unsigned int _depth, size_t _pitch, bool ext_data_pointer=false)
Definition: volume_gpu.h:70
virtual bool onDevice() const
Definition: volume_gpu.h:129
Struct pointer KernelData that can be used in CUDA kernels.
Definition: volume_gpu.h:217
size_t stride() const
Definition: volume_gpu.h:111
__device__ PixelType & operator()(int x, int y, int z)
Definition: volume_gpu.h:236
Device 2D image class (pitched memory).
Definition: image_gpu.h:34
virtual unsigned int bitDepth() const
Definition: volume_gpu.h:123
ndarray_ref< PixelType, 3 > ref() const
iu::Size< 3 > size() const
Definition: volume.h:73
size_t slice_pitch() const
Definition: volume_gpu.h:105
int depth_
Definition: volume_gpu.h:226
Device 3D volume class (pitched memory).
Definition: volume_gpu.h:15