View Issue Details

IDProjectCategoryView StatusLast Update
0002816Slicer4Module SceneViewspublic2017-09-26 11:09
ReporternicoleAssigned Toalexy 
PrioritynormalSeveritymajorReproducibilityalways
Status feedbackResolutionreopened 
PlatformlinuxOSOS Version
Product Version 
Target VersionbacklogFixed in Version 
Summary0002816: Restoring scene views from MRB
Description

Storable data that only occur in scene views are not being saved to MRB.

Steps To Reproduce

Add data:
Libs/MRML/Core/Testing/TestData/ColorTest.ctbl
Libs/MRML/Core/Testing/TestData/cube.vtk
Libs/MRML/Core/Testing/TestData/fixed.nrrd
Libs/MRML/Core/Testing/TestData/helixMask3Labels.nrrd (as Label Map)

Volumes module: set the color node for helixMask3Labels to ColorTest

Create a scene view named All
In the Data module, remove nodes: helixMask3Labels, ColorTest, cube
Create a scene view named FixedVolume

Save as MRB, look in terminal, the data from the scene is not saved:
zipping to "/spl/tmp/nicole/Testing/MRBSceneViews/2012-12-04-Scene.mrb"
Zip: adding: /tmp/BundleSaveTemp-2012-12-04_17+04+28.277/2012-12-04-Scene/Data/Fixed Volume.png
Zip: adding rel: 2012-12-04-Scene/Data/Fixed Volume.png
Zip: adding: /tmp/__BundleSaveTemp-2012-12-04_17+04+28.277/2012-12-04-Scene/Data/All.png
Zip: adding rel: 2012-12-04-Scene/Data/All.png
Zip: adding: /tmp/
BundleSaveTemp-2012-12-04_17+04+28.277/2012-12-04-Scene/Data/fixed.nrrd
Zip: adding rel: 2012-12-04-Scene/Data/fixed.nrrd
Zip: adding: /tmp/__BundleSaveTemp-2012-12-04_17+04+28.277/2012-12-04-Scene/2012-12-04-Scene.mrml
Zip: adding rel: 2012-12-04-Scene/2012-12-04-Scene.mrml
Zip: adding: /tmp/__BundleSaveTemp-2012-12-04_17+04+28.277/2012-12-04-Scene/Slicer Data Bundle Scene View.png
Zip: adding rel: 2012-12-04-Scene/Slicer Data Bundle Scene View.png
saved "/spl/tmp/nicole/Testing/MRBSceneViews/2012-12-04-Scene.mrb"

Exit and restart Slicer, load MRB

Scene Views module, restore the All view.

On my machine, it restored the label map volume and the cube, since inside the scene view the file paths point to the original data I loaded from the test data directory:
fileName="../../../projects/birn/nicole/Slicer42/Slicer/Libs/MRML/Core/Testing/TestData/cube.vtk"
fileName="../../../projects/birn/nicole/Slicer42/Slicer/Libs/MRML/Core/Testing/TestData/ColorTest.ctbl"
fileName="../../../projects/birn/nicole/Slicer42/Slicer/Libs/MRML/Core/Testing/TestData/helixMask3Labels.nrrd"

If I move the mrb to a different directory on my machine, it still restores the scene view All because the expansion/resetting of file names is happening when the file is expanded in /tmp, but if the file were moved to another machine, it would fail. If on my machine I unzip the mrb and load the mrml file from a non matching relative path to the data, it fails to restore the scene. See attached MRB.

TagsNo tags attached.

Relationships

related to 0003956 closednicole Repeated saves of MRBs cause corruption 
related to 0002687 feedbackalexy Saving a scene that contains nodes with the same name results in data loss 

Activities

2012-12-04 12:16

 

2012-12-04-Scene.mrb (389,811 bytes)
pieper

pieper

2012-12-18 09:01

administrator   ~0007529

The method to fix is here:

https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Logic/vtkMRMLApplicationLogic.cxx#L426

It would be good to break this up into smaller methods. In particular the code to save a scene (and the scene view storables) into a temp directory and then restore their original paths would be good to break out into a new method.

Also it would be good to write a self test covering this code.

alexy

alexy

2012-12-18 09:24

developer   ~0007534

Steve, could you add steps how to reproduce or add a scene?

pieper

pieper

2012-12-18 09:40

administrator   ~0007536

I didn't try myself, but the directions that Nicole provided in the Steps to Reproduce section look pretty complete. Did you try them?

alexy

alexy

2013-08-23 10:59

developer   ~0009570

Made data present in SceneViews to be stored in MRB file even if it is not present in the main scene.

Restructured vtkMRMLApplicationLogic::SaveSceneToSlicerDataBundleDirectory() code, made it more modular.

At revision: 22325

nicole

nicole

2014-01-23 11:15

administrator   ~0010533

Marianna gave me a .mrb file that shows that this works for saving data that only appear in scene views, but when loading the mrb back into Slicer, the scene view only data is not read in. The mrb is deleted immediately after load so when the scene view with the extra data is restored, the data is no longer on disk and fails to load.

At the engineering t-con I talked with Jim and Steve and we agreed that the simplest work around for now is to not delete the expanded MRB directory immediately, but to do it on Scene Close instead.
Jim proposed some more complex tracking options, as well as mentioning the option of going back to the MRB on scene view restore to find missing data, as well as discussing ways to make it clear to the user what will and will not work with scene views.

The quick fix of not deleting the mrb from disk after it's loaded will fix Marianna's problem, and hopefully it won't be too hard to add deleting the expanded files on scene close.

lassoan

lassoan

2017-09-26 11:09

developer   ~0015138

The issue has been open for 5 years, so it cannot be critically important

Issue History

Date Modified Username Field Change
2012-12-04 12:16 nicole New Issue
2012-12-04 12:16 nicole Status new => assigned
2012-12-04 12:16 nicole Assigned To => pieper
2012-12-04 12:16 nicole File Added: 2012-12-04-Scene.mrb
2012-12-07 04:53 pieper Target Version Slicer 4.2.2 => Slicer 4.2.3
2012-12-18 09:01 pieper Note Added: 0007529
2012-12-18 09:03 pieper Assigned To pieper => alexy
2012-12-18 09:03 pieper Priority normal => high
2012-12-18 09:24 alexy Note Added: 0007534
2012-12-18 09:40 pieper Note Added: 0007536
2012-12-18 13:09 pieper Relationship added related to 0002687
2013-02-12 09:37 jcfr Target Version Slicer 4.2.3 => Slicer 4.3.0
2013-07-02 12:32 pieper Severity minor => major
2013-07-02 12:32 pieper Reproducibility have not tried => always
2013-08-23 10:59 alexy Note Added: 0009570
2013-08-23 10:59 alexy Status assigned => resolved
2013-08-23 10:59 alexy Resolution open => fixed
2014-01-23 11:15 nicole Note Added: 0010533
2014-01-23 11:15 nicole Status resolved => feedback
2014-01-23 11:15 nicole Resolution fixed => reopened
2015-02-19 11:41 nicole Relationship added related to 0003956
2015-11-03 19:38 jcfr Target Version Slicer 4.3.0 => Slicer 4.6.0
2015-11-12 14:39 jcfr Target Version Slicer 4.6.0 => Slicer 4.5.1
2016-10-12 02:56 jcfr Target Version Slicer 4.5.1 => Slicer 4.7.0
2017-09-26 11:09 lassoan Priority high => normal
2017-09-26 11:09 lassoan Target Version Slicer 4.7.0 => backlog
2017-09-26 11:09 lassoan Note Added: 0015138