Ways to load nodes into Slicer scene WITHOUT displaying them immediately

Hi Developers,

I am wondering, if it’s possible to load nodes (volume, fiducial) into a Slicer scene without having them displayed immediately within the slice views.

I am asking this, because I want to load a bunch of data programmatically but I don’t want the slice views to flicker for each loaded volume.

Are there any properties that can be set on


There’s a flag on the SliceCompositeNode to turn this off on a per-slice view basis. It could be good to have some slicer.util or other place to turn them all on or off, but I don’t think that exists yet.

Background volume and FOV reset on volume loading has bothered me a couple of times, too. I’ve now added a new ‘show’ option (enabled by default) to the Add data dialog for volumes that can be unchecked if the user does not want the volume to be propagated to slice views. See pull request here: https://github.com/Slicer/Slicer/pull/800

Great! Thanks for adding this option Andras.

Thank you, that’s a great feature. I had asked something very similar to this post a couple of months ago. If I load a volume with ‘show’ set to False, how would I then display it in one (and only one) of the slice views?

You can use slicer.util.setSliceViewerLayers

1 Like

Hi Andras,
I am loading the model node and want it to be displayed automatically using scripting. I am loading it using python scripting. but I need to actually go to models and then click on it to display it but I need an automatic way.= thorugh scripting. how to? please suggest.

Thank you

If you want to load a volume without showing it, add show=False argument to slicer.util.loadVolume. See list of all options here.

loadNodeFromFile returnNode argument is deprecated. Loaded node is now returned directly if returnNode is not specified.

What does this mean I get this when runing the script for loading a modelnode

outputVolume = slicer.util.loadModel(filepath+"\simplification.ply",True)

Also please tell me how to change the 3d display representation of a modelnode in scripting. Example from surface to surface with edges

This means you don’t need to specify returnNode=True anymore. If you don’t specify it then only one value, the volume node is returned. This is just a small change in the API to make the syntax simpler.

You can change it in the display node of the segmentation node.


By default outline is displayed, so if you don’t see it then it may be because it is occluded by some other content (for example, after you imported the segmentation from labelmap node, you did not hide or delete the labelmap node).

1 Like

Hi Andras,
I need to do the following with scripting.

On the left side in the REpresentation I am selecting surface with edges. I need to do it through scripting on the model surface. Any suggestions?

nn = n.GetModelDisplayNode()

I used the above it displays the edges. Is this true for every model either surface or volumetric mesh model.
is there any page online of scripting available for help?

Use this Documentation/Nightly/ScriptRepository - Slicer Wiki

1 Like

C++ API documentation is available here: https://apidocs.slicer.org/

For example, documentation of model display node: https://apidocs.slicer.org/master/classvtkMRMLModelDisplayNode.html