Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
Public Member Functions | Data Fields
iu::VolumeGpu< PixelType, Allocator >::KernelData Struct Reference

Struct pointer KernelData that can be used in CUDA kernels. More...

#include <volume_gpu.h>

Public Member Functions

__device__ PixelType & operator() (int x, int y, int z)
 
__host__ KernelData (const VolumeGpu< PixelType, Allocator > &vol)
 

Data Fields

PixelType * data_
 
int width_
 
int height_
 
int depth_
 
int stride_
 

Detailed Description

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>
void doSomethingWithCuda(iu::VolumeGpu<PixelType, Allocator> *img, PixelType value)
{
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;
}

Constructor & Destructor Documentation

template<typename PixelType, class Allocator>
__host__ iu::VolumeGpu< PixelType, Allocator >::KernelData::KernelData ( const VolumeGpu< PixelType, Allocator > &  vol)
inline

Constructor.

Member Function Documentation

template<typename PixelType, class Allocator>
__device__ PixelType& iu::VolumeGpu< PixelType, Allocator >::KernelData::operator() ( int  x,
int  y,
int  z 
)
inline

Access the image via the () operator.

Parameters
xPosition in x.
yPosition in y.
zPosition in z.
Returns
value at position (x,y,z).

Field Documentation

template<typename PixelType, class Allocator>
PixelType* iu::VolumeGpu< PixelType, Allocator >::KernelData::data_

Pointer to device buffer.

template<typename PixelType, class Allocator>
int iu::VolumeGpu< PixelType, Allocator >::KernelData::depth_

Depth of Volume.

template<typename PixelType, class Allocator>
int iu::VolumeGpu< PixelType, Allocator >::KernelData::height_

Height of Volume.

template<typename PixelType, class Allocator>
int iu::VolumeGpu< PixelType, Allocator >::KernelData::stride_

Distance in pixels between starts of consecutive rows.

template<typename PixelType, class Allocator>
int iu::VolumeGpu< PixelType, Allocator >::KernelData::width_

Width of Volume.


The documentation for this struct was generated from the following file: