View Issue Details

IDProjectCategoryView StatusLast Update
0003684Slicer4Core: MRMLpublic2018-03-02 11:01
Reporterogdenk Assigned Tonicole  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.3.1 
Target VersionSlicer 4.7.0Fixed in VersionSlicer 4.7.0 
Summary0003684: Unable to save and reopen Freesurfer surface models and scalar overlays using .mrml scene file
Description

I am using Slicer to view some of the results from Freesurfer. I have in a directory the brain.mgz file, the surface models for the right and left hemisphere pial surfaces (lh.pial and rh.pial), and the scalar overlay files for the cortical thickness rh.thickness and lh.thickness. I can open these all as expected and get a really nice display of the cortical thickness as well as a coronal slice to refer to. I save everything and create the .mrml file for the scene.

When I open the scene again, my pial models no longer display, though I can see them in the Models module. I can still see the coronal slice where I left it, just no models.

Here is my order of events:

  1. Open brain.mgz, center the volume when loading.
  2. Open the two pial surfaces rh.pial and lh.pial as models.
  3. Open the two cortical thickness overlays and associate with the proper model when opening.
  4. Turn on the coronal slice visibility.

At this point everything looks fine.

  1. Save the .mrml scene file in the same directory as the rest of the files.

I then close Slicer and reopen by double clicking the .mrml file or just reopen from within Slicer. The models are then invisible. I noticed that in the Models module, when I select one of the models and look at the Scalars, there is no active scalar listed and none in the dropdown.

TagsNo tags attached.

Relationships

related to 0004143 assignedSunderlandkyl Freesurfer surface is not aligned to the MR volume 

Activities

nicole

nicole

2014-05-12 06:05

administrator   ~0011718

Reproducible on a Mac debug build.
Reproducible on linux with the stable release from Oct.

Downloaded the bert Freesurfer test data set[1], made a scene as described.

When saving the scene, rh.pial and lh.pial are missing in the node list, but Slicer saved links to them in the .mrml file, and the display node has the active scalar set, and it has an overlay storage node.

When load the scene:
RROR: In /Users/nicole/Slicer4-svn/Slicer/Libs/MRML/Core/vtkMRMLFreeSurferModelOverlayStorageNode.cxx, line 79
vtkMRMLFreeSurferModelOverlayStorageNode (0x7fc3386a4550): ReadData: the model node doesn't have poly data yet, resetting the overlay read state to pending, try again later.

ERROR: In /Users/nicole/Slicer4-svn/Slicer/Libs/MRML/Core/vtkMRMLFreeSurferModelOverlayStorageNode.cxx, line 79
vtkMRMLFreeSurferModelOverlayStorageNode (0x7fc3386a84d0): ReadData: the model node doesn't have poly data yet, resetting the overlay read state to pending, try again later.

lh model has file name lh.thickness

[1] http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/Data

nicole

nicole

2015-12-09 12:10

administrator   ~0013670

There are a few layers of bugs here, the first one appears when loading the scalar overlay:

After loading lh.pial, the model node has one storage node, the model storage node.

When you select the scalar file (lh.thickness) to load onto the surface lh.pial, the scalar overlay reader invokes the models logic AddScalar. That calls AddAndObserveStorageNodeID before it calls read data on the scalar overylay storage node. At this point stepping through the code there are two storage node references on the storable node and all is correct. But then ReadData at the storage node superclass calls the ReadDataInternal and then calls SetAndObserveStorageNodeID which over writes the model storage node reference with the scalar overlay storage node id.

Changing the vtkMRMLStorageNode to use AddAndObserve instead of SetAndObserve, that goes through the newer reference management system which determines how many storage node references there are and adds to the end, witout checking if the currently passed storage node id exists in the list already. So just reading in the lh.pial surface ends up with 2 storage node ids, both vtkMRMLFreeSurferModelStorageNode1 (due to the combo of Add in the vtkMRMLStorageNode and Set in ModelsLogic AddModel(filename)). Adding the scalar overlay after that results in four storage node ids, two of the model storage node, two of the overlay storge node.

One solution: not add the observation in the models logic AddScalar but make sure that the storage node does use add, and make sure that AddAndObserve checks for the id existing already. Adding a check on HasNodeReferenceID in AddAndObserve and returning null if it's found gets things further and exposes the save bugs.

A question directed to people who have a better grasp on the new reference management system: can HadNodeReferenceID return -1 on failure, and the Nth value on success that we can pass to UpdateNthNodeReference? Does it even need to be updated at that point?

I need to do further testing on if changing the Set to an Add in the storage node with the duplicate check will have any side effects, see this commit:
https://github.com/naucoin/Slicer/commit/256c78cc5c5568c6869071d617c9262c950ce1fa

nicole

nicole

2015-12-09 12:13

administrator   ~0013671

When saving the correctly loaded scene, the FS model is set to save as a .vtk file but there are some missing pieces:

  • the model node isn't flagged as modified since read, that needs to be done when adding a scalar overlay
  • the storage nodes aren't updated for a regular model node (the .vtk will contain the scalar overlay information), I need to remove the FS scalar overlay node information for save (maybe flag them as not to save with scene?), make sure the .mrml file only has one storage node reference.
    It might be worth doing this on load since we don't have any FS surface writers.
nicole

nicole

2015-12-15 17:15

administrator   ~0013687

FreeSurfer lh.* test data uploaded to:
http://slicer.kitware.com/midas3/folder/2718

lassoan

lassoan

2017-06-14 17:03

developer   ~0014840

Fixed in r26092.

Issue History

Date Modified Username Field Change
2014-05-09 12:38 ogdenk New Issue
2014-05-09 12:38 ogdenk Status new => assigned
2014-05-09 12:38 ogdenk Assigned To => alexy
2014-05-12 06:05 nicole Note Added: 0011718
2014-05-12 06:05 nicole Assigned To alexy => nicole
2015-11-18 12:57 nicole Target Version => Slicer 4.5.1
2015-12-09 12:10 nicole Note Added: 0013670
2015-12-09 12:13 nicole Note Added: 0013671
2015-12-15 17:15 nicole Note Added: 0013687
2016-03-01 10:09 nicole Relationship added related to 0004143
2016-10-12 02:56 jcfr Target Version Slicer 4.5.1 => Slicer 4.7.0
2017-06-14 17:03 lassoan Status assigned => resolved
2017-06-14 17:03 lassoan Resolution open => fixed
2017-06-14 17:03 lassoan Fixed in Version => Slicer 4.7.0
2017-06-14 17:03 lassoan Note Added: 0014840
2018-03-02 11:01 jcfr Status resolved => closed