How to spatially normalize individual structural images in SPM?

I preprocessed fMRI data in SPM following these steps (Coregistration - SPM Documentation), but found only the functional images were normalized. The structural images were unchanged.

I want to use structural images as underlays and statistical maps as overlays to see the individual activation. Therefore, I need a structural image that is aligned to the functional image and has been spatially normalized. How can I achieve this?

Also, could you provide the standard segment and normalization code in SPM? I found some code on the internet, but they are very different. I don’t know which one is correct.

Thank you!

taken from the block design example from the SPM website:

script: https://www.fil.ion.ucl.ac.uk/spm/data/auditory/auditory_spm12_batch.m

The batch number 4 normalizes the functional data.
The batch 5 normalizes the bias corrected anatomical (m prefix).

% Normalise: Write
%--------------------------------------------------------------------------
matlabbatch{4}.spm.spatial.normalise.write.subj.def      = cellstr(spm_file(a,'prefix','y_','ext','nii'));
matlabbatch{4}.spm.spatial.normalise.write.subj.resample = cellstr(f);
matlabbatch{4}.spm.spatial.normalise.write.woptions.vox  = [3 3 3];

matlabbatch{5}.spm.spatial.normalise.write.subj.def      = cellstr(spm_file(a,'prefix','y_','ext','nii'));
matlabbatch{5}.spm.spatial.normalise.write.subj.resample = cellstr(spm_file(a,'prefix','m','ext','nii'));
matlabbatch{5}.spm.spatial.normalise.write.woptions.vox  = [1 1 3];

HTH

1 Like

Thank you very much!

To standardize structural images, the code selects files starting with ‘m’ generated during segmentation and applies the transformations (which are identical to those applied to functional images) to them. However, the ‘m’-prefixed files here are not aligned with functional images, since the coregistration stage only estimates without saving results and the segmentation stage operates on the original structural images (prefixed with ‘s’). So, if same transformations are applied using the ‘m’-prefixed files as inputs, wouldn’t the result be not aligned with functional images?

This has been quite confusing, and I’d greatly appreciate your help in clarifying this.

% Coregister
% -- > align anat to functional
%--------------------------------------------------------------------------
matlabbatch{2}.spm.spatial.coreg.estimate.ref    = cellstr(spm_file(f(1,:),'prefix','mean'));
matlabbatch{2}.spm.spatial.coreg.estimate.source = cellstr(a);

% Segment
% --> segment the anatomical which is now aligned with functional, so the output will be aligned as well
%--------------------------------------------------------------------------
matlabbatch{3}.spm.spatial.preproc.channel.vols  = cellstr(a);
matlabbatch{3}.spm.spatial.preproc.channel.write = [0 1];
matlabbatch{3}.spm.spatial.preproc.warp.write    = [0 1];

% Normalise: Write
% --> normalize functional and bias corrected anat using the deformation field generated during segmentation
%--------------------------------------------------------------------------
matlabbatch{4}.spm.spatial.normalise.write.subj.def      = cellstr(spm_file(a,'prefix','y_','ext','nii'));
matlabbatch{4}.spm.spatial.normalise.write.subj.resample = cellstr(f);
matlabbatch{4}.spm.spatial.normalise.write.woptions.vox  = [3 3 3];

matlabbatch{5}.spm.spatial.normalise.write.subj.def      = cellstr(spm_file(a,'prefix','y_','ext','nii'));
matlabbatch{5}.spm.spatial.normalise.write.subj.resample = cellstr(spm_file(a,'prefix','m','ext','nii'));
matlabbatch{5}.spm.spatial.normalise.write.woptions.vox  = [1 1 3];

since the coregistration stage only estimates without saving results and the segmentation stage operates on the original structural images (prefixed with ‘s’).

not quite

remember that coregistration DOES change the transformation matrix in the header of the file without generating a new file

Thank you! It’s so kind of you.

If ‘estimate’ is chosen in the co-registration step, SPM won’t alter the values of each voxel in the original files but will store the transformation matrix within them. Subsequent ‘normalize’ operations will automatically retrieve this matrix for further processing.

However, selecting ‘write’ in co-registration means SPM doesn’t write the transformation matrix but directly alters each voxel’s value using ‘reslice.’

Is my understanding correct?

Additionally, during structural image processing, multiple files are generated: five files with names start with ‘c’ (c1-c5), one with name starts with ‘m,’ and one with name starts with ‘y.’ Do you know what these files represent and in what scenarios they will be used?

yup

prefix meaning
m bias corrected image
c[123] tissue probability map for 1 grey matter, 2 white matter, 3 csf (sometimes combined to create a mask used to skullstrip the brain)
y deformation field to normalize to MNI space
iy ‘inverse’ deformation field to go from MNI space to the original space of the anatomical

Thank you very much!