lncd MNI 2018 (grid size mismatch)

An fsl bug created 2mm and 2.3mm resampled MNI temples with an extra row of zero voxels in the image. (original 1mm was unmodified/unaffected). This off-by-one template was used for cog and PET Study. The correct MNI template is used for preprocessing 7T Magnetic Resonance Imaging and onward.

LNCD Tools's fixto1809c runs flirt to resample. But 3dresample might be sufficient (20240418WF) – the origin information within the nifti header is still correct: entering a x,y,z MNI coordinate in afni will jump to the same place in any of the template underlays – but with normal issues of a discrete grid.

The matrix i size for 2mm should be 97 but is 96 in 2mm, and for 2.3mm should be 83 but is 100. Similarly the left edge of the x coordinate in the image should be -96 but is -95 in 2mm and -95.45 in 2.3mm.

# 1mm -- actual MNI 2009c 
 3dinfo -n4 -extent /opt/ni_tools/standard/mni_icbm152_nlin_asym_09c/mni_icbm152_t1_tal_nlin_asym_09c.nii 
193  229  193  1     -96.0  96.0  -96.0  132.0  -78.0  114.0

# 2mm
3dinfo -n4 -extent /opt/ni_tools/standard{,_old}/mni_icbm152_nlin_asym_09c/mni_icbm152_t1_tal_nlin_asym_09c_2mm.nii |perl -slane 'print join("  ", map {$_=sprintf "%.0f", $_} @F)'
97  115  97  1     -96  96  -96  132  -78  114 # correct
96  114  96  1     -95  95  -95  131  -77  113 # lcnd off by one

# 2.3mm
 3dinfo -n4 -extent /opt/ni_tools/standard{,_old}/mni_icbm152_nlin_asym_09c/mni_icbm152_t1_tal_nlin_asym_09c_2.3mm.nii |perl -slane 'print join("  ", map {$_=/\./?sprintf("%.2f", $_):$_} @F)'|column -t
83  99   83  1    -96.00  92.60  -93.40  132.00  -78.00  110.60
84  100  84  1    -95.45  95.45  -95.85  131.85  -77.45  113.45

In afni, you can see the viewer move the crosshair (coordinate says the same) and mask when the underlay is changed.

And how it effects placement

3dresample sufficient

GOOD=/opt/ni_tools/standard/mni_icbm152_nlin_asym_09c/mni_icbm152_t1_tal_nlin_asym_09c_2.3mm.nii
 BAD=/opt/ni_tools/standard_old/mni_icbm152_nlin_asym_09c/mni_icbm152_t1_tal_nlin_asym_09c_2.3mm.nii
3dresample -inset $BAD -master $GOOD -overwrite -prefix mni_lncd_in_09c.nii.gz

3dBrickStat -max "3dcalc( -g $GOOD -b mni_lncd_in_09c.nii.gz -expr abs(g-b) )"
# 9.36876 # border

fixto1809c $BAD -out mni_lncd_in_09c_flirt.nii.gz
3dBrickStat -max "3dcalc( -g $GOOD -b mni_lncd_in_09c_flirt.nii.gz -expr abs(g-b) )"
# 9.36876  # border

3dcalc -g $GOOD -b mni_lncd_in_09c.nii.gz -expr 'abs(g-b)/g*100' -overwrite -prefix abs_g-b.nii.gz

afni -com 'SET_OVERLAY abs_g-b.nii.gz' -com 'SET_THRESHNEW A 1' -com 'SET_FUNC_RANGE .5' -com 'OPEN_WINDOW B.axialimage' -com 'SET_OVERLAY B.mni_lncd_in_09c.nii.gz' $GOOD mni_lncd_in_09c.nii.gz abs_g-b.nii.gz