Closed hassaanmahmood closed 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'))`
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"
@ashutoshsoni891 I almost forget about this error. But as from my last reply, you can convert .img files to .nii files.
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