Retaining the color of the 2d image used for Volume Rendering.

Hello Everyone:

I am very new to volume rendering, and I was able to render a 3d Volume using stack of 2D images in png format. The resultant 3dVolume is in grey scale, but I want the color of the volume to be same as the image. How should I be able to acheive it? Any help or guidance is appreciated.

Welcome to VTK, @Saptarshi_Paul!

In your mapper (vtkVolumeMapper?), invoke SetColorModeToDirectScalars(). That should avoid the mapping through the gray scale color map.

Hello Cory,

Thank you so much for your help. I am using
volumeMapper = vtk.vtkOpenGLGPUVolumeRayCastMapper(), so how will I be able to invoke SetColorModeToDirectScalars(). I will really appreciate if you can guide me through.

Best Regards

For volume rendering, you can use vtkVolumeProperty::SetIndependentComponents().

Hello Andras,

I hope you are doing well. I have already set the SetIndependentComponents(). But it still produces the resultant 3dVolume in grey scale.

Probably you don’t have an alpha channel. See details in this topic: Colored Volume from Tiffstack/MultiImageTiff

Thank you so much Andras, it worked.
I really appreciate your help.

Best Regards

1 Like

Ah, sorry. I remembered the class hierarchy incorrectly.

Thank you Cory, I really appreciate your help.

Best Regards