We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
u can try to run following codes if u meet the same problems:
#coding = utf-8 import os import shutil import nibabel as nb srcdir = r'C:\Users\xxx\Desktop\iSeg-2017-Training' destdir = r'C:\Users\xxx\Desktop\DataNii' os.chdir(srcdir) for filename in os.listdir(): if (os.path.splitext(filename)[1] == '.img'): img = nb.load(filename) nb.save(img, filename.replace('.img', '.nii')) if (os.path.splitext(filename)[1] == '.nii'): shutil.move(filename, destdir) print("done")
import nibabel as nib import numpy as np import os path = r"C:\Users\xxx\Desktop\DataNii\Validation\GT" os.chdir(path) dict = {0: 0, 10: 1, 150: 2, 250: 3} for file in os.listdir(path): gt = nib.load(file).get_fdata() shape = gt.shape gt = gt.reshape(-1) for i in range(len(gt)): gt[i] = dict[gt[i]] gt = gt.reshape(shape) img_gt = nib.Nifti1Image(gt, np.eye(4)) nib.save(img_gt, file) print("done")
The text was updated successfully, but these errors were encountered:
No branches or pull requests
u can try to run following codes if u meet the same problems:
The text was updated successfully, but these errors were encountered: