arnab39 / FewShot_GAN-Unet3D

Tensorflow implementation of our paper: Few-shot 3D Multi-modal Medical Image Segmentation using Generative Adversarial Learning
MIT License
377 stars 82 forks source link

.nii is mising from iSEG2017 dataset #6

Closed hassaanmahmood closed 5 years ago

hassaanmahmood commented 5 years ago

hi, I recently downloaded data. it does not contain .nii files. In preprocess.py I changed to pattern = '{0}/{1}/{3}/subject-{2}-{3}.img' from pattern = '{0}/{1}/{3}/subject-{2}-{3}.nii'

But later on I gain get error during unet training . ImageFileError: Cannot work out file type of "../data/iSEG_preprocessed/Training/label/subject-1-label.img" How to solve the issue from the beginning! or what else I can do further? Thanks

hassaanmahmood commented 5 years ago

I fix this issue by converting files to nii using nibable. `def list_files(directory, extension): return (f for f in os.listdir(directory) if f.endswith('.' + extension))

fname = '/home/hassan/Downloads/FewShot_GAN-Unet3D-master/data/iseg/Training/label/'
files = list_files(fname, "img") for file_name in files: print("Processing %s" % file_name) new_fname=os.path.join(fname, file_name) img = nb.load((new_fname)) nb.save(img, new_fname.replace('.img', '.nii'))`

ashutoshsoni891 commented 4 years ago

Hi @hassaanmahmood ! I tried your snippet, but unfortunately, it is not working. Could you please help me with the same , I am getting this error :

ImageFileError: Cannot work out file type of "/content/drive/My Drive/Data/Test/Test.img"

hassaanmahmood commented 4 years ago

@ashutoshsoni891 I almost forget about this error. But as from my last reply, you can convert .img files to .nii files.