Hi, I was using
mne.transforms.apply_volume_registration to align CT and MRI.
I wonder if there is another quantified method that could help evaluate the quality of this alignment besides R2?
And also, the alignment result is always not good, any solution?
Hi, I was using
Yes, this is an ongoing issue: [BUG] MRI-CT alignment failure · Issue #2490 · dipy/dipy · GitHub, it appears that the CT with an MR is an alignment with many local minima to get stuck in.
You can try the ANTSpy version that is on the linked issue (above), that is the most reliable one I’ve found but only on Ubuntu, it works on MacOSX but just as poorly as Dipy on those hard cases with alignment failures.
Hope that helps!
Thank you for your help!
I found that in the issue you used
from dipy.align.imaffine import MutualInformationMetric
to compare the mutual info between bad_align_ct and good_align_ct, so can I suppose mutual info is a nice method to help us quantify the quality of the CT-MRI alignment?
I’ve tried ANTSpy, but still, 5/46 had a bad result. However, antspy is much faster for it’s using multi-threads. And I found If I used affine method to do alignment, the result is not good. Like this
This is the result from ANTSPY with ‘Affine’ transform. Here is a sample code
transform = 'Affine' mytx = ants.registration(fixed=t1, moving=ct, type_of_transform=transform) warped_ct = ants.apply_transforms(fixed=t1, moving=ct, transformlist=mytx['fwdtransforms'], interpolator='linear') warped_ct.set_direction(t1.direction) warped_ct.set_origin(t1.origin) warped_ct.set_spacing(t1.spacing) ants.image_write(warped_ct, os.path.join(root, subject, 'CT_aligned_ants_' + transform.lower() + '.nii'))
Does this mean normally Rigid is enough?
You really don’t want to use
Affine because that stretches and shears the image. If the subjects are the same (i.e. the MR and CT are from the same subject) that shouldn’t be necessary and should actually be detrimental because it will change the size and location of the electrode contacts. Hope that makes sense.
That does make sense! Thank you so much. After doing about 10 patients’ affine registration, none of the results is good.
Hey @BarryLiu97, you might be interested in the latest PR that just merged https://github.com/mne-tools/mne-python/pull/10298, it explains how to do manual alignment on the ones that fail and only takes ~2 minutes per patient of user interaction in my experience
Wow, that really helps！