Can't save into "Slicer Data Bundle" mode

Operating system: Windows 10
Slicer version: 4.6.2 and nightly
Expected behavior: Should be able to save scene into “Slicer Data Bundle”
Actual behavior: Fails to save with error message: “Selected directory contains -2 files or directories. Please choose an empty directory.”

Some problems:
On windows, there is no . and … folders:
breaks are missing

Bonus: In the file name column, “.*” is enforced and wrongly suffixed onto the name.

I can’t replicate this.

Tried Windows 10, Slicer 4.6.2:

  • start fresh slicer
  • download MRHead
  • save data bundle
  • close scene
  • reload scene

No error messages or abnormal behavior.

Thanks for trying it out.

Do you choose “Slicer Data Bundle” and not “Medical Reality Bundle”?
Do you save into an empty folder ?

Medical Reality Bundle (.mrb) works well for me.
If I select the “Slicer Data Bundle (*)” option then I have the same issue.

Should we just remove the Slicer Data Bundle option?

Ah, no, I was using .mrb Medical Reality Bundle, the default. Right, if I
pick Slicer Data Bundle I see the same errors you reported.

Hate to ask, but why does this second mode even exist?

@pieper Great question. Look like the functionality was first added in

@jcfr yes, the save to MRB code is something I added.

But the code Julien pointed to is something he committed [1] and it really doesn’t look like my code…

I’m not even sure what use case qSclicerSceneWriter::writeToDirectory is
meant to support. The related issue it closes doesn’t really explain [2].

Anyway if that code path doesn’t work right and none of us use it we should
simplify things by retiring it.



qSlicerSceneWriter::writeToDirectory is mostly redundant:

  • If user saves the scene using the Save data dialog then saving as mrml or mrb should cover all use cases.
  • For single-click save operation for slicelets/custom applications we typically use applicationLogic.SaveSceneToSlicerDataBundleDirectory (it saves everything to a directory without creating a scene view and without zipping the results; see for example here).

As the method is not really needed, does not work correctly, and it would be difficult to make it robust and efficient (handle non-empty directory, overwriting files with the same name, etc), I think it would be a good idea to remove it (and the corresponding file format) from qSlicerSceneWriter.

I’m fine if such option is removed. No problem.