I am using SimpleITK to read 3D-CT scans from DICOM folders. My scans can belong to any of 3 views: axial, coronal, and sagittal. I did like this:
import SimpleITK as sitk
dicom_names = sitk.ImageSeriesReader().GetGDCMSeriesFileNames(<path_to_dcom_folder>)
img = sitk.ReadImage(dicom_names)
I would like to know the view of the image to standardize them into the axial view. When I read this Fundamental Concepts, I think that ImageDirection can reflect the view so I try to observe this attribute:
In most of the cases, the corresponding direction of:
- Axial: (1,0,0,0,1,0,0,0,1)
- Coronal: (1,0,0,0,0,1,0,-1,0)
- Sagittal: (0,0,-1,1,0,0,0,-1,0)
However, it is not consistent. Sometimes, Sagittal view has direction of
(1,0,0,0,1,0,0,0,1) as well.
Is there any attribute from ITK image read from dicom series reflecting the view of the image?
Please see the
[DICOMOrientImageFitler](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1DICOMOrientImageFilter.html). Specifically the
[GetOrientationFromDirectionCosines](https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1DICOMOrientImageFilter.html#acaf19fac35023e3da9ba3eb56190ada0) method. It can be use like:
In : sitk.DICOMOrientImageFilter_GetOrientationFromDirectionCosines(np.ravel(np.eye(3)))
Thanks, I am using SimpleITK version 1.2.4 and it doesn’t have
DICOMOrientImageFilter_GetOrientationFromDirectionCosines. Which version are you using?
This functionality is available in the current version of simpleitk, 2.0.1. I highly recommend updating your version as there have been many upgrades and bug fixes to the toolkit. There were also API changes so you may have to modify your existing code base (see migration guide for details).