Closed Jingnan-Jia closed 3 years ago
Hi,
Great point! The plan (https://github.com/Project-MONAI/MONAI/issues/856) is to have Image_Reader use ITK by default, and allow other readers to be used on demand.
The challenge is that until ITK 5.2, there were issues with supporting how some of the deep learning data was being stored (e.g., as 4D images instead of as 3D images with multiple channels) which was not well handled by ITK.
That has now been fixed in ITK, so hopefully we can re-start the refactoring of the I/O to provide a single, simple interface. I agree that right now it is hampering code portability and causing confusion.
@thewtex @hjmjohnson @Nic-Ma
Hi @Ordgod and @aylward ,
We already dropped NibabelReader
and PILReader
in master branch and will release in v0.5.
And I think @thewtex is working on some update on ITKReader
.
Thanks.
the new SaveImage
transform could answer most of the questions here https://github.com/Project-MONAI/MONAI/blob/4ef7d22daf4c9443469f7fa42f74ffec7aa613a5/monai/transforms/io/array.py#L167
I have the following questions:
ITKReader
, why do we still needNibabelReader
andPILReader
?ITKReader
can read nearly all kinds of images:Therefore, I think we do not need
NibabelReader
andPILReader
. If I am wrong, please let me know.The structure of code need to be improved. We have
image_reader.py
which includes several differentImageReaders
(ITKReader
,NibabelReader
,PILReader
andNumpyReader
). It loos good. And I expected that we should also have a correspondingimage_writer.py
and/orimage_saver.py
. However I can not find them in the same directory. I only findnifty_writer.py
,nifti_saver.py
,png_writer.py
andpng_saver.py
. I think nowthat we put all kinds ofImageReader
into oneimage_reader.py
file, why not put all correspondingImageSavers
into oneimage_saver.py
file?As described in the above paragraph, we have 4
Readers
:ITKReader
,NibabelReader
,PILReader
andNumpyReader
yet. And we only have 2ImageSavers
:NiftiSaver
andPNGSaver
. I feel confused on it. WhichReader
corresponds to whichSaver
? It seems thatNiftiSaver
usedNibabel
internally. So maybe we should replaceNiftiSaver
withNibabelSaver
? Similly, thePNGSaver
callsPIL
internally, so maybe thePNGSaver
should be called "PILSaver"? Then where is otherSavers
likeITKSaver
andNumpySaver
? Anyway we should have a more consistent names for these Reader/Savers.As described in the above paragraph, we have
NiftiSaver
. And from the name of thisSaver
I thought it could used to save images with extension of only '.nii' or '.nii.gz'. But actually, it can also be used to savenon-nifti
files like ".mha", right? If yes, then we need to change the name of thisSaver
.