SPM12 realignment modified_in_files

Hi,

I have an SPM12 nipype pipeline for fmri preprocessing. The pipeline executes spm.Realign(), with realign.inputs.register_to_mean = True, but I don’t want to reslice until the normalization step, after slice correction. I have tried two methods:

  1. fmripipeline.connect[(
    (realign, normalize, [(‘mean_image’, ‘image_to_align’)]),
    (slice_timing_correct, normalize, [(‘timecorrected_files’, ‘apply_to_files’)]),
    .
    .
    )]

and

2)fmripipeline.connect[(
(realign, normalize, [(‘modified_in_files’, ‘image_to_align’)]),
(slice_timing_correct, normalize, [(‘timecorrected_files’, ‘apply_to_files’)]),
.
.
)]

Both methods run without any errors, but neither applies the motion correction to the final warped image.

If anyone can offer some advice or help, it would be greatly appreciated.

Thanks very much.

you can take a look at this example. this has an extra coregistration step in between, but you will notice that it only estimates rather than estimates and writes. the same options are available to realign.

Thank you so much. I’ll have a look.

Thanks @satra, for offering the example. I have tried to use realign with only ‘estimate’ as a jobtype. Under that condition, it seems that if I input ‘realigned_files’ directly into the normalize node, then the warped file will be motion-corrected.

However, if I input ‘realigned_files’ into the slice-time correction node, and then connect to the normalize node, the warped file in not motion-corrected.

Also, using ‘estimate’ only as the jobtype for realignment, the mean image is no longer written out, which was previously used to estimate the alignment parameters in the normalization run.

Is there any other way to pass modified headers, without reslicing after realignment, to subsequent nodes successfully?

Thank you for your time.