8

I have volumetric data, which I can render using CUDAVolumetricRender[]. However, I cannot seem to find a way to combine it with other 3D graphics, such as adding a bounding box, axes, labels, etc.

How is CUDAVolumetricRender[] supposed to be customized? It returns a DynamicModule, which is pretty opaque.

F'x
  • 10,817
  • 3
  • 52
  • 92
  • 1
    I'm not sure it's possible. After looking at it, it seems it's only a plain 2D image that's being dynamically updated. But if you have version 9, you can use Raster3D and Image3D which easily solve the problem. – Szabolcs Apr 03 '13 at 14:11

1 Answers1

6

The problem you face here is that CUDAVolumetricRender[] does the projection onto the image plane on its own. The function I pointed out at the end of my answer to your other CUDA related question calculates this projection from the 3D data set onto the 2D image you see.

The situation is far from hopeless because Image3D in version 9 uses the same technique to render a 3D data set. In contrast to the CUDA renderer this data type can be used in combination with other Graphics3D directives. Creating a bounding box or axes is done in no time

data = Table[
   If[z == 0 && (Mod[x, 8] == 0 || Mod[y, 8] == 0) || (Abs[x] < 8 && 
       Abs[y] < 8 && -16 < z < 0), 255, 0], {z, -50, 50}, {y, -50, 
    50}, {x, -50, 50}];
img = Image3D[data, "Byte"]

Show[{img, Graphics3D[{Sphere[{10, 10, 90}, 5]}]}, Boxed -> True, Axes -> True]

enter image description here

halirutan
  • 112,764
  • 7
  • 263
  • 474