# How to make the ruler longer like this picture

**URL:** <https://discourse.slicer.org/t/how-to-make-the-ruler-longer-like-this-picture/30635>\
**Category:** Support\
**Created:** [July 17, 2023, 7:58am UTC](https://discourse.slicer.org/t/how-to-make-the-ruler-longer-like-this-picture/30635 "2023-07-17T07:58:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)\
**Post date:** [July 17, 2023, 7:58am UTC](https://discourse.slicer.org/t/how-to-make-the-ruler-longer-like-this-picture/30635/1 "2023-07-17T07:58:24Z")

</div>

Any script will be helpful!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/7/9722c75e84c84fc247cf13bf0da77eb00ff9c5ac.jpeg)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 17, 2023, 2:45pm UTC](https://discourse.slicer.org/t/how-to-make-the-ruler-longer-like-this-picture/30635/2 "2023-07-17T14:45:31Z")

</div>

I don’t think that is exposed in python. You can have a look at the C++ code to get an idea how the ruler is calculated and what parameters are available.

> <https://github.com/Slicer/Slicer/blob/3acf6800e3578015ffd4d23404fcd1ff9bd1337d/Libs/MRML/DisplayableManager/vtkMRMLRulerDisplayableManager.cxx#L242>

---

<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:** [July 17, 2023, 5:40pm UTC](https://discourse.slicer.org/t/how-to-make-the-ruler-longer-like-this-picture/30635/3 "2023-07-17T17:40:24Z")

</div>

The ruler is short to not interfere with corner annotations. The implementation should take the corner annotations into account (only make it wide if there is space; or shift things around the avoid overlap).

---

<div class="post-metadata">

**Author:** ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)\
**Post date:** [July 18, 2023, 3:04am UTC](https://discourse.slicer.org/t/how-to-make-the-ruler-longer-like-this-picture/30635/4 "2023-07-18T03:04:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/e/9ed8e648826627bfc21c58bb68ad6446ea51a63e.jpeg)  
change to code

> double rulerPreferredLengthPixel = double(viewWidthPixel)/4.0;  
> to  
> double rulerPreferredLengthPixel = double(viewWidthPixel)/1.4;

will make the ruler longer
