"Adding data failed" message when opening MRML file

I have gotten a handful of “adding data failed” “Adding data failed” messages lately when opening individual MRML Scene files.

The problematic Scene files would have been created with somewhat older versions of 3D Slicer, circa the second half of 2021.
I had a handful of these messages with
Slicer version: Slicer-4.13.0-2022-01-19
Operating system: Windows 10 Enterprise x64

I have just updated to
Slicer version: Slicer-4.13.0-2022-03-31
and got another of these error messages, as below:

image
And upon scrolling down:
image

I’m not sure what impact this has on what’s loaded. After I click OK, a whole lot of content (“data”?) is loaded, as I can see many objects in the Data module.
I don’t know whether this is caused by a defect in the process of originally creating the MRML file (or other files referred to therein), a defect in the operation of reading the file, or perhaps a problem with my recent installations of 3D Slicer. I don’t have an idea of how to troubleshoot it either.
I think all of the errors were practically the same, although I didn’t screenshot them all.

Further information:

  • Slicer is installed at E:\Program Files\Slicer 4.13.0-2022-03-31;
  • the MRML files are located on D:, several directories in, which I have mapped to O: to reduce the length of the path a bit; and
  • D:\D\P\S-0\[...] does not exist in my directory structure (maybe the statement in the error message isn’t supposed to be interpreted literally?).

—DIV

The errors mean that there are storage nodes in the scene without associated segmentation files. The messages may refer to orphan nodes that are left behind in the scene due to previous failed saving operations or incomplete node deletion operations.

There is currently no automatic cleanup mechanisms (such as deletion of orphan nodes), but I’ve added a feature request for it:

Possible workarounds:

  • Load all the data files instead of loading the scene file. This discards data that is stored in the scene file (relationship between nodes, display properties, etc).
  • Edit the scene file (.mrml) in a text editor: remove lines that refer to problematic nodes.

Hello, Andras.

Thanks for the suggestions.
Actually, a while after I posted, I had a further idea that might fit with what you’re describing.

You might remember a discussion about objects being created ‘immediately’ even when the Cancel button was pressed.
Maybe there was an empty segmentation called Segmentation already present, and I didn’t add any segments to it, because I instead created a new segmentation called (say) Body parts to contain the relevant segments.
Would that cause the behaviours described?

In that case a clean-up of the unwanted Segmentation node could be desirable. (Or perhaps producing a more low-key warning, rather than a hyped-up “error” message.)
But — if so — please keep in mind that the converse might also apply. Suppose I create one segmentation called Heart parts and then create several segments in it; then I create another segmentation called Lung parts, but before creating any segments in it I save the scene & all associated files, close 3D Slicer and go have lunch. When I come back and try to reload the scene file, I’ll expect to find the empty Lung parts segmentation; I wouldn’t want to get an error message, but nor would I like to find that an object I’ve expressly created has been covertly deleted.

Per your feature request, this might be a useful addition to the warning:

  • “Warning, empty nodes found”
  • specify details,
  • give user option to fix ‘problem’ by deleting unused node, or ignore once, or ignore always,

—DIV

If you can describe any specific scenario that produces invalid/orphan nodes (that cause errors after saving and loading the scene) then let us know and we should be able to fix it.

Empty nodes (e.g., markups without control points, segmentation without segments, empty segments, etc.) are not errors because these empty nodes are often used as templates. We don’t report them as errors. If you find that loading an empty node leads to a loading error then let us know.

The feature request was submitted to cover these. Feel free to add more details.

Thanks for the clarification. It seems that I misinterpreted the Github link preview, which literally mentioned “empty nodes”.

I have had a quick look inside one offending MRML file [my reference: 00102].

This node produced the reported error:
<Segmentation id="vtkMRMLSegmentationNode1" name="Segmentation" hideFromEditors="false" selectable="true" selected="false" references="display:vtkMRMLSegmentationDisplayNode1;referenceImageGeometryRef:vtkMRMLScalarVolumeNode1;storage:vtkMRMLSegmentationStorageNode1;" userTags="" MasterRepresentationName="Binary labelmap" segmentListFilterEnabled="false" segmentListFilterOptions="" ></Segmentation>

This node is OK, even though the encoding looks pretty much the same:
<Segmentation id="vtkMRMLSegmentationNode2" name="ContrastSegmentation" hideFromEditors="false" selectable="true" selected="false" references="display:vtkMRMLSegmentationDisplayNode2;referenceImageGeometryRef:vtkMRMLScalarVolumeNode1;storage:vtkMRMLSegmentationStorageNode2;" userTags="" MasterRepresentationName="Binary labelmap" segmentListFilterEnabled="false" segmentListFilterOptions="" ></Segmentation>

vtkMRMLSegmentationNode1 is only mentioned as above and here
<SubjectHierarchyItem id="181" dataNode="vtkMRMLSegmentationNode1" parent="3" type="Segmentations" expanded="true" attributes="VirtualBranch^1|"></SubjectHierarchyItem>

On the other hand, vtkMRMLSegmentationNode2 is mentioned as above and also within the SegmentEditor tag, and the ScriptedModule tag, and in
<SubjectHierarchyItem id="182" dataNode="vtkMRMLSegmentationNode2" parent="30" type="Segmentations" expanded="true" attributes="VirtualBranch^1|"> <SubjectHierarchyItem id="183" name="Rt ICA" parent="182" type="Segments" expanded="true" attributes="Level^VirtualBranch|segmentID^Segment_1|"></SubjectHierarchyItem> <SubjectHierarchyItem id="222" name="Confluence of sinuses" parent="182" type="Segments" expanded="true" attributes="Level^VirtualBranch|segmentID^Segment_2|"></SubjectHierarchyItem></SubjectHierarchyItem>
which shows the hierarchy of usage.

But still not sure what part of the encoding is producing an error, distinct from just an ‘empty’ node.

If scene loading reports errors then the issue is most likely in the segmentation storage nodes and not in the segmentation nodes.

I can only replicate the situation if I do the following:

  • Launch Slicer, load MRHead, go to Segment Editor module (auto-creates “Segmentation” node), create new segmentation as “MySegmentation”, add a segment and paint in the slice views. Then go to “Save Data” and choose to select all items since the “Segmentation” node was not checked to save. Save and then close Slicer.
  • From the saved location, delete the “Segmentation.seg.nrrd” file. Then launch Slicer, load the mrml scene and observe the same error as indicated by @DIV. In the Data module there is a “Segmentation” node, but it wasn’t the one actually saved as I had manually deleted that file from the saved location.
    image
    image

Thanks for providing a concrete series of steps to replicate the issue, James.

For the record, I can confidently say that I didn’t knowingly delete any *.seg.nrrd file(s); however, potentially it might have been corrupted or gone missing for some unknown reason. As I mentioned though, it seems to have been not only with one single patient: there were a handful for which I believe this happened, which makes me think it was something ‘systematic’.
I’m open to all possibilities: maybe 3D Slicer instructed the OS to write the file, but the OS didn’t obey, or it was blocked by an antivirus program that doesn’t trust *.seg.nrrd file(s) — not proposing those as explanations per se, just illustrating that I don’t know for sure it’s a 3D Slicer issue/bug.