# Import OsiriX ROI as segmentation

**URL:** <https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719>\
**Category:** Support\
**Tags:** feature, segmentation, dicom\
**Created:** [March 17, 2020, 2:10pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719 "2020-03-17T14:10:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![esrasmr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/esrasmr/32/6318_2.png) [@esrasmr](https://discourse.slicer.org/u/esrasmr)\
**Post date:** [March 17, 2020, 2:10pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/1 "2020-03-17T14:10:56Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 18, 2020, 12:28am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/2 "2020-03-18T00:28:08Z")

</div>

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](https://www.slicer.org/wiki/Documentation/4.10/SlicerApplication/SupportedDataFormat)

---

<div class="post-metadata">

**Author:** ![esrasmr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/esrasmr/32/6318_2.png) [@esrasmr](https://discourse.slicer.org/u/esrasmr)\
**Post date:** [March 23, 2020, 9:20am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/3 "2020-03-23T09:20:47Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 23, 2020, 2:36pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/4 "2020-03-23T14:36:17Z")

</div>

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](https://github.com/VASST/SlicerOsirix). @adamrankin what’s the status of this extension? What can it do and what are its limitations?

---

<div class="post-metadata">

**Author:** ![esrasmr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/esrasmr/32/6318_2.png) [@esrasmr](https://discourse.slicer.org/u/esrasmr)\
**Post date:** [March 23, 2020, 8:50pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/5 "2020-03-23T20:50:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 24, 2020, 12:58am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/6 "2020-03-24T00:58:41Z")

</div>

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”.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/0/a00ff25ed54d64508bb14aa3790f2dc35afd0aec.png)

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

---

<div class="post-metadata">

**Author:** ![esrasmr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/esrasmr/32/6318_2.png) [@esrasmr](https://discourse.slicer.org/u/esrasmr)\
**Post date:** [March 24, 2020, 12:17pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/7 "2020-03-24T12:17:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![esrasmr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/esrasmr/32/6318_2.png) [@esrasmr](https://discourse.slicer.org/u/esrasmr)\
**Post date:** [March 25, 2020, 11:57am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/8 "2020-03-25T11:57:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 25, 2020, 12:34pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/9 "2020-03-25T12:34:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 25, 2020, 3:36pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/11 "2020-03-25T15:36:50Z")

</div>

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](https://github.com/PerkLab/SlicerSandbox/blob/master/ImportOsirixROI/ImportOsirixROI.py).

---

<div class="post-metadata">

**Author:** ![sfat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfat/32/66469_2.png) [@sfat](https://discourse.slicer.org/u/sfat)\
**Post date:** [December 11, 2023, 8:29am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/12 "2023-12-11T08:29:34Z")

</div>

@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 ?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 11, 2023, 1:24pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/13 "2023-12-11T13:24:11Z")

</div>

Please provide an example file that does not load and I’ll investigate.

---

<div class="post-metadata">

**Author:** ![sfat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfat/32/66469_2.png) [@sfat](https://discourse.slicer.org/u/sfat)\
**Post date:** [December 11, 2023, 10:48pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/14 "2023-12-11T22:48:00Z")

</div>

Thank you . i’ve attached the original xml and converted json

> **[example.zip](https://wetransfer.com/downloads/4de1abb66ea354119609530f9878486f20231211224741/cd88d7)**
>
> 1 file sent via WeTransfer, the simplest way to send your files around the world

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 12, 2023, 4:13am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/15 "2023-12-12T04:13:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sfat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfat/32/66469_2.png) [@sfat](https://discourse.slicer.org/u/sfat)\
**Post date:** [December 12, 2023, 4:28am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/16 "2023-12-12T04:28:46Z")

</div>

> [@lassoan](#):
>
> wever, 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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 12, 2023, 4:43am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/17 "2023-12-12T04:43:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sfat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfat/32/66469_2.png) [@sfat](https://discourse.slicer.org/u/sfat)\
**Post date:** [December 12, 2023, 10:30pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/18 "2023-12-12T22:30:37Z")

</div>

> [@lassoan](#):
>
> Osirix ROI importer module

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 ?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 12, 2023, 11:04pm UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/19 "2023-12-12T23:04:51Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![sfat](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sfat/32/66469_2.png) [@sfat](https://discourse.slicer.org/u/sfat)\
**Post date:** [December 13, 2023, 12:53am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/20 "2023-12-13T00:53:23Z")

</div>

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](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/7/07d325f70037d8cda4ef8ead61c40d06d7254373.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 13, 2023, 1:31am UTC](https://discourse.slicer.org/t/import-osirix-roi-as-segmentation/10719/21 "2023-12-13T01:31:10Z")

</div>

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.
