View Issue Details

IDProjectCategoryView StatusLast Update
0001274Slicer4Core: Base Codepublic2012-07-30 06:22
Reporterpieper Assigned Tofinetjul  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.0.0Fixed in VersionSlicer 4.0.0 
Summary0001274: slice pipeline does not re-execute for changes to label layer image data
Description

Recent changes vtkMRMLSliceLogic and vtkMRMLSliceLayerLogic and possibly to the version of VTK bing us(sometime in May) changed the behavior so that the Editor stopped showing the result of an edit after drawing - however the drawing did take place, and panning or zooming the slice caused the updated image data to appear.

The issue may be to be related to the blending pipeline.

Steps To Reproduce

Start slicer4

1) Load volume (get the MRHead from SampleData).

2) Enter Editor and select default color map.

3) In python console paste:

lbnode = getNode('MRHead-label')
bgnode = getNode('MRHead')
thresh = vtk.vtkImageThreshold()
thresh.ThresholdBetween(100,200)
thresh.SetInValue(1)
thresh.SetOutputScalarTypeToShort()
thresh.SetInput(bgnode.GetImageData())
thresh.Update()
lbnode.GetImageData().DeepCopy(thresh.GetOutput())
lbnode.Modified()

no redraw appears... but mouse over the images and see that the values of the MRML image data have been updated

4) But if you change the actual pointer, the redraw does happen:

lbnode.SetAndObserveImageData(thresh.GetOutput())

Additional Information

This check ensures that the layer logic issues a modified when the volume node's image data needs to be recalculated:

http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=17469

But from the debugging I did it seems that the render is being called but the pipeline does not know that it needs to re-execute.

TagsNo tags attached.

Activities

finetjul

finetjul

2011-09-11 00:00

administrator   ~0002973

The behavior is correct. It's because the original labelmap imagedata is connected to a pipeline (vtkImageThreshold).

When I do:
1) Load volume (get the MRHead from SampleData).
2) Enter Editor and select default color map.
3) In python
lbnode = getNode('MRHead-label')
lbnode.GetImageData().GetProducerPort().GetProducer()

I got the following output: (vtkImageThreshold)06D11B70

This means that even if you later override the image data in lbnode, because it is connected to an upstream pipeline, next time the render requests the image data, it will reexecute it.

pieper

pieper

2011-10-22 05:34

administrator   ~0003196

No - the problem is not that there's a pipeline -that's fine. The actual underlying problem is that calling modified on the lbnode does not trigger a redraw of the slice views.

finetjul

finetjul

2011-10-22 06:24

administrator   ~0003197

Last edited: 2011-10-22 06:25

Let me try to remember what I discovered. You have the following pipeline:

source -> A (vtkImageThreshold) -> B (vtkImageReslice) -> C (vtkImageMapper)

Between each filter (A <-> B and B <-> C) there is a temporary vtkImageData.
The Editor edits a temporary vtkImageData between A and B.
2 problems:

  • Sending ModifiedEvent on a temporary image data doesn't trigger an "update request" event on the pipeline. So when the vtkimagemapper needs to display its slice, it won't update the pipeline. -> The request needs to come from a filter.
  • Whatever is changed in the temporary image (between A and B) will be erased next time the filter A is re-executed.
pieper

pieper

2011-10-24 07:10

administrator   ~0003198

I guess I'm not explaining this well :)

Ignore the editor, just load the MR head sample data and do the following in the python console:

n = getNode('MR*')
i = n.GetImageData()
e = vtk.vtkImageEllipsoidSource()
e.Update()
i.DeepCopy(e.GetOutput())
n.Modified()

Notice that the slice viewers don't redraw until you try to pan or zoom. The point is that changing the image data should trigger a render.

For reference the same sequence does cause a redraw in slicer3.

(Slicer3) 49 % MRMLWatch
mRMLWatcher0
(Slicer3) 50 % set n $::MRML(MR-head)
vtkTemp6794
(Slicer3) 51 % set i [$n GetImageData]
vtkTemp7003
(Slicer3) 52 % set e [vtkImageEllipsoidSource New]
vtkObj7004
(Slicer3) 53 % $e Update
(Slicer3) 54 % $i DeepCopy [$e GetOutput]

finetjul

finetjul

2011-10-24 07:33

administrator   ~0003199

I didn't try that script, but I agree with VTK that it shouldn't work :-)

When you deep copy, you modify an intermediate image (between 2 filters: vtkImageThreshold and vtkImageReslice).
You trigger a refresh in the view by doing n.Modified(), however, when the image mapper (end of the pipeline) is checking if the pipeline is up-to-date, it queries the mtime of the filters, not the mtime of the intermediate images (because they are not supposed to be changed by anything else than a filter).

Later, when you pan and zoom, you change the parameters of the reslice filter, which changes its MTime, so the pipeline becomes obsolete, and when the image mapper checks the pipeline, it asks for an update, it then finally propagates the "temporary" image data downstream along the pipeline (it reslices it first, then apply some window/level...).

In slicer3, it was working because we were not using a "true" VTK demand-driven pipeline.

pieper

pieper

2011-10-25 04:52

administrator   ~0003204

No - the DeepCopy goes into the vtkImageData that is in the mrml volume node. It is not in the middle of any pipelines, it is at the beginning. This should be the input data to whatever pipelines make use of the volume node for rendering or other uses.

What vtkImageThreshold and vtkImageReslice are you talking about? In the example n.GetImageData().DeepCopy(e.GetOutput()) is copying the updated image data from the vtkImageEllipsoid source and putting it into the image data of the mrml node -- there shouldn't be any other filters putting data into the mrml node's image data.

jcfr

jcfr

2012-07-27 15:36

administrator   ~0005305

Dear issue reporter,

Good news :) Slicer developers SOLVED the problem you reported - YOU now need to VERIFY and CLOSE this issue.

pieper

pieper

2012-07-30 06:22

administrator   ~0005450

Issue was fixed by ensuring that label maps do not have 'lingering' producer ports after creation.

Issue History

Date Modified Username Field Change
2011-07-13 07:57 pieper New Issue
2011-07-13 07:58 pieper Assigned To => finetjul
2011-07-13 07:58 pieper Status new => assigned
2011-08-25 09:34 finetjul Target Version => Slicer 4.0 RSNA
2011-09-10 23:25 finetjul Status assigned => feedback
2011-09-11 00:00 finetjul Note Added: 0002973
2011-09-11 00:00 finetjul Status feedback => resolved
2011-09-11 00:00 finetjul Fixed in Version => Slicer 4.0 RSNA
2011-09-11 00:00 finetjul Resolution open => no change required
2011-10-22 05:34 pieper Note Added: 0003196
2011-10-22 06:24 finetjul Note Added: 0003197
2011-10-22 06:25 finetjul Note Edited: 0003197
2011-10-24 07:10 pieper Note Added: 0003198
2011-10-24 07:11 pieper Resolution no change required => reopened
2011-10-24 07:33 finetjul Note Added: 0003199
2011-10-25 04:52 pieper Note Added: 0003204
2012-07-27 15:36 jcfr Note Added: 0005305
2012-07-30 06:22 pieper Note Added: 0005450
2012-07-30 06:22 pieper Status resolved => closed
2012-07-30 06:22 pieper Resolution reopened => fixed