Dear Stephan,
You can determine the affine transformation matrix from a set of
parameters using spm_matrix and you can apply a transformation to an
image using spm_get_space. This is what spm_realign does:
https://github.com/spm/spm12/blob/r7487/spm_realign.m#L161
There is a dedicated module in the batch interface to reorient images:
SPM > Util > Reorient Images
Best regards,
Guillaume.
On 08/10/2019 13:34, Heunis, J.S. wrote:
> Hi everyone
>
> I work with fMRI data and I am struggling with something that might be
> elementary (at least I hope it is). I would like to apply an affine
> transform, derived from a set of 6 movement realignment parameters, to a
> nifti image, or to the matrix data that is extracted from the nifti
> image (e.g. via sim_read_vols). The application is for multi-echo data:
> say I have 3 echoes per timepoint and I do realignment estimation and
> reslicing for the time series of the middle echo, and this results in a
> time series of per-volume realignment parameters (6DOF). I then want to
> compute the transform per timepoint and apply it to all timepoints of
> the other echoes.
>
> Has someone done this before and are there existing code examples? Or
> otherwise just a description of which inherent SPM12 functionality could
> be used for this?
>
> Thanks!
>
> Best regards,
>
> Stephan Heunis
> Eindhoven University of Technology
>
>
--
Guillaume Flandin, PhD
Wellcome Centre for Human Neuroimaging
UCL Queen Square Institute of Neurology
London WC1N 3BG
|