Hi everyone,
I’m having discrepancies between the orientation matrix read from DICOMs or from a Nifti generated from the same DICOM series. I’d like to understand what is going on.
I have a DICOM series that I read in the normal way using the ImageSeriesReader:
itkreader = sitk.ImageSeriesReader()
dicom_names = itkreader.GetGDCMSeriesFileNames(r"C:\tmp\DICOM_series")
itkreader.SetFileNames(dicom_names)
itkImage = itkreader.Execute()
Then, I save this image as Nifti and MHD using a ImageFileWriter and I read again using a ImageFileReader. I get the following values for the matrices:
DICOM:
(0.0003620451755701781, -0.04382704694809889, -0.9990390677441499, 0.9967569623264217, -0.08037690612819795, 0.003887288909150347, -0.08047003775999609, -0.9958005537842747, 0.04365581411263355)
MHD:
(0.0003620451755701781, -0.04382704694809889, -0.9990390677441499, 0.9967569623264217, -0.08037690612819795, 0.003887288909150347, -0.08047003775999609, -0.9958005537842747, 0.04365581411263355)
Nifti:
(0.00036201611129199813, -0.0438270716099914, -0.9990390665949941, 0.9967569603844949, -0.08037693021218177, 0.0038872631696397915, -0.0804700619447843, -0.9958005507548984, 0.04365584270235757)
You may notice that MHD preserves the orientation matrix that was originally in the DICOM. However, the Nifti is changing the values. It’s usually from the 6th/7th decimal, but unfortunately registration tools such as elastix are sensitive to these changes and produce little differences in the final result (even while setting the Tolerance to 6 decimals).
Does anyone know how to preserve the same orientation in the Nifti ? Does ITK recomputes the affine matrix from the quaternions and this produces the differencesi in the matrices?
Thanks in advance!!
RaC