We said maybe it was not worth looking into it, but I was just curious to find out the reason, so I invested few minutes.
I found out we are getting this error, because in the load_scan function, we are inferring slice thickness for some scans using the ImagePosition in the slice[0] and slice[1]:
For this particular patient, the position in the slice[0] and slice[1] are exactly the same. So we are obtaining thickness 0. This leads to an error in the resample step (dividing by 0)
In the resample step:
Maybe as a workaround solution, we can use slice[1] and slice[2] to infer the thickness .
We said maybe it was not worth looking into it, but I was just curious to find out the reason, so I invested few minutes. I found out we are getting this error, because in the load_scan function, we are inferring slice thickness for some scans using the ImagePosition in the slice[0] and slice[1]:
slice_thickness = np.abs(slices[0].ImagePositionPatient[2] - slices[1].ImagePositionPatient[2])
For this particular patient, the position in the slice[0] and slice[1] are exactly the same. So we are obtaining thickness 0. This leads to an error in the resample step (dividing by 0)
In the resample step:
Maybe as a workaround solution, we can use slice[1] and slice[2] to infer the thickness .