# Change the font size of the title of the scalar bar in SlicerRT Isodose module

**URL:** <https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278>\
**Category:** Development\
**Tags:** vtk, slicerrt\
**Created:** [June 22, 2021, 6:27pm UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278 "2021-06-22T18:27:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [June 22, 2021, 6:27pm UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278/1 "2021-06-22T18:27:34Z")

</div>

Isodose module in SlicerRT uses vtkScalarBar to show isodose palette and values.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/9/39e1dc4d4d8518ecb8ef353923d42c0a20863302.png)

I have tried to change the title’s font size of the scalar bar actor, but it didn’t change anything.

For example

```auto
  // Update all scalar bar actors
  for (vtkScalarBarWidget* scalarBarWidget : d->ScalarBarWidgets)
  {
    vtkSlicerRTScalarBarActor* actor = vtkSlicerRTScalarBarActor::SafeDownCast( scalarBarWidget->GetScalarBarActor() );

    // Update actor
    actor->SetTitle(scalarBarTitle.c_str());

    if (vtkTextProperty* textProp = actor->GetTitleTextProperty())
    {
      textProp->SetFontSize(8);
    }
    scalarBarWidget->Render();
  }

```

How to do this correctly?

[Update scalar bar actor original code](https://github.com/SlicerRt/SlicerRT/blob/master/Isodose/qSlicerIsodoseModuleWidget.cxx#L999-L1016)

---

<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:** [June 22, 2021, 11:00pm UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278/2 "2021-06-22T23:00:43Z")

</div>

The text is auto-scaled to the widget size. You can make the text larger by making the widget larger.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [June 23, 2021, 4:52am UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278/3 "2021-06-23T04:52:37Z")

</div>

How can i make it more customized? Make it smaller, both title, labels and scalar bar itself, without modifying [scalar bar actor](https://github.com/SlicerRt/SlicerRT/blob/master/Isodose/Widgets/vtkSlicerRTScalarBarActor.cxx) class.

---

<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:** [June 25, 2021, 8:23pm UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278/4 "2021-06-25T20:23:03Z")

</div>

You can access some properties of the scalar bar, but maybe not all that you need. Unfortunately, the scalar bars are implemented very poorly. It would be awesome if you could help with implementing it properly. Most importantly, it would need to use a displayable manager class, which would display a scalar bar for each display node. Appearance of the scalar bar could be modified by changing the display node properties.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [June 28, 2021, 9:22am UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278/5 "2021-06-28T09:22:09Z")

</div>

I can try to help.

I have checked the source code and have found [ScalarBarDisplayableManager](https://github.com/Slicer/Slicer/blob/master/Libs/MRML/DisplayableManager/vtkMRMLScalarBarDisplayableManager.h) class. Can it be used as a basis for the future implementation? I have also found that some modules (Colors, Isodose, DataProbe) use nearly identical versions of ScalarBarActor class. Is that the absent of universal solution of that problem?

---

<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:** [June 28, 2021, 2:10pm UTC](https://discourse.slicer.org/t/change-the-font-size-of-the-title-of-the-scalar-bar-in-slicerrt-isodose-module/18278/6 "2021-06-28T14:10:29Z")

</div>

> [@Mik](#):
>
> I can try to help.

Awesome!

> [@Mik](#):
>
> I have checked the source code and have found [ScalarBarDisplayableManager](https://github.com/Slicer/Slicer/blob/master/Libs/MRML/DisplayableManager/vtkMRMLScalarBarDisplayableManager.h) class. Can it be used as a basis for the future implementation?

We should improve the scalar bar implementation in the Slicer core and then slightly modified versions in extensions will be no longer needed. You can modify the scalar bar any way you see fit. It is also very important to support multiple scalar bars and manage them (add them to the renderer) in a displayable manager.
