# Code for hiding the label of markups

**URL:** https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997
**Category:** Support
**Tags:** markups-fiducials, markups
**Created:** [January 1, 2023, 5:15am UTC](https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997 "2023-01-01T05:15:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![WilliamLambert1205](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/williamlambert1205/32/16334_2.png) [@WilliamLambert1205](https://discourse.slicer.org/u/WilliamLambert1205)
#### Post date: [January 1, 2023, 5:15am UTC](https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997/1 "2023-01-01T05:15:42Z")

</div>

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?  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/d/6d7d0184edbc32405d2116c074906b8f60f2cc16.png)

---

<div class="post-metadata">

### Author: ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)
#### Post date: [January 1, 2023, 1:50pm UTC](https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997/2 "2023-01-01T13:50:12Z")

</div>

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](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.

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#change-markup-point-list-display-properties](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#change-markup-point-list-display-properties)

---

<div class="post-metadata">

### Author: ![WilliamLambert1205](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/williamlambert1205/32/16334_2.png) [@WilliamLambert1205](https://discourse.slicer.org/u/WilliamLambert1205)
#### Post date: [January 1, 2023, 4:24pm UTC](https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997/3 "2023-01-01T16:24:24Z")

</div>

thank you!  
I still wonder how to set Text size to 0 programmatically instead of through the GUI  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/8/c8442985b06fd6168c357f82dbc173647c855f47.png)

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

---

<div class="post-metadata">

### Author: ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)
#### Post date: [January 1, 2023, 4:43pm UTC](https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997/4 "2023-01-01T16:43:17Z")

</div>

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.

[https://apidocs.slicer.org/main/classvtkMRMLMarkupsDisplayNode.html#ae2d3e600b3cd90e325a4a353e3fb9c2a](https://apidocs.slicer.org/main/classvtkMRMLMarkupsDisplayNode.html#ae2d3e600b3cd90e325a4a353e3fb9c2a)

---

<div class="post-metadata">

### Author: ![WilliamLambert1205](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/williamlambert1205/32/16334_2.png) [@WilliamLambert1205](https://discourse.slicer.org/u/WilliamLambert1205)
#### Post date: [January 2, 2023, 11:01am UTC](https://discourse.slicer.org/t/code-for-hiding-the-label-of-markups/26997/5 "2023-01-02T11:01:17Z")

</div>

thank you!  
Problem solved, code below.  
pointListNode = getNode(“F”)  
pointListDisplayNode = pointListNode.GetDisplayNode()  
pointListDisplayNode.SetTextScale(0)
