13 #include "memorydefs.h"
14 #include "../iucutil.h"
25 template <
typename PixelType,
unsigned int Ndim>
28 IU_SIZE_CHECK(src, dst);
29 memcpy(dst->
data(), src->
data(), dst->
numel() *
sizeof(PixelType));
33 template <
typename PixelType,
unsigned int Ndim>
36 IU_SIZE_CHECK(src, dst);
37 IU_CUDA_SAFE_CALL(cudaMemcpy(dst->
data(), src->
data(), dst->
numel() *
sizeof(PixelType), cudaMemcpyDeviceToDevice));
41 template <
typename PixelType,
unsigned int Ndim>
44 IU_SIZE_CHECK(src, dst);
45 IU_CUDA_SAFE_CALL(cudaMemcpy(dst->
data(), src->
data(), dst->
numel() *
sizeof(PixelType), cudaMemcpyHostToDevice));
49 template <
typename PixelType,
unsigned int Ndim>
52 IU_SIZE_CHECK(src, dst);
53 IU_CUDA_SAFE_CALL(cudaMemcpy(dst->
data(), src->
data(), dst->
numel() *
sizeof(PixelType), cudaMemcpyDeviceToHost));
63 template<
typename PixelType,
class Allocator >
67 IU_SIZE_CHECK(src, dst);
72 template<
typename PixelType,
class Allocator >
76 IU_SIZE_CHECK(src, dst);
81 template<
typename PixelType,
class AllocatorCpu,
class AllocatorGpu >
85 IU_SIZE_CHECK(src, dst);
86 IU_CUDA_SAFE_CALL(cudaMemcpy2D(dst->
data(), dst->
pitch(),
89 cudaMemcpyHostToDevice));
93 template<
typename PixelType,
class AllocatorGpu,
class AllocatorCpu >
97 IU_SIZE_CHECK(src, dst);
98 IU_CUDA_SAFE_CALL(cudaMemcpy2D(dst->
data(), dst->
pitch(),
101 cudaMemcpyDeviceToHost));
111 template<
typename PixelType,
class Allocator >
115 IU_SIZE_CHECK(src, dst);
120 template<
typename PixelType,
class Allocator >
124 IU_SIZE_CHECK(src, dst);
129 template<
typename PixelType,
class AllocatorCpu,
class AllocatorGpu >
133 IU_SIZE_CHECK(src, dst);
134 IU_CUDA_SAFE_CALL(cudaMemcpy2D(dst->
data(), dst->
pitch(),
137 cudaMemcpyHostToDevice));
141 template<
typename PixelType,
class AllocatorGpu,
class AllocatorCpu >
145 IU_SIZE_CHECK(src, dst);
146 IU_CUDA_SAFE_CALL(cudaMemcpy2D(dst->
data(), dst->
pitch(),
149 cudaMemcpyDeviceToHost));
152 template<
typename PixelType,
class AllocatorCpu >
155 IU_SIZE_CHECK(src, dst);
156 PixelType *dstData = dst->
data();
157 for(
unsigned int y = 0; y < src->
height(); ++y)
159 for(
unsigned int x = 0; x < src->
width(); ++x)
161 dstData[x + y * src->
width()] = *(src->
data(x, y));
iu::Size< 2 > size() const
Definition: image.h:64
PixelType * data(unsigned int offset=0)
Definition: lineardevicememory.h:130
unsigned int width() const
Definition: volume.h:81
IUCORE_DLLAPI void copy(const LinearHostMemory_8u_C1 *src, LinearHostMemory_8u_C1 *dst)
unsigned int numel() const
Definition: linearmemory.h:105
Linear host memory class.
Definition: linearhostmemory.h:33
size_t pitch() const
Definition: volume_gpu.h:99
size_t pitch() const
Definition: volume_cpu.h:98
unsigned int height() const
Definition: volume.h:89
unsigned int depth() const
Definition: volume.h:97
PixelType * data(int ox=0, int oy=0, int oz=0)
Definition: volume_gpu.h:141
virtual size_t pitch() const
Definition: image_cpu.h:142
PixelType * data(int ox=0, int oy=0, int oz=0)
Definition: volume_cpu.h:139
unsigned int width() const
Definition: image.h:72
Linear device memory class.
Definition: lineardevicememory.h:18
virtual size_t pitch() const
Definition: image_gpu.h:127
Device 2D image class (pitched memory).
Definition: image_gpu.h:34
PixelType * data(int ox=0, int oy=0)
Definition: image_cpu.h:103
Host 2D image class (pitched memory).
Definition: image_cpu.h:27
PixelType * data(int ox=0, int oy=0)
Definition: image_gpu.h:160
PixelType * data(unsigned int offset=0)
Definition: linearhostmemory.h:137
unsigned int height() const
Definition: image.h:80
iu::Size< 3 > size() const
Definition: volume.h:73
Host 3D volume class (pitched memory).
Definition: volume_cpu.h:13
Device 3D volume class (pitched memory).
Definition: volume_gpu.h:15