anjany / verse

Everything about the 'Large Scale Vertebrae Segmentation Challenge' @ MICCAI 2019-2020
MIT License
209 stars 49 forks source link

rescale_affine not found erorr #16

Open SAM-PCS opened 1 year ago

SAM-PCS commented 1 year ago

I am new to the vertebral segmentation. I am running your code i.e. prepare_data.ipynb . I have the following error when running resampling and reorientation.

I have pasted here the traceback. ( Althought nibable.affines has rescale_affine but it is giving error) Please help me to solve this.

AttributeError Traceback (most recent call last) in <cell line: 2>() 1 # Resample and Reorient data ----> 2 img_iso = resample_nib(img_nib, voxel_spacing=(1, 1, 1), order=3) 3 msk_iso = resample_nib(msk_nib, voxel_spacing=(1, 1, 1), order=0) # or resample based on img: resample_mask_to(msk_nib, img_iso) 4 ctd_iso = rescale_centroids(ctd_list, img_nib, (1,1,1)) 5

/content/drive/MyDrive/verse-main/utils/data_utilities.py in resample_nib(img, voxel_spacing, order) 106 shp[2] * zms[2] / voxel_spacing[2] 107 ]).astype(int)) --> 108 109 new_aff = nib.affines.rescale_affine(aff, shp, voxel_spacing, new_shp) 110 new_img = nip.resample_from_to(img, (new_shp, new_aff), order=order, cval=-1024)

AttributeError: module 'nibabel.affines' has no attribute 'rescale_affine'