image pixel values and background for 3d rendering

Hi, I am new to VTK.

I have a question about how the pixel value works in 3d rendering.

what I’m trying to do is segment the ROI region of stacked 2d image and 3d volume render the ROIs.

If the pixel value is 0, does the VTK consider it as background?

I just need the ROI region to be rendered. not the background region.

To hide the “background”, set your scalar opacity transfer function’s value to 0 at the intensity.

However, the main challenge in rendering segmentations (multiple ROIs) from 3d labelmap volumes is that you need to have smooth edges if you want to be able to recognize shapes.

If you just volume render a labelmap volume with nearest neighbor interpolation then the rendering is very blocky, does not look nice and shape is not easily visible:

If you use linear interpolation then the surface is smooth but you get edge artifacts (at the boundary of each ROI, color of all the other ROI will appear that has lower voxel value):

The traditional solution is to render segmentations as surface mesh (extract surface using flying edges filter then apply windowed sinc smoothing to remove staircase artifacts). This is what we currently use in 3D Slicer:

Recently we’ve made multivolume rendering capable of rendering with shading, so now it is possible to use a separate volume renderer for each segment, and so there are no more edge artifacts:

This rendering method is useful because for complex segmentations, surface extraction and smoothing may take several seconds, while volume rendering is instantaneous. However, it need more memory, makes segmentation rendering very GPU-intensive, and when a segment changes it may still be necessary to apply Gaussian smoothing to remove staircase artifacts. So, most likely multi-volume rendering will not replace surface rendering in all use cases.

Hi lasso , I have some questions about the vtkMultiVolume. as far as know, vtkMultiVolume dose not support shadingOn , I wonder if this problem will be fixed in the future,Could you tell me something about it? Thank you very much

I’m sorry ,I did not see that you said “Recently we’ve made multivolume rendering capable of rendering with shading…”
Could I get the code which capable of rendering with shading on GitHub? Is it commited to the master branch ?

Multi-volume rendering with shading has been available for several months ago and included in latest 3D Slicer Stable version. The class that sets up actors and mappers is available here, but probably VTK’s multivolume renderer tests and examples are easier starting points if you want to add multi-volume rendering to your application.

thanks you for your answer,by the way .
how many volumes can I put it into multivolume ? I mean ,the maximun number volumes MultiVolume support

I don’t think there is any limit imposed by VTK. You can display as many and as large volumes as your GPU can handle.

I’ve just tried this in 3D Slicer on a desktop with NVidia GPU. Rendering of 50 head MRI volumes (256x256x130 voxels) works well using multi-volume rendering, at about 20fps.

I think you are right , it depends on Hardware.
My computer can put 7 volumes ,when I put 8 volumes ,the vtk error dialog will show up.
It shows
failed at glBindTexture 1 opengl errors detected…
… hardware dose not support the number of textures defined .

And it seems that the maximun doesn’t matter the size of the image, I used down-sampling image, it sill only 7 volumes.

Well, 7 volumes is enough for me . My gpu is Nvidia Quadro Rtx 4000, 7 is strange number ,i thought it would be 4 or 8 or 16 or 32…