# How to move name and measure in vtkMRMLAnnotationRulerNode

**URL:** <https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850>\
**Category:** Development\
**Created:** [August 9, 2017, 8:44pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850 "2017-08-09T20:44:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![PNardelli](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@PNardelli](https://discourse.slicer.org/u/PNardelli)\
**Post date:** [August 9, 2017, 8:44pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/1 "2017-08-09T20:44:17Z")

</div>

Hi guys,

I have created a new scripted module that uses two rulers to do measure airways and veins on a CT image.

I know the rulers’ name and measure are automatically placed next to the Ruler. However, many times these are on the way and make the measure difficult.

Do you know a way to make them selectable (I don’t see any appropriate function in the three display nodes of the rulers), so that they can be moved away when needed?

Thanks a lot,  
Pietro

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 9, 2017, 8:48pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/2 "2017-08-09T20:48:59Z")

</div>

Hi Pietro,

It is not possible to directly move the text around. That said, as illustrated below, you could change the visibility, opacity or scale of the text.

 ![annotations-edit](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/4/44ce918753a1e4206798a384b09d6467ea6d6d2a.jpeg)

---

<div class="post-metadata">

**Author:** ![PNardelli](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@PNardelli](https://discourse.slicer.org/u/PNardelli)\
**Post date:** [August 9, 2017, 8:58pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/3 "2017-08-09T20:58:14Z")

</div>

Hi JC,

thanks for your reply! OK, I see. And there is a way in python to at least remove the measure and just leave the name next to the ruler? Setting opacity to 0 removes both name and measure, but I need the name next to the ruler.

Thanks a lot,  
Pietro

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 9, 2017, 9:10pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/4 "2017-08-09T21:10:12Z")

</div>

> [@PNardelli](#):
>
> remove the measure and just leave the name

Do you mean displaying only `41.7mm` instead of `M: 41.7mm` ?

---

<div class="post-metadata">

**Author:** ![PNardelli](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@PNardelli](https://discourse.slicer.org/u/PNardelli)\
**Post date:** [August 9, 2017, 9:14pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/5 "2017-08-09T21:14:11Z")

</div>

Nope, the other way around, displaying only M instead of M: 41.7mm.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 9, 2017, 9:33pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/6 "2017-08-09T21:33:54Z")

</div>

It is not currently possible to selectively display one or the other.

The code responsible for formatting the “name: value” string can be found here:

> <https://github.com/Slicer/Slicer/blob/2b815fafd3c730c189cc8b39bf453c669cab0c05/Modules/Loadable/Annotations/MRMLDM/vtkMRMLAnnotationRulerDisplayableManager.cxx#L657-L688>

and here:

> <https://github.com/Slicer/Slicer/blob/2b815fafd3c730c189cc8b39bf453c669cab0c05/Modules/Loadable/Annotations/VTKWidgets/vtkAnnotationRulerRepresentation3D.cxx#L85-L88>

To achieve you describe, the annotation would have to be updated.

---

<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:** [August 9, 2017, 9:50pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/7 "2017-08-09T21:50:35Z")

</div>

We had a similar need in SlicerIGT extension’s BreachWarning module. We ended up creating a string with custom content and set it as node name. If this does not work for you then submit a feature request at [https://issues.slicer.org/](https://issues.slicer.org/) .

---

<div class="post-metadata">

**Author:** ![Nicole\_Aucoin](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@Nicole\_Aucoin](https://discourse.slicer.org/u/Nicole_Aucoin)\
**Post date:** [August 10, 2017, 8:48pm UTC](https://discourse.slicer.org/t/how-to-move-name-and-measure-in-vtkmrmlannotationrulernode/850/8 "2017-08-10T20:48:02Z")

</div>

In the Modify Annotation properties pop up for the ruler, under Advanced,  
Lines, you can move the position of the text along the ruler, from 0 at one  
point to 1 at the other end point. From python:  
displayNode = ruler.GetDisplayNode()  
print displayNode.GetLabelPosition()  
displayNode.SetLabelPosition(0.8)  
So you’d have to set up a slider similar to the Label Position slider in  
your module if you wanted to have a GUI interface to it.

The label format got over written when the Units code was integrated, the  
ruler.Get/SetDistanceAnnotationFormat calls are there but the settings are  
ignored by the annotation ruler displayable manager in GetLabelFormat.

Nicole
