Kinetic Visualization (Visualisierung 2 - S2012)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions | Variables
ProcessingUtilsCuda.cu File Reference
#include "ProcessingUtilsCuda.h"
#include <cuda_runtime.h>
#include <vector_types.h>
#include <stdio.h>

Macros

#define CHECK_CUDA(X)

Functions

__global__ void convolve (float *resultBuffer, int width, int height, int depth, float *kern, int kW, int kH, int kD, int offset)
__global__ void gradient (float4 *resultBuffer, int width, int height, int depth, int offset)
__device__ float computeAlpha (float fx, float fy, float fz, float fxx, float fxy, float fxz, float fyx, float fyy, float fyz, float fzx, float fzy, float fzz)
__global__ void curvature (float4 *resultBuffer, int width, int height, int depth, int offset, int offsetImage, int maxIdx)
int cudaCurvature3D (float4 *gradient, float4 *resultBuffer, int width, int height, int depth)
int cudaGradient3D (float *image, float4 *resultBuffer, int width, int height, int depth)
int cudaConvolve3D (float *image, float *resultBuffer, int width, int height, int depth, float *kernel, int kW, int kH, int kD)

Variables

texture< float,
3, cudaReadModeElementType > 
image_ref
texture< float4,
3, cudaReadModeElementType > 
gradient_ref

Macro Definition Documentation

#define CHECK_CUDA (   X)
Value:
{ \
cudaThreadSynchronize(); \
cudaError_t retVal = (X); \
if (retVal != 0) { \
fprintf(stderr, "CUDA Error: %d - %s on Line %d in File %s\n", retVal, cudaGetErrorString(retVal), __LINE__, __FILE__); \
return -1; \
} \
}

Function Documentation

__device__ float computeAlpha ( float  fx,
float  fy,
float  fz,
float  fxx,
float  fxy,
float  fxz,
float  fyx,
float  fyy,
float  fyz,
float  fzx,
float  fzy,
float  fzz 
)
__global__ void convolve ( float *  resultBuffer,
int  width,
int  height,
int  depth,
float *  kern,
int  kW,
int  kH,
int  kD,
int  offset 
)
  Convolves the volume with a kernel
Parameters:
resultBufferis the result buffer, in which the data should be written
widthis the width of the volume
heightis the height of the volume
depthis the depth of the volume
kernis the kernel
kWis the kernel width
kHis the kernel height
kDis the kernel depth
offsetis an additional offset which is added to the index. This must be used, since we are convolving in XY-plane chunks along the z-axis for memory/block-size reasons

!!

int cudaConvolve3D ( float *  image,
float *  resultBuffer,
int  width,
int  height,
int  depth,
float *  kernel,
int  kW,
int  kH,
int  kD 
)
  Convolves the 3D volume with cuda
Parameters:
imageis the 3D volume
resultBufferis a buffer for the result
widthis the width of the volume
heightis the height of the volume
depthis the depth of the volume
kernelis the convolution-kernel
kWis the kernel width
kHis the kernel height
kDis the kernel depth
int cudaCurvature3D ( float4 *  gradient,
float4 *  resultBuffer,
int  width,
int  height,
int  depth 
)
  Calculates the curvature with cuda
Parameters:
gradientis the gradient image
resultBufferis the result buffer in which the result should be written
widthis the width of the volume
heightis the height of the volume
depthis the depth of the volume
int cudaGradient3D ( float *  image,
float4 *  resultBuffer,
int  width,
int  height,
int  depth 
)
  Calculates the gradient with cuda
Parameters:
imageis the volume-'image' whose gradient should be calculated
resultBufferis a buffer in which the gradient will be stored
widthis the width of the volume
heightis the height of the volume
depthis the depth of the volume
__global__ void curvature ( float4 *  resultBuffer,
int  width,
int  height,
int  depth,
int  offset,
int  offsetImage,
int  maxIdx 
)
  Calculates the curvature with cuda. The result image is only bound in XY-slices! So we must subtract offset from it!

Furthermore the gradient image is bound in chunks. The chunks start with offsetImage and end with maxId.

Parameters:
resultBufferis the buffer in which the results are written.
widthis the width of the buffer
heightis the height of the buffer
depthis the depth of the buffer
offsetis an additional offset, since we are processing in XY-slices
offsetImageis an offset in the gradient image
maxIdxis basically the limit to which the gradient image is bound. Blocks executing after this image should not be run (or they accessing unbound gradient-chunks)
__global__ void gradient ( float4 *  resultBuffer,
int  width,
int  height,
int  depth,
int  offset 
)
  Calculates the gradient.
Parameters:
resultBufferis the result image buffer
widthis the volume width
heightis the volume height
depthis the volume depth
offsetis an additional index-offset since we are convolving the gradient in XY-plane-chunks for memory/block-size reasons

Variable Documentation

texture<float4, 3, cudaReadModeElementType> gradient_ref
texture<float, 3, cudaReadModeElementType> image_ref