Closed fepegar closed 4 years ago
Wouldn't it be easier to use Nibabel (and/or SITK) to do file writes and avoid writing Nifti-specific header information, which would also give support for DICOM, MINC, etc.? Any conversion issues could be pushed upstream to Nibabel.
(To answer my own question: Nibabel doesn't yet support NRRD)
NiBabel doesn't support NRRD. But you're right, It would be simpler to use SITK in general.
At least, write_nifti
could be generalized to write_nibabel
.
Exactly. DICOM support will be trickier, especially for writing. But maybe SITK can try to handle it.
We're crossing messages, sorry. Maybe a good approach is trying to write the image with nibabel and falling back to SITK if it fails.
Sounds reasonable, especially with an option to override.
an option to override.
I'm not sure what you mean with this.
an option to override.
I'm not sure what you mean with this.
You might prefer SITK even if Nibabel can technically read your file, e.g. due to some bug/edge case in format support, or you might care about IO performance and find SITK is faster, etc.
@bcdarwin, can you take a look at #92 and let me know what you think?
Sure, I'll look into this in a bit.
Code to write NRRD files is missing: https://github.com/fepegar/torchio/blob/128895a88cdb1165f8b8533e11835a6b1db12b8c/torchio/data/io.py#L83-L88