RuntimeError: affine matrix of all images should be the same for channel-wise concatenation. #8190
-
I have multiple patient folders that each contain a couple hundred 2D DICOM images. These images were taken in two acquisitions immediately after each other (where one acquisition is for odd slices, and the other for even), but together they form one 3D scan volume per patient. I am currently trying to use the LoadImage transform to load these into one 3D volume, however it gives me a runtime error stating that the affines are not the same. The affines that it returns because they are not equal look like this: 1st affine: 2nd affine: The only difference between these two are the 145.481944 and 145.134722 values. I dont know why these are not the same, and i dont know what to do right now. I dont think i can just make all the affines equal since that would be changing the data, but i also dont understand why they are not the same. The code im running that causes this is: Does anyone know how to help me with this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @JaroKuiken, when combining DICOM images from multiple acquisitions. Since your two sets of images (odd and even slices) are acquired in separate sequences, small variations in the affine matrices are not unusual. In this case, the difference is in the z-component of the third row, which likely reflects a slight offset in slice positioning. This could be due to scanner precision limits or timing differences between the acquisitions. |
Beta Was this translation helpful? Give feedback.
I ended up writing the custom ImageReader based on the ITK DicomSeriesReader example here: https://simpleitk.readthedocs.io/en/master/link_DicomSeriesReader_docs.html. This solved my issue!