Some images are lost after spm motion correction

My fMRI data collected 5 slices. After motion correction, the images of some slices were lost. Do you know the reason? Thank you for your help
original image:

Motion corrected image:

matlab code:
Do you know what caused the error? Thank you for your help

I suspect it is because when the participant move some voxels end up having no value for some time points and SPM masks those voxels: only voxels with a value for all time points will be kept.

You can try to not do this masking by toggling it off (though I would not recommend it).

See image below or set the roptions.mask to 0

hope this helps

Thanks for your help, I did solve the problem :blush:. In addition, I would like to ask you whether it is better to use AFNI for head motion correction for images with slice of 5? Thanks again for your help.

I would have no idea about that though: my AFNI-fu is quite limited.

I would not expect MASSIVE difference but I have said that many times in the past and been proven wrong…

  • it doesn’t matter Thanks again for your answer

In AFNI, all the results of 3dvolreg are put on the grid of the base dataset. All input datasets are assumed to have the same grid and coordinates too. Any motion more than a half voxel determined by 3D methods will clip the volumes on the ends. I think that’s something like the mask option in SPM Remi described. You can work around this by zeropadding the data first with 3dZeropad. In the end, the analysis will be complicated by voxels with only some of the time points. For these very small partial volumes, motion correction can be quite tricky, and you may either remove motion correction or restrict the correction to within slice only (2dImReg).

Within the full processing pipeline of, there are options for the output; the transformations from motion correction, alignment to an anatomical and transformation into the space of a standard template are all concatenated to transform the EPI data into a specific grid. The “extents” determine how it behaves for allowing edge clipping like this:

   -volreg_no_extent_mask  : do not create and apply extents mask

            default: apply extents mask

        This option says not to create or apply the extents mask.

        The extents mask:

        When EPI data is transformed to the anatomical grid in either orig
        or tlrc space (i.e. if -volreg_align_e2a or -volreg_tlrc_warp is
        applied), then the complete EPI volume will only cover part of the
        resulting volume space.  Worse than that, the coverage will vary
        over time, as motion will alter the final transformation (remember
        that volreg, EPI->anat and ->tlrc transformations are all combined,
        to prevent multiple resampling steps).  The result is that edge
        voxels will sometimes have valid data and sometimes not.

        The extents mask is made from an all-1 dataset that is warped with
        the same per-TR transformations as the EPI data.  The intersection
        of the result is the extents mask, so that every voxel in the
        extents mask has data at every time point.  Voxels that are not
        are missing data from some or all TRs.

        It is called the extents mask because it defines the 'bounding box'
        of valid EPI data.  It is not quite a tiled box though, as motion
        changes the location slightly, per TR.

        See also -volreg_align_e2a, -volreg_tlrc_warp.
        See also the 'extents' mask, in the "MASKING NOTE" section above.

Sorry, I just saw your reply. Thank you very much, your answer is very helpful, I have learned a lot of new knowledge through your answer. :blush: :blush: