Hi. I want to create a new scene and set it up as principal scene that is because I want to populate a combobox with a list of models (the default scene has some models that I don’t want on the combobox)
This code creates a scene:
self.myscene = slicer.vtkMRMLScene()
but I don’t know how to select it, something like this:
slicer.utils.setMRMLScene(self.myscene)
Now load the list of models to myscene:
for mypath in listOfModelPaths:
#add model to myscene
newModel = slicer.modules.models.logic().AddModel(mypath)
There is just one scene that the application knows about. You can create a new scene object but it will not contain any of your nodes (a node can only be in one scene).
Yes Andras. Thank you for the help. I had found that function in the documentation but I didn’t understand how to use it with vtkMRMLModelNode. I don’t know with what to replace “Category” and “Discrete”. I would like to show only some models I select. For example: show only models that start with “MyModelType1” and “MyModelType2”
So in this list:
MyModelType1D is shown
MyModelType1G is shown
MyModelType2H is shown
MyModelType2J is shown
MyModelType3R isn’t shown
MyModelType3Y isn’t shown