# Set up different scene for Slicer

**URL:** https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605
**Category:** Development
**Created:** [November 14, 2020, 8:34pm UTC](https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605 "2020-11-14T20:34:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [November 14, 2020, 8:34pm UTC](https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605/1 "2020-11-14T20:34:10Z")

</div>

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:

```auto
self.myscene = slicer.vtkMRMLScene()

```

but I don’t know how to select it, something like this:

```auto
slicer.utils.setMRMLScene(self.myscene)

```

Now load the list of models to myscene:

```auto
for mypath in listOfModelPaths:
    #add model to myscene
    newModel = slicer.modules.models.logic().AddModel(mypath)

```

Here I create and populate the combobox

```auto
self.inputComboBox = slicer.qMRMLNodeComboBox()
self.inputComboBox.nodeTypes = ['vtkMRMLModelNode']
self.inputComboBox.setMRMLScene(self.myscene)
self.__layout.addWidget(self.inputComboBox)

```

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [November 16, 2020, 10:58pm UTC](https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605/2 "2020-11-16T22:58:15Z")

</div>

@lassoan Could you help with this?

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [November 16, 2020, 11:15pm UTC](https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605/3 "2020-11-16T23:15:48Z")

</div>

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).

If you want to show only certain models then you can add a custom attribute to your nodes and use that for filtering - see [http://apidocs.slicer.org/master/classqMRMLNodeComboBox.html#a056b54be78c6053b6fd21d51b2b1d045](http://apidocs.slicer.org/master/classqMRMLNodeComboBox.html#a056b54be78c6053b6fd21d51b2b1d045)

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)
#### Post date: [November 16, 2020, 11:22pm UTC](https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605/4 "2020-11-16T23:22:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)
#### Post date: [November 17, 2020, 12:13am UTC](https://discourse.slicer.org/t/set-up-different-scene-for-slicer/14605/5 "2020-11-17T00:13:25Z")

</div>

You can choose any text as attribute name and you can filter for value or presence of that attribute. For example:

```python
someNode.SetAttribute('MySpecialNodeCategory', '1')
comboBox.addAttribute('vtkMRMLModelNode', 'MySpecialNodeCategory', '1')

```
