RGB or RGBA rendering of single 2D image in 3D not working

Hi!

For a complex registration situation, I need to position a 2D tissue image in the 3D viewer. The problem is that the picture won’t show correctly either as a slice view or as a volume rendering. Initially, after loading, the picture shows correctly in the 2D red slice viewer, however.

I used the nifty little code snippet by @lassoan in Retain Image Color in Volume Rendering - #10 by lassoan after loading the sample picture below.

The problem is two-fold: the coloring changes in the 2D viewer and only a gray surface in shown in 3D. When using a different png with an existing alpha channel (picture shows up in the volume panel as a vector image of dimension 4), I don’t add the alpha, but the picture still shows up grey in 3D. (In any case, the Slice view of the red viewer in 3D serves up a red surface. But that’s not the main problem.)

road runner

image

Probably a stupid mistake on my part? This is in Slicer 4.13.0-2021-03-18 – same problem in 4.11 release.

3-component RGB images appear correctly in slice views and the slices can be displayed in 3D view, too.

4-component RGBA images are required for color volume rendering but RGBA volumes, but slice views of such volumes cannot be displayed in 3D view - see this issue. If you want this to be fixed then add a vote for it. If an issue gets many quotes (or needed for a funded project) then we can allocate developers to fix it. If you need it sooner and you are comfortable with C++ and the VTK library then then you can give it a go and fix it (we can help if you decide to try it). You can also submit a feature request for volume rendering to support RGB volumes (without the need for manually extending it to RGBA).

Thanks, I’m unstuck now! Your answer in Transform: scale - #6 by timeanddoctor is useful, too for folks in a similar situation, just remember to remove the alpha channel before loading the picture (I used gimp). Then register by moving the 3D volume. The picture allows one rotation and three translational degrees of freedom. Another hack I guess would be to let a reformat widget track the picture if it’s subjected to all 6 degrees of freedom, but your suggestion will do for now!

Also you taught me how to vote for a github issue – that somehow had eluded me until now.

There is a module for this already: Volume reslice driver module (in SlicerIGT extension).