FLIRT registration of T1w brain into MNI space results cropped and off-center

Hi everyone,

I’m trying to register a brain-extracted T1w image into MNI space using FLIRT. The output image results cropped and off-center and I’m not quite understanding why.

Here is the command I’m using:

flirt -in sub-1_ses-1_brain.nii.gz -ref /fsl/data/standard/MNI152_T1_1mm_brain.nii.gz -applyxfm -usesqform  -out sub-1_ses-1_reg.nii.gz

Here is the mrinfo output of my brain-extracted T1 image:

  Dimensions:        512 x 512 x 168
  Voxel size:        0.4688 x 0.4688 x 1
  Data strides:      [ 1 2 3 ]
  Format:            NIfTI-1.1 (GZip compressed)
  Data type:         32 bit float (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:               0.9928      0.1189     0.01212      -131.3
                          -0.1195      0.9877      0.1007       -58.7
                                0     -0.1014      0.9948      -53.34
  comments:          2203.8-dirty 2023-04-27T16:47:05+01:00

And here is the mrinfo of the MNI brain template I’m using:

  Dimensions:        182 x 218 x 182
  Voxel size:        1 x 1 x 1
  Data strides:      [ -1 2 3 ]
  Format:            NIfTI-1.1 (GZip compressed)
  Data type:         signed 16 bit integer (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:                    1           0           0         -91
                               -0           1           0        -126
                               -0           0           1         -72
  comments:          FSL3.3

Can you help me understand what the issue may be? Thanks.

Hi @Gus84, the command you are using is not performing a registration - all it is doing is resampling your T1 image into the MNI152 grid, aligning the two images based on their world coordinate system. To register your T1 image to the MNI152 (and also create a resampled copy), you can do something like this:

flirt -in sub-1_ses-1_brain.nii.gz                       \
      -ref /fsl/data/standard/MNI152_T1_1mm_brain.nii.gz \
      -omat t1_to_mni152.mat                             \
      -out sub-1_ses-1_reg.nii.gz

FLIRT is very sensitive to the starting estimate. You should use -usesqform when the header orientation information is roughly accurate (e.g. origin near the anterior commissure). When you initially convert DICOMs to NIfTI, the origin will be set to the magnet isocenter, which may or may not be near the anterior commissure depending on your MR technologist. In contrast, if you omit this FLIRT with use the center of brightness for the starting estimate. The latter fails when an image has excess signal from the neck and the shoulders.

@paulmccarthy and @neurolabusc thank you for your clues. I registered the T1w to MNI 152 as suggested by @paulmccarthy.

flirt -in sub-1_ses-1_brain.nii.gz -ref /fsl/data/standard/MNI152_T1_1mm_brain.nii.gz -omat t1_to_mni152.mat

At this point, if I just wanted to get a proper resampling and alignment, I think I could use something like this:

flirt -in sub-1_ses-1_brain.nii.gz -ref /fsl/data/standard/MNI152_T1_1mm_brain.nii.gz -applyxfm -init t1_to_mni152.mat -out sub-1_ses-1_res.nii.gz

Does it make sense? Thank you.

@Gus84 that’s correct - the first command calculates the registration, and then the second command applies the registration.