Model opacity change in single view

Hi

When the Slicer display is setup in the Triple 3D view, is it possible to change the opacity of a model only in 1 view while the model opacity remains the same in the other two views. I know it is possible to change whether the model is visible or not (using vtkMRMLViewNodes) but I wasn’t sure if you could change only the opacity of the model in a single view.

Thanks
Priya

On the user interface, only the first display node is shown. However, you can add any number of display nodes using the Python console. Turn off visibility for one view on the GUI (e.g., View3) and add a new display node with the desired view ID and display properties:

modelDisplayNode=slicer.mrmlScene.AddNewNodeByClass("vtkMRMLModelDisplayNode")
modelDisplayNode.SetViewNodeIDs([slicer.mrmlScene.GetFirstNodeByName("View3").GetID()])
modelDisplayNode.SetOpacity(0.5)
modelNode.AddAndObserveDisplayNodeID(modelDisplayNode.GetID())

Thanks Andras. With slight modifications, your suggestions worked well.

Thanks
Priya

1 Like

Hey,
I am trying to change the opacity of a 3D model within vtkMRMLModelDisplayNode (the 3D object viewer) View1

modelDisplayNode=slicer_model.GetDisplayNode() #vtkMRMLModelDisplayNode
modelDisplayNode.SetViewNodeIDs([slicer.mrmlScene.GetFirstNodeByName(“View1”).GetID()])
modelDisplayNode.SetOpacity(float(mat_color.find(‘a’).text))
slicer_model.AddAndObserveDisplayNodeID(modelDisplayNode.GetID())

however i don’t see change in the opacity, rather the color changes. in fact if i set SetOpacity(0) that is when the true color appears.

im basically trying to set this value for the model
image

If you need to display the same model differently in each view then you need to create a separate display node for each. Note that the models module GUI always shows/modifies the first display node only.

1 Like