Open dipterix opened 1 month ago
For immediate solution: align CT
to T1.nii.gz
. The CT will be aligned to FreeSurfer-generated T1 image. This image has consistent s/qform, which is identical to sform
of the ACPC realigned image.
Pipeline has been updated to force ACPC to have consistent s/qform. We might want to consider a better solution in the future once RAVE finishes up converting to native BIDS compliant.
https://github.com/rave-ieeg/rave-pipelines/commit/1f22ddf73ca77fec7a9c629e69c83778086acb03
A follow-up issue has been posted at https://github.com/ANTsX/ANTsPy/issues/356
It turns out if the input MRI has already been preprocessed with inconsistent s/qforms, then the pipeline will almost surely fail. Perhaps when importing images, the pipeline should automatically fix this inconsistency.
Quote from Slack channel:
This is because after ACPC realignment, the MRI_acpc will have two matrices in the header see Method 2: qform and Method 3: sform in NIfTI header specification
The imaging file
MRI_acpc
hasqform
remain unchanged as it should be voxel to original T1w RAS transformation.sform
is set to be voxel to ACPC realigned RAS.What happened was Freesurfer uses sform for reconstruction, and ANTs used qform for coregistration.
In FreeSurfer mailing archive, https://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg02870.html it states that when sform is valid, then fs recon-all prioritize sform.
For ANTs, it uses ITK as low-level engine according to this issue: https://github.com/ANTsX/ANTsPy/issues/434, and according to ITK mailing list https://itk.org/pipermail/insight-users/2017-March/054354.html, ITK was clearly using qform only. This is also consistent with my observation.
This is annoying as nifti specs doesn't seem to prioritize the s/q forms when they are inconsistent. SPM, FSL, FreeSurfer put sform > qform, while ANTs, ITK, ITKSnap all used qform only.