Visualization of the background and foreground image together

Is there a way to view background and foreground images both at full opacity in one view?


If foreground is at full opacity then it will obscure everything underneath. The only way to see them on equal opacity is at 50-50.

Is your problem that it becomes darker that way? You can change the blending mode:

Thank you Csaba,
Here are my two images, I don’t think i have the obscuring problem as you stated. The images are from IXI public dataset


My red image is kind of edges of the green image, and when I put the opacity at 50-50 the green image becomes dark.

I tried making a model from my red image and view the cross section of it on the green image but not quite exactly what I’m looking for.

I played with blending mode, and I think “ADD” option address my question to some extent

thank you

It’s not a problem, it is the way things are. Whatever you have in the background if you show the foreground at full opacity, the only thing you’ll see will be the foreground.

You can also play with the threshold function on the Volumes module. If you set the threshold so that the low values (the blackish regions) are not visible than that 50% black won’t darken the background.


Grayscale images are alpha-blended, you see the average of two volumes, which means a darker image will darken the rendered output (unless you choose “Add” compositing option). Labelmap images are rendered as an opaque or semi-transparent overlay and so “background” region will not affect the rendered output.

Make sure you to click “labelmap” in the “Add data” window when you load labelmap/binary image (or if you already loaded as scalar volume, convert it to labelmap in Volumes module / Volume information section).


Thanks a lot for the tip @lassoan!

I didn’t know about the “labelmap” tick when loading data.

Quick question: when should we then use Background + Foregroung and when should we instead use Background + Labelmap?

Also, small suggestion: wouldn’t it be possible to enlarge the “Add data into the scene” window, maybe with the “Show Options” tick automatically ticked, so that one also sees the different loading modalities? For instance, I had never seen the “labelmap” tick just because the window was small.

Of course it’s just a suggestion and you probably set it this way for other good reasons :slight_smile:

Also, two more (probably trivial) questions:

  1. how can I change the color of the LabelMap?

  2. which is the quickest way to find in the corresponding part of the “Add data into the scene” window? I was curious to see how you implemented that.

Thank you very much again!

1 - you can change the color map using the Volumes module

2 - the code is big and complicated, but one way to find your way around is to use the search feature of github to look for a term from the UI. So if you search for “Add data into” you find that class qSlicerDataDialog and you can look at the corresponding code.

Hi, I have a related question. I want to overlay US images onto MRI images. The problem is that the empty (black) part of the US images obscures the MRI image. It looks like this:

Is there a way to deal with this issue? For example by making black foreground pixels transparent?

(I know I can choose ‘Add’ as the blending option, but this is not what I’m trying to achieve as it changes the appearance of the foreground)

Thanks for your help in advance

Using the Volumes module, set the lower threshold value to 1 for your volume. Then all the 0 black pixels will be removed from the overlay display.


For MRI/US fusion it is also common to change the color map of the US to green. You can choose the color map in Volumes module.

1 Like