# Automatization of cursor visibility

**URL:** <https://discourse.slicer.org/t/automatization-of-cursor-visibility/21848>\
**Category:** Development\
**Tags:** python\
**Created:** [February 8, 2022, 8:59am UTC](https://discourse.slicer.org/t/automatization-of-cursor-visibility/21848 "2022-02-08T08:59:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bserrano](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bserrano/32/17034_2.png) [@bserrano](https://discourse.slicer.org/u/bserrano)\
**Post date:** [February 8, 2022, 8:59am UTC](https://discourse.slicer.org/t/automatization-of-cursor-visibility/21848/1 "2022-02-08T08:59:34Z")

</div>

Hi,

I want to set the cursor visibility of a centerline automatically. It can be done in module Models → select cursor → Display → Slice Display → Visibility.  
I tryied to write a code that does it automatically but I cannot find the functions that do that.  
I am suck after setting the cursor node:

```auto
slicer.util.selectModule('Models')
cursorNode = slicer.util.getNode("Cursor-Centerline curve (0)")
slicer.modules.models.widgetRepresentation().setEditedNode(cursorNode)

```

 ![imagen](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/2/027cd46873f665a321aab9716de1074fbec0e3c0.png)

Thanks,

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [February 8, 2022, 7:36pm UTC](https://discourse.slicer.org/t/automatization-of-cursor-visibility/21848/2 "2022-02-08T19:36:05Z")

</div>

This centerline is a ModelNode, and its display properties are controlled through an associated display node.

```auto
centerlineModelNode = slicer.util.getNode("Cursor-Centerline curve (0)")
centerlineDisplayNode = centerlineModelNode.GetDisplayNode()
centerlineDisplayNode.SetVisibility(1) # make sure the model is visible overall (if this was 0, then the separate 2D and 3D settings would have no effect) 
centerlineDisplayNode.SetVisibility2D(1) # show model in 2D slice views
centerlineDisplayNode.SetSliceIntersectionVisibility(1) 
# Other display settings are also available, e.g.
centerlineDisplayNode.SetSliceIntersectionThickness(10) # change intersection line thickness

```

---

<div class="post-metadata">

**Author:** ![bserrano](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bserrano/32/17034_2.png) [@bserrano](https://discourse.slicer.org/u/bserrano)\
**Post date:** [February 10, 2022, 4:29pm UTC](https://discourse.slicer.org/t/automatization-of-cursor-visibility/21848/3 "2022-02-10T16:29:02Z")

</div>

Thank you so much.  
This was exactly what I was looking for 🙂
