View Issue Details

IDProjectCategoryView StatusLast Update
0003076Slicer4Module Editorpublic2017-06-07 23:27
ReporterfinetjulAssigned Tofinetjul 
Status closedResolutionfixed 
Product VersionSlicer 4.2.2-1 
Target VersionFixed in VersionSlicer 4.4.0 
Summary0003076: Editor doesn't update scalar range

When editing a labelmap, the scalar range of the image can change. However, the scalar range from node->GetImageData()->GetPointData()->GetScalars()->GetScalarRange() stays the same.
This can be a problem when Volume Rendering the labelmap as the scalar range is not up-to-date

Steps To Reproduce

Load an image and edit it in the Editor module
Open the python console and type:
n = slicer.mrmlScene().GetNodeByID('vtkMRMLScalarVolumeNode3')
i = n.GetImageData()
d = i.GetPointData()
s = d.GetScalars()

Edit the labelmap with a label that would change the range
Type in the python console:
-> it is the old range.
-> it is the new range.

Additional Information

Call Modified() on the vtkImageData pointData scalars.

TagsNo tags attached.


related to 0003497 closedfinetjul Volume rendering of label maps is black (VTK GPU Ray Casting on OSX) 
related to 0001477 resolvedpieper "Painting" a volume rendering 




2013-04-17 06:23

administrator   ~0008422

I took the opportunity to make a single method to modify the relevant parts of the volume node and confirmed that the scalar range is updated.

Unfortunately, the volume rendering colors still do not update, so I'm re-assigning this back to Julien.

To reproduce:

  • download MRHead
  • enter editor and draw with default label (1, green)
  • go to volume rendering and select MRHead-label for rendering
  • go back to Editor and pick a new color (!=1) and draw
  • volume is rendered, but the color is always green


2013-05-01 11:33

administrator   ~0008549

Hi Julien -

Did you have a chance to look at this? I was planning to add a volume rendering button in the editor but it won't make sense until this issue is resolved.




2013-05-01 11:40

administrator   ~0008550

Hi Steve,
I looked at it, but it's not an easy fix. It's rooted deep down into the VTK volume mapper :-/



2013-05-01 11:43

administrator   ~0008551

Okay - thanks. Can you think of a way to reset it from the mrml level? That is, if I detect the scalar range has changed, could I remove the volume rendering nodes and re-add them?



2013-05-01 11:46

administrator   ~0008552

It might work.

Another work-around would be to call Modified() on the color transfer function. That would refresh the volume rendering internals.



2013-05-01 12:04

administrator   ~0008553

No luck :( Also tried deleting and re-creating the nodes. Will need to keep thinking....



2014-03-27 04:28

administrator   ~0011467

Fixed in r23027



2014-03-27 14:16

administrator   ~0011475

Works great - thanks!

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file c9b1e89b

2013-04-17 10:19:28


Details Diff
BUG: 0003076 make sure scalar range is updated after edit operations.

This new method unifies the updating of the image data and volume
node to trigger rendering. By calling modified on the point scalars,
this GetScalarRange call returns the correct data.

This is confirmed by looking at the results of the call after
editing in new colors as shown below.

>>> l = getNode('*label')
>>> l
>>> l.GetImageData().GetScalarRange()
(0.0, 15.0)
>>> l.GetImageData().GetScalarRange()
(0.0, 18.0)

git-svn-id: 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File
mod - Modules/Scripted/EditorLib/ Diff File

Issue History

Date Modified Username Field Change
2013-04-17 05:32 finetjul New Issue
2013-04-17 05:32 finetjul Status new => assigned
2013-04-17 05:32 finetjul Assigned To => pieper
2013-04-17 05:34 finetjul Steps to Reproduce Updated
2013-04-17 06:20 pieper Assigned To pieper => finetjul
2013-04-17 06:23 pieper Note Added: 0008422
2013-04-17 06:23 pieper Status assigned => feedback
2013-05-01 11:33 pieper Note Added: 0008549
2013-05-01 11:40 finetjul Note Added: 0008550
2013-05-01 11:43 pieper Note Added: 0008551
2013-05-01 11:46 finetjul Note Added: 0008552
2013-05-01 12:04 pieper Note Added: 0008553
2014-02-25 03:54 pieper Relationship added related to 0003497
2014-03-27 04:28 finetjul Note Added: 0011467
2014-03-27 04:28 finetjul Status feedback => resolved
2014-03-27 04:28 finetjul Fixed in Version => Slicer 4.4.0
2014-03-27 04:28 finetjul Resolution open => fixed
2014-03-27 12:14 finetjul Relationship added related to 0001477
2014-03-27 14:16 pieper Note Added: 0011475
2014-03-27 14:16 pieper Status resolved => closed
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file c9b1e89b