Coregistration of dwi mask and FLAIR in FSL

Hey,

I’m trying to coregister a stroke mask (created in IKT snap, MNI space 1 mm, non skull-stripped) with my Bianca WML mask (created with Bianca, ICBM 1.5 mm, skull-stripped), in order to subtract the stroke mask from my Bianca mask (so as to get an accurate WMH volume). The coregistration to ICBM of T1 and FLAIRs used was done through SPM, using Dartel pipeline.

I have tried anything I can think of using FSL flirt, from trying to take the stroke mask to 1.5, using the ICBM template and the matrix from the stroke mask (dwi), to trying to take the Bianca mask to 1 mm, using the MNI template and the matrix created from taking the T1/FLAIR through flirt to 1 mm as well. I have tried using -usesqform instead of the matrices. I have tried so many things.

Here I have tried to take the dwi stroke mask into MNI:
flirt -in sub-221476_dwi_mask.nii.gz -ref MNI152_T1_1mm.nii.gz -applyxfm -init sub-221476_dwi0000_flirt.mat -out DWI_MNI_first.nii.gz

Using fslhd I see that they are all always in the same (MNI) space, but still the stroke is not where it is supposed to be - it is about 1-2 cm off. Sometimes even more.

Any idea what is going on? And what I can do?

Thank you so much in advance,

Eva

To clarify, you should be generating the registration using the DWI to the reference (not the binary mask), then applying the registration matrix to the mask.

Ideally you could unweight the registration for the lesion location as well, since you already have that.

I do this a lot and prefer ANTs for this particular operation, since it allows the unweighting piece, which is important for large strokes, and corrects for a fair bit of the distortion. (The downside being that ANTs requires skull-stripped inputs)

Here are my scripts (nothing fancy, just scripting together existing tools):

and you could modify this script to go from DWI to T1w, instead of from T1w to MNI:

(as a sidenote, I try to register all the patient files to their T1w first, then trace the lesion, then I can apply the warps to MNI)…

Since you mention using SPM DARTEL, be aware that this will generate average sized brains, where as noted in the creation of the MNI template the MNI brain is a bit bigger than average. You can see this nicely in Figure 1 of Horn et al. (2018). One option would be to use the Clinical Toolbox for SPM to do this. You would include the T1 scan, the FLAIR (as the pathological scan) and the lesion map all in raw space. It will coregister the FLAIR image to the T1, and then apply the high dimensional DARTEL warping based on the enantiomorphically masked T1. The WMHs are likely not very visible in the T1, but if this is a chronic scan this will help ensure the unusual appearance of the lesion on the T1 does not disrupt DARTEL.

 -cost {mutualinfo,corratio,normcorr,normmi,leastsq,labeldiff,bbr}        (default is corratio)

If you do use flirt, you might want to try adjusting the cost function. The mutualinfo is inherently a good choice across modalities. Also, be aware that FLIRT only estimates linear transforms, so it will not be able to compensate for the nonlinear deformations applied by DARTEL.

Thank you so much both of you, but I’ve already tried the things you suggest.

It seems that FSL changes the coordinates of the dwi when transferring from IKTsnap. It’s very strange.

1.) With flirt you may want to be use the NIfTI header for a starting estimate:

    -usesqform                         (initialise using appropriate sform or qform)

2.) You may want to make sure your NIfTI header sform and form are identical. You can check this with fslhd. Most tools (e.g. SPM) give precedence to the sform (since matrices can store shears), but ITK/VTK based tools give precedence to the qform (since quaternions can not store shears, and since ITK/VTK require rectangular volumes this constrained representation matches the limitations of the software). A simple Python script can copy your qform to the sform, providing compatibility between tools. This is a good choice for MRI prior to normalization, as MRI scans are (in my experience) always rectangular volumes. Just be cautious applying this approach to CT scans where a gantry tilt was applied, as the shear is often substantial.