Hi,every one,happy new year!
I have a question about how to hide the label of markups.
When I create a bunch of markuplines, it comes out very crowded, so is there any code to only hide the labels and keep the markups exist?
In the Markups module Display section there is an advanced option to toggle control point labels on/off. The Markups module also has a Display option for label size you could utilize.
https://slicer.readthedocs.io/en/latest/user_guide/modules/markups.html#display-section
To make this change programmatically instead of through the GUI, you can access the point list display node (see below) to access all of the various display options such as label visibility.
thank you!
I still wonder how to set Text size to 0 programmatically instead of through the GUI
But these code below
pointListNode = getNode(“F”)
pointListDisplayNode = pointListNode.GetDisplayNode()
pointListDisplayNode.SetVisibility(False) # Hide all points
pointListDisplayNode.SetVisibility(True) # Show all points
pointListDisplayNode.SetSelectedColor(1,1,0) # Set color to yellow
pointListDisplayNode.SetViewNodeIDs([“vtkMRMLSliceNodeRed”, “vtkMRMLViewNode1”]) # Only show in red slice view and first 3D view
sets both “F” point and label invisible
Text scale information can be retrieved and modified using TextScale and TextProperty of the display node. See the below link to the vtkMRMLMarkupsDisplayNode API information.
thank you!
Problem solved, code below.
pointListNode = getNode(“F”)
pointListDisplayNode = pointListNode.GetDisplayNode()
pointListDisplayNode.SetTextScale(0)