4 #include "volume_allocator_cpu.h"
12 template<
typename PixelType,
class Allocator>
22 data_(0), pitch_(0), ext_data_pointer_(false)
29 if(!ext_data_pointer_)
32 Allocator::free(data_);
43 VolumeCpu(
unsigned int _width,
unsigned int _height,
unsigned int _depth) :
44 Volume(_width, _height, _depth),
46 ext_data_pointer_(false)
48 data_ = Allocator::alloc(_width, _height, _depth, &pitch_);
55 Volume(size), data_(0), pitch_(0),
56 ext_data_pointer_(false)
69 VolumeCpu(PixelType* _data,
unsigned int _width,
unsigned int _height,
unsigned int _depth,
70 size_t _pitch,
bool ext_data_pointer =
false) :
71 Volume(_width, _height, _depth),
72 data_(0), pitch_(0), ext_data_pointer_(ext_data_pointer)
86 data_ = Allocator::alloc(_width, _height, _depth, &pitch_);
112 return pitch_/
sizeof(PixelType);
118 return height()*pitch_/
sizeof(PixelType);
124 return 8*
sizeof(PixelType);
139 PixelType*
data(
int ox = 0,
int oy = 0,
int oz = 0)
150 const PixelType*
data(
int ox = 0,
int oy = 0,
int oz = 0)
const
152 return reinterpret_cast<const PixelType*
>(
167 PixelType
getPixel(
unsigned int x,
unsigned int y,
unsigned int z)
169 return *
data(x, y, z);
175 thrust::pointer<PixelType, thrust::host_system_tag>
begin(
void)
177 return thrust::pointer<PixelType, thrust::host_system_tag>(
data());
183 thrust::pointer<PixelType, thrust::host_system_tag>
end(
void)
202 bool ext_data_pointer_;
size_t bytes() const
Definition: volume_cpu.h:92
VolumeCpu()
Definition: volume_cpu.h:20
unsigned int & depth
Definition: vector.h:613
thrust::pointer< PixelType, thrust::host_system_tag > end(void)
Definition: volume_cpu.h:183
size_t stride() const
Definition: volume_cpu.h:110
PixelType pixel_type
Definition: volume_cpu.h:17
unsigned int width() const
Definition: volume.h:81
ndarray_ref< PixelType, 3 > ref() const
IUCORE_DLLAPI void copy(const LinearHostMemory_8u_C1 *src, LinearHostMemory_8u_C1 *dst)
size_t slice_stride() const
Definition: volume_cpu.h:116
unsigned int & height
Definition: vector.h:611
size_t pitch() const
Definition: volume_cpu.h:98
Template specialization for 3-d unsigned int vectors (size vectors).
Definition: vector.h:605
unsigned int height() const
Definition: volume.h:89
ImageCpu< PixelType, iuprivate::ImageAllocatorCpu< PixelType > > getSlice(int oz)
Definition: volume_cpu.h:161
Definition: image_cpu.h:7
VolumeCpu(const iu::Size< 3 > &size)
Definition: volume_cpu.h:54
unsigned int depth() const
Definition: volume.h:97
virtual bool onDevice() const
Definition: volume_cpu.h:128
VolumeCpu(unsigned int _width, unsigned int _height, unsigned int _depth)
Definition: volume_cpu.h:43
Base class for 3D volumes (pitched memory).
Definition: volume.h:29
virtual unsigned int bitDepth() const
Definition: volume_cpu.h:122
PixelType * data(int ox=0, int oy=0, int oz=0)
Definition: volume_cpu.h:139
unsigned int & width
Definition: vector.h:609
size_t slice_pitch() const
Definition: volume_cpu.h:104
virtual ~VolumeCpu()
Definition: volume_cpu.h:27
VolumeCpu(PixelType *_data, unsigned int _width, unsigned int _height, unsigned int _depth, size_t _pitch, bool ext_data_pointer=false)
Definition: volume_cpu.h:69
thrust::pointer< PixelType, thrust::host_system_tag > begin(void)
Definition: volume_cpu.h:175
const PixelType * data(int ox=0, int oy=0, int oz=0) const
Definition: volume_cpu.h:150
Host 2D image class (pitched memory).
Definition: image_cpu.h:27
PixelType getPixel(unsigned int x, unsigned int y, unsigned int z)
Definition: volume_cpu.h:167
iu::Size< 3 > size() const
Definition: volume.h:73
Host 3D volume class (pitched memory).
Definition: volume_cpu.h:13