Import OsiriX ROI as segmentation

Hello,
I have ima files and their segmentation data as xml / rois_seris file formats. How can I import segmentations to 3D Slicer and create 3D models out of them? Are these file formats supported in the segmentation module?
Thanks,

Iā€™m not familiar with those formats. Any of the volume or model formats can be used to represent segmentations.

https://www.slicer.org/wiki/Documentation/4.10/SlicerApplication/SupportedDataFormat

Thank you for reply,
However, I could not import xml and rois_series segmentations into 3D Slicer. The segmentations that I want to import were created using Osirix. 3D Slicer doesnā€™t respond to these data. Is there any suggestions that I can implement to solve this problem.
Thank you !

Segmentation format of Osirix is really, really bad. I donā€™t know if the choice of proprietary file format and poor design is intentional (to lock in users so that they can only Osirix) or just for historical reasons, but anyway, the end result is that it is really hard to export the ROIs from Osirix. If you paid for Osirix then I would recommend to ask them that they provide segmentation export tools (e.g., to standard DICOM segmentation object).

There has been an attempt to write an importer module for Slicer, based on reverse engineering of native Osirix ROI files - see here: https://github.com/VASST/SlicerOsirix. @adamrankin whatā€™s the status of this extension? What can it do and what are its limitations?

Thank you for your quick reply, I will try your suggestion to solve the problem.

SlicerOsirix extension seems to be just an empty placeholder extension.

However, I gave it a try and was able to create a simple module to import OsiriX ROI to segmentation. It will be available for download tomorrow for Slicer Preview Release, in Sandbox extension. The module name is ā€œImport OsiriX ROIā€.

Give it a try and let me know if it works for you.

1 Like

That is great, thank you for your help. I will try and give feedback to you :slight_smile:

1 Like

Hello Dr Lasso,
I have installed and tried your module but acceptable input data type is just *json. I tried to convert xml file to json however ā€˜import OsiriX ROI moduleā€™ gave an error.

Could you please upload the xml and json file to somewhere (Dropbox, OneDrive, Google drive) and post the link?

Thank you, Iā€™ve added code to parse XML files, too. Iā€™ve only tested it with the data set you provided. You can get it from the extension manager tomorrow or download the updated file from here.

@lassoan Sorry mate, Iā€™m badly stuck for the past week trying to load Osirix xml to slicer. I know that because of the update to plistlib , the xml loading functionality seem to have stopped working in the sandbox extension. Iā€™ve tried converting the file to json and then importing it using sandbox extension, but it just crashes 3dSlicer, so I donā€™t get to see what causes the error. Iā€™m using slicer on linux
Iā€™ve tried writing my own code to just read the xml file and convert it to a mask with some success but the maskā€™s proportion is completely off.
Any chance you could look at the extension and see if you can revive it ?

Please provide an example file that does not load and Iā€™ll investigate.

1 Like

Thank you . iā€™ve attached the original xml and converted json

Iā€™ve made the Osirix ROI importer module more robust in latest Slicer Preview Release, so there should be no more errors.

However, for the example data set you provided there are some warnings because contours are missing on some frames.

Thatā€™s great ! I will switch to preview release ! really appreciate it

The updated extension will be available in the next Slicer Preview Release build (that you can download in about 10 hours).

1 Like

So Iā€™m assuming the importer module is the one in Sandbox extension; Iā€™ve downloaded the latest preview release, and added the sandbox extension, restarted the app; When i try to load the xml file I get the package error again : ā€œImport failed: module ā€˜plistlibā€™ has no attribute ā€˜readPlistā€™ā€. Any thoughts ?

It seems that no new Slicer Preview Release was built last night (probably because the new 5.6.1 patch release was being prepared) so the extension update is not yet available for the latest Slicer Preview Release.

The good news is that in the meantime a new Slicer Stable Release was created, so you can now use that. If you install Slicer-5.6.1 and thr Sandbox extension then it will include the fix.

The missing contours may cause problems - if you find that the contours are not aligned with the underlying image then let me know. I can tune the behavior further but then Iā€™ll need the input image, too (you can save the image as NRRD to remove all patient information from the image).

1 Like

Looks good so far, contours are aligned correctly . They come out like this though which is likely due to missing contours ?
Would it cause a problem when training with MONAI ?

Screenshot from 2023-12-13 11-50-54

MONAILabel requires labelmap representation, which probably need to have the same geometry as the input image. So, I would recommend to load the input image, choose as source volume in Segment Editor module, and review and touch up the segmentation as needed.

1 Like