View Issue Details

IDProjectCategoryView StatusLast Update
0002725Slicer4Core: MRMLpublic2012-11-15 16:58
Reporterlassoan Assigned Toalexy  
PriorityhighSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.2.0 
Target VersionSlicer 4.2.1Fixed in VersionSlicer 4.2.1 
Summary0002725: Transform hierarchy is not saved in the scene file
Description

Junichi found the following regression: transform hierarchies are not saved in the scene file. It is reproducible on the latest nightly build (Slicer-4.2.0-2012-11-02-win-amd64.exe) on Windows and Mac.

How to reproduce:

  • Start Slicer
  • Go to the Transforms module, create 2 transforms
  • Select LinearTransform 4, select LinearTransform_3 as "Transformed"
  • Go to the Data module => LinearTransform_3 appears nested under LinearTransform_4 (correct)
  • Save the scene
  • Close Slicer
  • Start Slicer
  • Load the saved scene
  • Go to the Data module => LinearTransform_3 do NOT appear nested under LinearTransform_4 => ERROR!

In the saved file there are no transform hierarchy nodes, so probably the transformation hierarchy saving is broken.
The model hierarchy and annotation hierarchy save/load works well.

TagsNo tags attached.

Relationships

related to 0002530 closedfinetjul Display is not updated when changing a transform 
related to 0002539 closedfinetjul Update node reference before AddNode to scene 

Activities

lassoan

lassoan

2012-11-05 03:44

developer   ~0007045

The saving looks OK (the transformNodeRef attribute of the LinearTransform node is correct in the file.) So, probably the loading is broken.

It may be yet another consequence of the fragile implementation of vtkMRMLTransformableNode::SetAndObserveTransformNodeID, which simply returns without doing anything if it detects that the scene is not yet set! This is highly error-prone. See also http://www.na-mic.org/Bug/view.php?id=2530#c6356 and 0002539.

lassoan

lassoan

2012-11-05 04:50

developer   ~0007046

Checked with the debugger. The problem is indeed caused by the same vtkMRMLTransformableNode::SetAndObserveTransformNodeID implementation issue as reported in 0002530 and 0002539.

vtkMRMLScene::LoadIntoScene calls the XML parser, which eventually calls vtkMRMLTransformableNode::ReadXMLAttributes, which calls vtkMRMLTransformableNode::SetAndObserveTransformNodeID, that simply drops the passed transformNodeID value.

Potential fix: if vtkMRMLTransformableNode::SetAndObserveTransformNodeID is called and the scene is not yet set then store the node ID in a member variable. When later the scene is set update the node reference (retrieve the pointer, add observer, etc.).

lassoan

lassoan

2012-11-05 05:03

developer   ~0007047

Added a ticket for tracking the long-term solution of the issue, see 0002727

alexy

alexy

2012-11-06 04:57

developer   ~0007069

Reassigning to Julien since it is related to his change of adding references

jcfr

jcfr

2012-11-06 06:49

administrator   ~0007071

See http://slicer-users.65878.n3.nabble.com/transformation-won-t-load-on-Slicer-4-2-td4025522.html

finetjul

finetjul

2012-11-09 03:33

administrator   ~0007130

From Andras investigation, it looks like it is a regression from r21175:
http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Libs/MRML/Core/vtkMRMLTransformableNode.cxx?r1=21175&r2=21174&pathrev=21175

Indeed, the behavior of SetAndObserveXXXNodeID() should observe a node ID regardless of the presence of a Scene.

Note: the commit to fix this current issue should add a unit test to ensure it doesn't happen again.

alexy

alexy

2012-11-09 05:23

developer   ~0007133

Fixed setting transform node reference.
Added test Testing/vtkMRMLTransformableNodeReferenceSaveImportTest.cxx
http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=21332

jcfr

jcfr

2012-11-09 06:05

administrator   ~0007134

The test was not added using "add_test". Commit r21333 fixed that.
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=21333

Following Andras steps, I also confirm that the fix works.

lassoan

lassoan

2012-11-15 16:58

developer   ~0007267

Tested on Slicer 4.2.0-2012-11-02 (Win64) and it works well.

Issue History

Date Modified Username Field Change
2012-11-04 19:22 lassoan New Issue
2012-11-04 19:22 lassoan Status new => assigned
2012-11-04 19:22 lassoan Assigned To => alexy
2012-11-05 03:44 lassoan Note Added: 0007045
2012-11-05 04:50 lassoan Note Added: 0007046
2012-11-05 05:03 lassoan Note Added: 0007047
2012-11-06 04:56 alexy Relationship added related to 0002530
2012-11-06 04:56 alexy Relationship added related to 0002539
2012-11-06 04:57 alexy Note Added: 0007069
2012-11-06 04:57 alexy Assigned To alexy => finetjul
2012-11-06 06:47 jcfr Priority normal => high
2012-11-06 06:47 jcfr Target Version => Slicer 4.2.1
2012-11-06 06:49 jcfr Note Added: 0007071
2012-11-09 03:33 finetjul Note Added: 0007130
2012-11-09 03:45 jcfr Assigned To finetjul => alexy
2012-11-09 05:23 alexy Note Added: 0007133
2012-11-09 05:23 alexy Status assigned => resolved
2012-11-09 05:23 alexy Resolution open => fixed
2012-11-09 05:25 jcfr Fixed in Version => Slicer 4.2.1
2012-11-09 06:05 jcfr Note Added: 0007134
2012-11-15 16:58 lassoan Note Added: 0007267
2012-11-15 16:58 lassoan Status resolved => closed