# How to decouple segmentations from model and hide the segmentations slice views?

**URL:** <https://discourse.slicer.org/t/how-to-decouple-segmentations-from-model-and-hide-the-segmentations-slice-views/19786>\
**Category:** Support\
**Created:** [September 21, 2021, 2:32pm UTC](https://discourse.slicer.org/t/how-to-decouple-segmentations-from-model-and-hide-the-segmentations-slice-views/19786 "2021-09-21T14:32:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srivastavava](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@srivastavava](https://discourse.slicer.org/u/srivastavava)\
**Post date:** [September 21, 2021, 2:32pm UTC](https://discourse.slicer.org/t/how-to-decouple-segmentations-from-model-and-hide-the-segmentations-slice-views/19786/1 "2021-09-21T14:32:24Z")

</div>

```auto
import slicer 
import qt 
fname = qt.QFileDialog.getOpenFileName()
loadedVolumeNode = slicer.util.loadVolume(fname)
segfname = qt.QFileDialog.getOpenFileName()
segmentationNode = slicer.util.loadSegmentation(segfname)
labelmapNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLLabelMapVolumeNode')
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode, labelmapNode, loadedVolumeNode)
parameters = {}
parameters["InputVolume"] = segmentationNode
parameters["Decimate"] = 0
parameters["JointSmoothing"] = False
parameters["SplitNormals"] = False
parameters["PointNormals"] = True
parameters["Pad"] = True
outputH = slicer.vtkMRMLModelHierarchyNode()
outputH.SetScene(slicer.mrmlScene)
outputH.SetName("3D Models")
slicer.mrmlScene.AddNode(outputH)
parameters["ModelSceneFile"] = outputH
parameters["Filter Type"] = 'Laplacian'
parameters["Smooth"] = 15
modelMaker = slicer.modules.modelmaker
slicer.cli.runSync(modelMaker, None, parameters)
ras2lps = vtk.vtkMatrix4x4()
ras2lps.SetElement(0,0,-1)
ras2lps.SetElement(1,1,-1)
ras2lpsTransform = vtk.vtkTransform()
ras2lpsTransform.SetMatrix(ras2lps)
# This is to try 
slicer.util.setSliceViewerLayers(background=loadedVolumeNode)
segmentationNode.setSliceViewerLayers(0)

```

When I set the segmentationNode.setSliceViewerLayers(0), the 3D model created using the above mentioned script also gets hidden. How can I decouple the 3D model and the segmentations. I would just like to visualize the MRI volumes and the 3D models.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/5/b5b508bc2ed08655fd32002fd415eb0f6f13bfe4.jpeg)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/5/c52f62c80d092726b1398c47c5cfa55b222bc53a.jpeg)

---

<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:** [September 21, 2021, 5:51pm UTC](https://discourse.slicer.org/t/how-to-decouple-segmentations-from-model-and-hide-the-segmentations-slice-views/19786/2 "2021-09-21T17:51:05Z")

</div>

You can control visibility of segmentations by adjusting properties in the [segmentation display node](http://apidocs.slicer.org/master/classvtkMRMLSegmentationDisplayNode.html). You can hide the segmentation in slice views like this:

```python
segmentationNode.GetDisplayNode().SetVisibility2D(False)

```
