I have a folder with DICOM files inside (CT scan for example) and I need to extract affine information of the volume since I will produce a mask and need it later to align the volume and mask.
However the solution I have now is not optimal at all. I use the dicom2nifti package to first create a nifti file from the folder containing DICOM files and then I use nibabel to open the created nifti file. THEN I get affine info with
nii.affine (where nii is the loaded nifti file python object).
This is why, the creation of the nifti file is taking a LOT of time.
How can I get the affine matrix using python?