# Clear unused view nodes

**URL:** <https://discourse.slicer.org/t/clear-unused-view-nodes/9905>\
**Category:** Development\
**Created:** [January 22, 2020, 3:42pm UTC](https://discourse.slicer.org/t/clear-unused-view-nodes/9905 "2020-01-22T15:42:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rprueckl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rprueckl/32/4240_2.png) [@rprueckl](https://discourse.slicer.org/u/rprueckl)\
**Post date:** [January 22, 2020, 3:42pm UTC](https://discourse.slicer.org/t/clear-unused-view-nodes/9905/1 "2020-01-22T15:42:02Z")

</div>

Hi,

I use custom layouts. I want to clear the scene from unused viewers (vtkMRMLSliceNode and vtkMRMLViewNode) (and the nodes that are associated to them (as far as i have seen: a vtkMRMLSliceCompositeNode, a vtkMRMLModelDisplayNode, vtkMRMLLinearTransformNode, and a vtkMRMLModelNode in case of a vtkMRMLSliceNode and a vtkMRMLCameraNode in case of a vtkMRMLViewNode)).  
How would I do that? Is there a way do detect ‘unused’ view nodes? Best would be to initially prevent the scene/application from generating the default views.  
Any hint is appreciated. Thanks

---

<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:** [January 22, 2020, 3:53pm UTC](https://discourse.slicer.org/t/clear-unused-view-nodes/9905/2 "2020-01-22T15:53:57Z")

</div>

You can use MappedInLayout attribute name, which is set to 0 for views that are not mapped in current layout.
