We've discovered an issue with PyrexReader whereby using int(ImagePositionPatient[2]) incorrectly orders slices in both the image and mask.
At line 56:
scan.sort(key = lambda x: int(x.ImagePositionPatient[2])) # sort slices based on Z coordinate
We get incorrectly ordered CT slices (see attachment #1)
Replacing with:
scan.sort(key = lambda x: float(x.ImagePositionPatient[2])) # sort slices based on Z coordinate
And at line 110:
if np.int64(Cpostion_rt) == np.int64(img_vol[i].ImagePositionPatient[2]):
Replacing with:
if float(Cpostion_rt) == float(img_vol[i].ImagePositionPatient[2]):
we get correctly aligned slices for both the CT and the structure mask (see attachment #2)
This only happens for some CT data sets, still trying to figure out which factors lead to this. It's only visible if you put a line in at the end of PyrexReader to export the images/masks (or an image showing a slice through this). We've since added code to visualise the image/mask as it comes out of PyrexReader to review as a QA check.
Hi,
We've discovered an issue with PyrexReader whereby using int(ImagePositionPatient[2]) incorrectly orders slices in both the image and mask.
At line 56: scan.sort(key = lambda x: int(x.ImagePositionPatient[2])) # sort slices based on Z coordinate
We get incorrectly ordered CT slices (see attachment #1)
Replacing with: scan.sort(key = lambda x: float(x.ImagePositionPatient[2])) # sort slices based on Z coordinate
And at line 110: if np.int64(Cpostion_rt) == np.int64(img_vol[i].ImagePositionPatient[2]):
Replacing with: if float(Cpostion_rt) == float(img_vol[i].ImagePositionPatient[2]):
we get correctly aligned slices for both the CT and the structure mask (see attachment #2)
This only happens for some CT data sets, still trying to figure out which factors lead to this. It's only visible if you put a line in at the end of PyrexReader to export the images/masks (or an image showing a slice through this). We've since added code to visualise the image/mask as it comes out of PyrexReader to review as a QA check.
Cheers,
Nick