View Issue Details

IDProjectCategoryView StatusLast Update
0001993Slicer4Module SceneViewspublic2017-06-07 23:27
Reporterfinetjul Assigned Toalexy  
PriorityhighSeveritymajorReproducibilitysometimes
Status closedResolutionfixed 
Product VersionSlicer 4.1.0 
Target VersionSlicer 4.2.0Fixed in VersionSlicer 4.2.0 
Summary0001993: Restoring scene view should not use internal scene view node
Description

When restoring a node (e.g. vtkMRMLScalarVolumeNodE) that doesn't exist in the scene, RestoreScene() adds the node of the vtkMRMLSceneViewNode nodes collection into the scene. This would be ok if the scene view can't be restored multiple times.
If after the first restore, the node is changed in the scene, it is actually changed in the vtkMRMLSceneViewNode nodes collection as well.
When the node is restored the second time, the changed value is restored instead of the original value.

Steps To Reproduce

See vtkMRMLSceneViewNodeRestoreSceneTest::removeRestoreEditAndRestore

TagsNo tags attached.

Activities

alexy

alexy

2012-05-08 06:15

developer   ~0004194

Last edited: 2012-05-08 06:16

When you say "node change" what do you mean? SceneView node uses Copy method to restore the state of nodes in the scene. So it should restore all information that is copied by Copy method. However for "large data" nodes such as Volumes and Models, Copy method does "shallow copy", it does not copy ImageData or PolyData. This is done intentionally to avoid duplication of large structures since Copy is also used for Undo/Redo functionality. As the result SceneView::Restore() does not restore ImageData and PolyData. That is a limitation, and this decision was made earlier when I implemented this functionality.

If you meant something else please provide more details.

finetjul

finetjul

2012-05-08 07:57

administrator   ~0004198

vtkMRMLSceneViewNode::RestoreScene() doesn't necessarily "copy" its nodes into the main scene, but it "add" its own nodes into the scene:
https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Core/vtkMRMLSceneViewNode.cxx#L486

alexy

alexy

2012-05-11 11:26

developer   ~0004331

Fixed SceneView to add a copy of it's internal node rather than the node itself to the scene on RestoreScene()

finetjul

finetjul

2012-05-11 12:05

administrator   ~0004335

Fixed in r20066:
http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=20066

jcfr

jcfr

2012-05-11 17:11

administrator   ~0004342

Alex:

The test vtkMRMLSceneViewNodeRestoreSceneTest is failing on my machine
on line 121. Looking at it it seems to expect a wrong result. If you
restore a SceneView with the volume node that didn't have displayable
before you saved a SceneView it should not have a display node, but
the test expects otherwise. Am I missing something?

Julien :

Hi Alex,
If you look at createScene, it is associating a display node " vtkMRMLScalarVolumeDisplayNode1" to the displayable node ("vtkMRMLScalarVolumeNode1")
So when you StoreScene, it should save the association. RestoreScene() should make sure it is still true. This is what the first RestoreScene() (line 113) does. You can check it works by doing restoredVolumeNode->GetDisplayNodeID() at line 117.

Alex:

Sorry, I missed the creation function.
So does the test fail intentionally currently to demonstrate the problem in
http://www.na-mic.org/Bug/view.php?id=1993
?

Julien:

yes.

Related Changesets

Slicer: 1999-expose-dcmtk-dir-to-built-in-module 3c89ca46

2012-05-06 21:28:53

finetjul

Details Diff
ENH: Add failing test in vtkMRMLSceneViewNode

vtkMRMLSceneViewNode::RestoreScene must be fixed to never use the vtkMRMLSceneViewNode::Nodes into the scene but only use copies.
See issue 0001993

git-svn-id: http://svn.slicer.org/Slicer4/trunk@20030 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/MRML/Core/Testing/CMakeLists.txt Diff File
add - Libs/MRML/Core/Testing/vtkMRMLSceneViewNodeRestoreSceneTest.cxx Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLSceneViewNodeStoreSceneTest.cxx Diff File

Issue History

Date Modified Username Field Change
2012-05-06 17:26 finetjul New Issue
2012-05-06 17:26 finetjul Status new => assigned
2012-05-06 17:26 finetjul Assigned To => alexy
2012-05-07 18:39 finetjul Steps to Reproduce Updated
2012-05-08 06:15 alexy Note Added: 0004194
2012-05-08 06:16 alexy Note Edited: 0004194
2012-05-08 07:57 finetjul Note Added: 0004198
2012-05-11 11:26 alexy Note Added: 0004331
2012-05-11 11:26 alexy Status assigned => resolved
2012-05-11 11:26 alexy Resolution open => fixed
2012-05-11 12:05 finetjul Note Added: 0004335
2012-05-11 12:05 finetjul Status resolved => closed
2012-05-11 12:05 finetjul Fixed in Version => Slicer 4.2.0 AHM Summer 2012
2012-05-11 17:11 jcfr Note Added: 0004342
2012-08-21 09:47 jcfr Target Version => Slicer 4.2.0 - Feature freeze Sept 1st 2012
2017-06-07 23:27 finetjul Changeset attached => Slicer 1999-expose-dcmtk-dir-to-built-in-module 3c89ca46