RayCasting 3D Image with "bit objects"

I’d like to ask your advice.


  • 3D image
    • Individual bits in a pixel represent individual objects:
      • 0 [b0000] - no object
      • 1 [b0001] - object A
      • 2 [b0010] - object B
      • 4 [b0100] - object C
      • 8 [b1000] - object D
    • the picture also contains intersections of objects:
      • 3 [b0011] - objects A and B
      • 12 [b1100] - objects C and D
      • 13 [b1101] - objects A and C and D


A 2D image created by ray casting a 3D image by setting all the bits of the objects the ray “visited” during the pass. Basically using vtkGPUVolumeRayCastMapper with SetBlendModeToAdditive() but instead of summing perform a binary OR function.

I need the outline of each object defined in the 3D image from the current camera position.

Currently I am ray casting each object from the 3D image separately but I need to optimize the application.

Can you please advise me what combination of filters I should choose?
Thank you in advance for any advice…

I don’t think bit operations are possible in the composer (maybe someone else knows otherwise?)

But if you only have 4 objects, you can put each object in its own 8-bit channel. Then you can try a four-channel maximum intensity projection.

Unfortunately the image contains more objects (approximately 20).

I tried to modify the filters mentioned above, but they have limitations that prevent me from using them despite the modification.

I am currently considering implementing a custom RayCasting algorithm optimized for my case.

The GPU volume ray cast mapper supports label mapping with up to 256 labels. You’d have to create a 3D volume that serves as a mask for the mapper identifying individual labels (objects, in your case). Take a look at the TestGPURayCastLabelMap for an example.

The volume mapper supports user specified custom shader code pieces. Take a look at TestGPURayCastUserShader for an example of how to override shader code in the volume mapper. The blending is done using the VTK::Shading::Impl tag.