Problems using ImportOsirixROI from the Sandbox extension

I’ve just had a conversation with Dr. Ron Summers from NCI, who has been trying to use the ImportOsirixROI function from the Sandbox extension. It is failing with the following error:

"[...]/AppData/Local/ 5.4.0/", line 284, in importOsirixRoiFileToSegmentation

[CRITICAL][Stream] 28.08.2023 11:25:17 [] (unknown:0) -     inputRoiData = plistlib.readPlist(inputRoi)

[CRITICAL][Stream] 28.08.2023 11:25:17 [] (unknown:0) - AttributeError: module 'plistlib' has no attribute 'readPlist'

I have never used that extension. Can someone from the Sandbox extension team help here? @lassoan is this something you maintain?

Just to provide some background, I’m trying to import a flood-filled segmentation from Osirix into Slicer, and then output the segmentation as a NIFTI file.

It appears the readPlist method was removed from plistlib as mentioned in the Python 3.9 release notes What’s New In Python 3.9 — Python 3.9.17 documentation after having being marked deprecated in Python 3.4. The load method is the new method plistlib — Generate and parse Apple .plist files — Python 3.9.17 documentation. This should be an easy upgrade to the new API.

Slicer upgraded to Python 3.9 back in January 2022, so it appears this SlicerSandbox code has been broken for well over 1.5 years now.

1 Like

I submitted the issue so this does not get lost.

@fedorov thanks for reporting and @jamesobutler thanks for the investigation.

@rsummers It may be a simple fix, but I would like to test it with your data to make sure that I use the new plistlib API correctly. Could you upload some anonymized test segmentation to somewhere and post the link here?

1 Like

I wonder if there is a temporary work around with and older version. I tried couple older version but none works.

Hi @lassoan, I’ve been attempting to update the script used to import Osirix ROIs to utilize the new plistlib methods (load and loads) in the relevant lines of code. Unfortunately this does not appear to be working when I run the script through the 3D slicer GUI, so I am wondering if you have made any progress on fixing this issue? The updated script I’ve tried is available here, in case it is helpful: GitHub - flickmatt/3D-Slicer

Thank you for your help.

Thanks for the update @mattflick. Could you provide an example file that I can test with? (I only seem to have .json files and not binary plist files)