Color bar in slice viewers

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: 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

3 Likes

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

Regards,
Saima safdar

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

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

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

Thank you I got it

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

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

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

More information on the new color legend:

1 Like