How to render 16 bits volume image

Hello,
I’m a beginner in Jcuda.I look at Code sample “JCudaDriverTextureSample.java” and try to render 8 bits volume image,It work fine.But when i use input as 16 bits images ,It doesn’t work.
Is there any way to modify “JCudaDriverTextureSample.java” for render 16 bits volume image?

Hello

Certainly, there is. But most likely it’s not a simple single-line modification. (BTW: This sample has basically been created by porting the NVIDIA sample to JCuda, so I’m not perfectyl aware of every detail in there…)

Some basic elements of such a conversion would be (off the top of my head, there may be further details)

  • The “private byte h_volume[];” will have to be of type “short”
  • Accordingly, the srcPitch and srcHeight of the “CUDA_MEMCPY3D copy” will have to be adjusted
  • The format of the CUDA_ARRAY3D_DESCRIPTOR has to be CU_AD_FORMAT_UNSIGNED_INT16
  • The kernel will have to be adjusted, for example, the texture reference will no longer be a “texture<uchar…” but a “texture<ushort…” or so

Of course, it would be desirable to have a more “generic” application that can work with 8- or 16 bit data, but still, this is just a small sample to show the capabilities of CUDA/JCuda, and it is NOT a “real” application. (Although, one of the many, many projects that I once intended to start was “JCVR”, a more generic “Java Cuda Volume Renderer”, based on this example - but I didn’t get far with that …)

bye
Marco