Automatization of cursor visibility

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:

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

imagen

Thanks,

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

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
1 Like

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

1 Like