template<typename PixelType, class Allocator>
struct iu::VolumeGpu< PixelType, Allocator >::KernelData
Struct pointer KernelData that can be used in CUDA kernels.
- Todo:
- cuda texture for VolumeGpu
This struct provides the device data pointer as well as important class properties.
template<typename PixelType, class Allocator>
__global__ void cudaFunctionKernel(VolumeGpu<PixelType, Allocator>::KernelData img, PixelType value)
{
const unsigned int x = threadIdx.x + blockIdx.x * blockDim.x;
const unsigned int y = threadIdx.y + blockIdx.y * blockDim.y;
const unsigned int z = threadIdx.z + blockIdx.z * blockDim.z;
if (x < img.width_ && y < img.height_ && z < img.depth_)
{
img(x, y, z) += value;
}
}
template<typename PixelType, class Allocator>
{
dim3 dimBlock(8,8,4);
dim3 dimGrid(iu::divUp(img->
width(), dimBlock.x),
iu::divUp(img->
height(), dimBlock.y),
iu::divUp(img->
depth(), dimBlock.z));
cudaFunctionKernel<PixelType, Allocator><<<dimGrid, dimBlock>>>(*img, value);
IU_CUDA_CHECK;
}