# Workaround for errors when showing AnnotationRuler Label text in 2D slice view

**URL:** <https://discourse.slicer.org/t/workaround-for-errors-when-showing-annotationruler-label-text-in-2d-slice-view/11608>\
**Category:** Development\
**Created:** [May 18, 2020, 11:01pm UTC](https://discourse.slicer.org/t/workaround-for-errors-when-showing-annotationruler-label-text-in-2d-slice-view/11608 "2020-05-18T23:01:56Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [May 18, 2020, 11:01pm UTC](https://discourse.slicer.org/t/workaround-for-errors-when-showing-annotationruler-label-text-in-2d-slice-view/11608/1 "2020-05-18T23:01:56Z")

</div>

I’m hoping there is a workaround to solve an issue I’m getting with showing the label text of an AnnotationRuler label in the 2D slice views. I’m still needing to use this AnnotationRuler object instead of transitioning to a line node at the moment.

First place a ruler down on a volume and turn on the visibility for the 2D slice views.

```python
ruler_node = slicer.mrmlScene.GetNodeByID("vtkMRMLAnnotationRulerNode1")
ruler_node.GetAnnotationTextDisplayNode().SetVisibility2D(True)

```

This will then produces lots of these errors if the slice intersection offset crosses the display such as the yellow slice intersection shown below. Turning off slice intersections has no change on these errors.

`Tuple 1 out of range for provided array. Requested tuple: 0 Tuples: 0` from [this place in the code](https://github.com/Slicer/VTK/blob/dd7e051af68cfbf3675e411494af7169fc7d5618/Common/Core/vtkDataArray.cxx#L878-L880)  
and `Point array ctrlPtsSelected with 1 components, only has 0 tuples but there are 1 points` from [this place in the code](https://github.com/Slicer/VTK/blob/dd7e051af68cfbf3675e411494af7169fc7d5618/Common/DataModel/vtkDataSet.cxx#L432-L435).  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/b/cbc1546178fcb062857e1bf98099119c240ff426.png)

---

<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:** [May 19, 2020, 12:09am UTC](https://discourse.slicer.org/t/workaround-for-errors-when-showing-annotationruler-label-text-in-2d-slice-view/11608/2 "2020-05-19T00:09:58Z")

</div>

Usually if you can get a stack trace you can see what conditiions lead to those messages and find a way to handle them. I know the Annotation code is kind of complex and slated for replacement, but if the only issue is avoiding the error message it should be manageable.
