Closed MengyunQ closed 1 year ago
Indeed, there seems to have been an issue in ITK with multiprocessing and the image reader.
https://discourse.itk.org/t/itk-5-2-rc2-solved-a-multiprocessing-issue-thanks/3882
For .mha
(the file format we use), I am using specific MetaImage Python code to read images instead of SimpleITK actually. I was already thinking it may be good to replace SimpleITK with nibabel
maybe for NIfTI rather, which is also a more lightweight dependency than SimpleITK.
Would you be interested to try and support nibabel
instead as image reader for NIfTI files?
In Image.read()
to call a deepali.data.image.read_image()
function which returns a Grid
and data Tensor
. This new function could use nibabel
for file paths having a NIfTI extension, a different reader I have for .mha
(MetaImage) files, and otherwise fall back to using SimpleITK (deepali.utils.sitk.imageio.read_image()
).
You can also try with the latest SimpleITK version (2.2.1) first, or use itk>=5.2
instead.
SimpleITK 2.2.1 uses ITK 5.3, which should include the fix (https://github.com/SimpleITK/SimpleITK/releases/tag/v2.2.1).
Hi @MengyunQ, just to confirm, which version of SimpleITK were you using when you encountered this issue? Is the issue resolved when upgrading to SimpleITK 2.2?
I now implemented NIfTI image read/write functions using nibabel
as an alternative (#92). Just wondering if your issue was addressed already by a newer SimpleITK version.
Hi @MengyunQ, you noted that you were already using SimpleITK 2.2.1 when you encountered this issue. Have you been able to try the new deepali version with nibabel
instead of SimpleITK for reading NIfTI images in multiple processes? Did this resolve the issue?
I'm sorry for not getting back to you sooner. The SimpleITK version is 2.2.1 in my environment. I've tried running new experiments today in parallel, and the problem didn't occur. Thank you very much.
Great, thanks for giving it another try. Let me know if the issue re-occurs.
When I run several registration codes for a big dataset in parallel, it had this error:
RuntimeError: Exception thrown in SimpleITK ImageFileReader_ReadImageInformation: /tmp/SimpleITK/Code/IO/src/sitkImageReaderBase.cxx:105: sitk::ERROR: Unable to determine ImageIO reader for "seg_sa_36.nii.gz"
Would it be possible that the code had conflicts when Deepali was reading images at the same time? Because: