# Color bar in slice viewers

**URL:** https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291
**Category:** Support
**Created:** [March 26, 2019, 2:40pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291 "2019-03-26T14:40:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)
#### Post date: [March 26, 2019, 2:40pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/1 "2019-03-26T14:40:58Z")

</div>

I wanted to visualize color bar in slice views today, and I was reminded how difficult it is to find this functionality. I think the only reason I was able to find it is because I knew it was possible to do that, I know who contributed that functionality, so I was able to search my email and find this PR: [Issues with window level and threshold on the volume module, display panel · Issue #235 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/235), and then I saw and remembered that this functionality is hidden in the “Data Probe” module (not to be confused with the “DataProbe” area of the interface!).

In case someone else needs to do this (or does not know this is possible), here’s how to enable scalar bar:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/d/adfde48a015432390b38e05175b979acc6a15f9e.png)

---

<div class="post-metadata">

### Author: ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)
#### Post date: [September 15, 2021, 6:59am UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/2 "2021-09-15T06:59:48Z")

</div>

Hi,  
it do not enable scalar bar in slice view. Am i missing some other settings.

Regards,  
Saima safdar

---

<div class="post-metadata">

### Author: ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)
#### Post date: [September 15, 2021, 7:10am UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/3 "2021-09-15T07:10:13Z")

</div>

Hi,  
This is for the scalarvolume and not for the labelmapnode. I need to convert the labelmap to volume node then it displays the bar but grey scale.

Is it possible to directly get the bar for labelmap. how to change the color code for the scalar volume

---

<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: [September 15, 2021, 4:58pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/4 "2021-09-15T16:58:00Z")

</div>

> [@Saima](#):
>
> I need to convert the labelmap to volume node

You can convert between labelmap ↔ scalar volume nodes in Volumes module / Volume Information section.

---

<div class="post-metadata">

### Author: ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)
#### Post date: [March 8, 2022, 9:18pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/5 "2022-03-08T21:18:56Z")

</div>

How to enable disable color scalar bar in data probe using python script

---

<div class="post-metadata">

### Author: ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)
#### Post date: [March 8, 2022, 9:20pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/6 "2022-03-08T21:20:37Z")

</div>

Thank you I got it

sliceAnnotations = slicer.modules.DataProbeInstance.infoWidget.sliceAnnotations sliceAnnotations.scalarBarEnabled=False  
sliceAnnotations.updateSliceViewFromGUI()

---

<div class="post-metadata">

### Author: ![Saima](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Saima](https://discourse.slicer.org/u/Saima)
#### Post date: [March 8, 2022, 10:14pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/7 "2022-03-08T22:14:14Z")

</div>

Hi,  
I am trying to create a check box but running into error

```
self.setParameterNode(self.logic.getParameterNode())

```

File “/home/saima/Slicer-4.11.0-2020-02-25-linux-amd64/Visualisation/Visualisation/Visualisation.py”, line 115, in setParameterNode  
self.updateGUIFromParameterNode()  
File “/home/saima/Slicer-4.11.0-2020-02-25-linux-amd64/Visualisation/Visualisation/Visualisation.py”, line 147, in updateGUIFromParameterNode  
self.scalarBar.checked = (self.\_parameterNode.GetParameter(“scalarBarLabel”) == “true”)  
AttributeError: ‘VisualisationWidget’ object has no attribute ‘scalarBar’

Please help

Regards,  
Saima Safdar

---

<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: [March 8, 2022, 11:41pm UTC](https://discourse.slicer.org/t/color-bar-in-slice-viewers/6291/8 "2022-03-08T23:41:29Z")

</div>

Color legend has been hugely improved in recent Slicer versions (you can show multiple color legends, for more node types, works automatically for continuous and discrete colormaps, etc.) and it is now also simpler to show/hide it. See example in the script repository: [Script repository — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#show-color-legend-for-a-volume-node)

More information on the new color legend:

> [@"Color Scalar Bar" reworked and upgraded, now it’s called "Color Legend"](https://discourse.slicer.org/t/color-scalar-bar-reworked-and-upgraded-now-it-s-called-color-legend/21567):
>
> Starting from version [30530 build 2022-01-15](https://github.com/Slicer/Slicer/pull/5828/commits/170a0e0edd448fd2c5d8e47ac6de591293fc8354) “Color Scalar Bar” section from “Colors” module was replaced with “Color Legend” section. The “Color Legend” section has been also added to the “Volume”, “Model” and “Markups” modules to control visibility and behavior of color legend. New major features: More unified API. Each Volume, Model, Markups or any other displayable node now can have an individual color legend by means of [vtkMRMLColorLegendDisplayNode](https://apidocs.slicer.org/master/classvtkMRMLColorLegendDisplayNode.html). Displayed LUT is in sy…
