Merge colored images and show them as 1 volume

(Katharina Abrar) #1

Hello everyone,
is there a way to merge multiple colored png images into one volume and visualize this than in the 3D space?

I really need this feature since in these images, the colors are really important and I can´t segment pixel by pixel…

I would be very pleased if somebody could give me some advice to this topic!

Thank you for your understandings!

Greetings,
Anna

0 Likes

(Andras Lasso) #2

This should help: https://www.slicer.org/wiki/Documentation/Nightly/FAQ#How_to_load_data_from_a_sequence_of_jpg.2C_tif.2C_or_png_files.3F

0 Likes

(Katharina Abrar) #3

Thank you Sir for the fast reply!

Is there a way to retain the colors of the images? When I create a scalar volume it automatically creates a grey 3D volume. I really need the colored volume out of theses images like there are in there

… Is there a solution for my problem?

Thanks in advance!

0 Likes

(Andras Lasso) #4

If you just want to visualize them with their original color, apply spatial transforms, etc. then you don’t need to convert to scalar volume. What would you like to do with the image?

0 Likes

(Katharina Abrar) #5

I just showed the view of one image. I would like to visualize the colored image stack in their original color in the 3D space (View 1). Since the pixels of the image stack are colored differently, I can´t segment pixel by pixel. It is also not possible to use the vector to scalar volume, since it is creating a Grey-colored 3D volume, where the original color is lost.

I hope that the issue is now understandable.
Is there a way to solve this?

Thank you very much for all help!

0 Likes

(Andras Lasso) #6

If you have a full-color image then you can show a direct volume rendering of it by turning off “independent component” option in the volume renderer (it makes image components interpreted as RGBA). Type this in the Python console after enabling volume rendering:

getNode('VolumeProperty').GetVolumeProperty().SetIndependentComponents(0)

Note that you need an RGBA image (not just RGB). The fourth (alpha) component controls opacity. If you only have an RGB image then you can create the “alpha” volume using “Vector to scalar volume” module, then append this alpha volume to the original RGB volume by copy-pasting this to the Python console:

colorVolume = getNode('MyColorVolume') # RGB vector volume
alphaVolume = getNode('MyAlphaVolume') # scalar volume created from RGB volume using Vector to scalar volume module

append=vtk.vtkImageAppendComponents()
append.AddInputConnection(colorVolume.GetImageDataConnection())
append.AddInputConnection(alphaVolume.GetImageDataConnection())
append.Update()
colorVolume.SetAndObserveImageData(append.GetOutput())

For segmentation (if you want to create a surface mesh, 3D-printable model, etc), use the scalar volume created by “Vector to scalar volume” module.

0 Likes