Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The names of different Savers/Writers are not consistent #1560

Closed
Jingnan-Jia opened this issue Feb 7, 2021 · 3 comments
Closed

The names of different Savers/Writers are not consistent #1560

Jingnan-Jia opened this issue Feb 7, 2021 · 3 comments
Labels
question Further information is requested

Comments

@Jingnan-Jia
Copy link

Jingnan-Jia commented Feb 7, 2021

I have the following questions:

  1. Now that we have ITKReader, why do we still need NibabelReader and PILReader?

ITKReader can read nearly all kinds of images:

Medical formats:

ITK MetaImage (.mha/.raw, .mhd)
Neuroimaging Informatics Technology Initiative (NIfTI) (.nia, .nii, .nii.gz, .hdr, .img, .img.gz)
Analyze (plain, SPM99, SPM2) (.hdr/.img, .img.gz)
Digital Imaging and Communications in Medicine (DICOM) (.dcm, .dicom)
Digital Imaging and Communications in Medicine (DICOM) series (/)
Nearly Raw Raster Data (Nrrd) (.nrrd, .nhdr)
Medical Imaging NetCDF (MINC) (.mnc, .MNC)
Guys Image Processing Lab (GIPL) (.gipl, .gipl.gz)
Microscopy formats:

Medical Research Council (MRC) (.mrc, .rec)
Bio-Rad (.pic, .PIC)
LSM (Zeiss) microscopy images (.tif, .TIF, .tiff, .TIFF, .lsm, .LSM)
Stimulate / Signal Data (SDT) (.sdt)
Visualization formats:

VTK images (.vtk)
Other formats:

Portable Network Graphics (PNG) (.png, .PNG)
Joint Photographic Experts Group (JPEG) (.jpg, .JPG, .jpeg, .JPEG)
Tagged Image File Format (TIFF) (.tif, .TIF, .tiff, .TIFF)
Windows bitmap (.bmp, .BMP)
Hierarchical Data Format (HDF5) (.h5 , .hdf5 , .he5)
MSX-DOS Screen-x (.ge4, .ge5)

Therefore, I think we do not need NibabelReader and PILReader. If I am wrong, please let me know.

  1. The structure of code need to be improved.
    We have image_reader.py which includes several different ImageReaders(ITKReader, NibabelReader, PILReader and NumpyReader). It loos good. And I expected that we should also have a corresponding image_writer.py and/or image_saver.py. However I can not find them in the same directory. I only find nifty_writer.py, nifti_saver.py, png_writer.py and png_saver.py. I think nowthat we put all kinds of ImageReader into one image_reader.py file, why not put all corresponding ImageSavers into one image_saver.py file?

  2. As described in the above paragraph, we have 4 Readers: ITKReader, NibabelReader, PILReader and NumpyReader yet. And we only have 2 ImageSavers: NiftiSaver and PNGSaver. I feel confused on it. Which Reader corresponds to which Saver? It seems that NiftiSaver used Nibabel internally. So maybe we should replace NiftiSaver with NibabelSaver? Similly, the PNGSaver calls PIL internally, so maybe the PNGSaver should be called "PILSaver"? Then where is other Savers like ITKSaver and NumpySaver? Anyway we should have a more consistent names for these Reader/Savers.

  3. As described in the above paragraph, we have NiftiSaver. And from the name of this Saver I thought it could used to save images with extension of only '.nii' or '.nii.gz'. But actually, it can also be used to save non-nifti files like ".mha", right? If yes, then we need to change the name of this Saver.

@Jingnan-Jia Jingnan-Jia changed the title The name of different Savers/Writer are not consistent The name of different Savers/Writers are not consistent Feb 7, 2021
@Jingnan-Jia Jingnan-Jia changed the title The name of different Savers/Writers are not consistent The names of different Savers/Writers are not consistent Feb 8, 2021
@aylward
Copy link
Collaborator

aylward commented Feb 8, 2021

Hi,

Great point! The plan (#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

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Feb 8, 2021

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.

@Nic-Ma Nic-Ma added the question Further information is requested label Feb 8, 2021
@wyli
Copy link
Contributor

wyli commented May 13, 2021

the new SaveImage transform could answer most of the questions here

class SaveImage(Transform):

@wyli wyli closed this as completed May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants