How to display the blended colors in the view of 'volume rendering'?

I am using the ‘volume rendering’ module of Slicer to visualize the image data of a cell composed of red and green channels.
The rendering method I chose is: ‘VTK GPU Ray Casting’
However, as shown in Figure 1, the intersection of the red channel and the green channel in the view window cannot be displayed as a blended yellow.

But it seems that only when I turn on the ‘display clipping box’ under the ‘ROI’ tab, the blended color can be displayed. As shown in Figure 2, the intersection of the red channel and the green channel is displayed in yellow.

At the same time, however, even in the view window in the desktop mode, the blended color can be displayed(as shown above), but the blended color is still can not be displayed in the 3D view created in the VR mode(SlicerVirtualReality). As shown in Figure 3.

On the other hand, when I change the rendering method to ‘VTK Multi-Volume’, no matter whether I turn on the ‘display clipping box’ or not, the blended colors will not be displayed.

Therefore, in a situation similar to the above, how to display the blended colors of different color channels in the view of ‘volume rendering’(both in desktop mode and the VR mode) correctly?

Appreciate any help! Thank you so much in advance!

Therefore, in a situation similar to the above, how to display the blended colors of different color channels in the view of ‘volume rendering’(both in desktop mode and the VR mode) correctly?

@lassoan Hello Dr. Andras Lasso, Could you please give me some suggestions on the above issues?
Thank you so much!

If these are two independent image acquisitions then I would recommend to render them as separate volumes: extract each component using “Vector to scalar volume” module, using “Single component extraction” conversion method; then render each volume separately. Make sure to choose “VTK multi-volume” rendering (otherwise one volume will be always in front of another volume, instead of being blended in 3D).

Hello Dr. Andras Lasso,
Thank you so much for your reply!

If these are two independent image acquisitions

Yes, the red and green channels shown in the figures above are two independent 16-bit TIFF images(named ‘cell-new-red.tif’ and ‘cell-new-green.tif’), as shown in Figure1 and 2(I got them from FIJI).

After I followed the method you suggested, in the view of ‘Volume rendering’, the blended colors of the two channels still cannot be displayed.

I’m not sure if the steps I performed are correct, could you please check them? if there are errors, please point out:

  1. First, according to your guide, in order to get the ‘Input vector volume’, I used FIJI to convert the image type of these two TIFF images from 16 bit to RGB color type, since from the 'Documentation/4.10/Modules/VectorToScalarVolume ’ I learned that:

The “Vector to scalar volume” module is useful for converting RGB (vector) volumes to one component (scalar) grayscale volumes.

  1. I saved the converted red and green channel images (both are RGB colors) as: ‘cell-new-red-RGB.tif’ and ‘cell-new-red-RGB.tif’

  2. In the ‘Vector to scalar volume’ module, I used the two files obtained from the 2nd step as ‘Input Vector Volume’, set the ‘Output Scalar Volume’ to ‘Scalar Volume RED’ and ‘Scalar Volume GREEN’, and I chose the ‘Single component extraction’ method as you said. As shown in Figure 3 and Figure 4 below.
    Scalar Volume RED
    Scalar Volume GREEN

  3. In the ‘Volume rendering’ module, I loaded the ‘Scalar Volume RED’ and ‘Scalar Volume GREEN’ obtained from the 3rd step into the view (I open both eye icons in front of the ‘Volume’, and loaded them into the view), and set the rendering method to ‘VTK Multi-Volume’, as shown in Figure 5 and Figure 6 below.

As you can see, after performing the above steps, the blended colors of the two channels still cannot be displayed in the view.

Could you please point out which step is incorrect or what should I do?

Thank you very much!

What Slicer displays looks correct. This is a 3D rendering, therefore if you have a piece of red blob in front of a green blob, you will only see the red blob if you make Scalar Opacity Mapping function ramp up to 1.0. Even if you make the opacity plateau at a lower level (e.g., 0.3), whatever is in front will have larger influence on the color.

Another thing that you may not expect that when you render multiple volumes independently then the colors are combined using additive averaging (similar to a spinning colorwheel - brightness of colors are not added), and not using additive averaging (like in fluorescent imaging when you sum the intensities of multiple light beams).

As a result, you will not see bright yellow if you use multi-volume rendering (1. the yellow may be occluded, 2. if you crop the images to make the mixed yellow visible, that the yellow will be relatively dark).

If you want to see bright yellows then the best is to display the image as an RGBA stack. You can enable direct RGBA volume rendering as described here: Merge colored images and show them as 1 volume - #6 by lassoan.

If you only have RGB channels then you can generate an A (alpha = opacity) channel by averaging the RGB channels and generate an RGBA image by appending this A channel to the RGB image.

Thank you for your kind and patient reply!
I will try the method you mentioned.
Thank you so much! :+1:

I’ve made an improvement in Slicer core that makes it much simpler to render color volumes. You don’t need any Python scripting anymore, you can simply load a color volume (with RGB or RGBA voxels) and enable volume rendering. Alpha channel is computed automatically as needed; independent components in the volume rendering properties is enabled/disabled automatically. This improvement will be available in the latest Slicer Preview Release that you download tomorrow or later.

1 Like

Hello Dr.Andras Lasso,
Thank you very much for your reminder, I will try the latest version to verify it :+1:

Dear Dr. Andras Lasso,

Many thanks for your great assistance in this topic!
I have a similar issue, where I want to display two separately acquired volumes, and display them on top of each other in order to identify overlapping points.
Preferably I would do this with a true RGB representation (where the blue channel is empty, so only red and green, with overlapping voxels as shades of yellow)

I have tried several approaches:

  • importing the two separate volumes and then visualising them in the volume renderer with VTK multi-volume. This does sort of indentifies the overlapping voxels, however the volume(s) itself becomes increasingly transparent and sometimes displays some strange mirroring/echoing effect. In other words, the volume is not really representative of the sample any more.
  • importing the volumes directly as a RGB volume. This gives me clear success in the slice windows, however in the volume renderer view the volume is invisible (even after activating its visibility). When selecting VTK GPU raycasting in this case does display something that looks like a volume, but it appears monocolored and as such also does not provide the info I’m looking for.

Do you perhaps have any suggestions on how I could better obtain the volume renders of the two separate volumes, and the mixing/overlapping thereof? It would be of paramount importance! I’ve looked at different volume rendering softwares as well, but never have I come so close to an actual good result as with Slicer…

Many thanks in advance for your great help!

In recent Slicer Preview Releases, RGB volume rendering is set up automatically - you just need to drag-and-drop the volume from the Data module to a 3D view and the full color image should be visible. However, the experimental multi-volume renderer has a number of limitations, so it may not be able to display RGB volumes.

Are your images acquired as RGB or you just apply a lookup table to the scalar values to make them colorful?

  • If lookup table is used:, then you can apply that color table in Slicer and use multi-volume rendering.
  • If you actually acquired 3D RGB volumes (e.g., by cryosectioning): then you can merge them into a single volume (resample them using the same grid using Crop volumes module, and then blend them into a single volume using numpy)

So the method I followed for the true RGB is indeed the second one you mention: I added the volumes into a single RGB volume using numpy, and then saved them as a tif file (using the python tifffile.imwrite functionality). Loading this in Slicer gives this:

As you see… a whole lot a bright yellow. Which surprises me, as if you look at the slice panels, the slices don’t show that much yellow. I understand this may be a projection thing, where the yellow voxels are simply ‘blocking’ the view of the other voxels? If so, is there a way to make them partly transparent?
Not that this is using the GPU ray casting. If I toggle to the multi-volume the 3D rendering simply disappears (completely invisible :person_shrugging: ).

If I on the other hand just load the volumes separately I have this with GPU ray casting:

and this when switching on the multi-volume:

I think it is clear that the multivolume didn’t quite give the result I was hoping for :smiley:
So if you have further suggestions/hints that would be great… I’m quite at a loss here. But then again, perhaps I’m just asking ‘too much’ in the sense that what I eventually want to see is perhaps not readily visible in any 3D rendered volume. Perhaps a better approach would be to actually group (with PCA or similar) the voxels based on their respective intensities of the red and green channel, and then display the cluster ids? Something to think on :thinking:

I this all looks very promising. You have multiple options to make this work and they just need a little tuning.

Is your acquisition true RGB or you just acquire a scalar volume and apply a lookup table to make it colordul?

My acquisition is indeed a scalar volume (or indeed 2 volumes) to which I applied a lookup table (being the RGB colourisation) to make it colourful.

In that case it is very easy: you can load the volumes separately and use “VTK multi-volume” renderer. You can adjust the opacity transfer function to make parts of the volume more or less transparent. You can set your lookup table in the color transfer function.

I was hoping for the same, but unfortunately changing the opacity doesn’t change much :frowning: Perhaps I’m changing some wrong opacity somewhere?
In each attempt I get something similar to the last image in my message from 2 days ago. It appears as if the multi-volume rendering in this case wrongfully adds certain voxels to average to zero, even though there should be signal present… Maybe because the surrounding voxels do contain (noise) data that I made invisible using the Volume Threshold values?

Can you share a data set (the one with scalar values, not RGB) so that I can have a look? You can upload it to dropbox, onedrive, etc. and post the link here.

Hi Andras, I’m unfortunately not comfortable to share a link to the dataset online :frowning: I tried to send you a mail a few days ago, but perhaps I sent it to wrong address. Can you think of a secure way I could send you alone a link? I see no private messaging option on this forum :frowning:

You can send a private message by clicking on the user’s photo/icon and clicking the “Message” button.

Yeah, that doesn’t show up anywhere :frowning:

Perhaps I’m too new to have the rights to do it or something?

I see, sorry about that; the button shows for me. I would guess it’s an anti-spam feature that it takes some time or activity to get that right.