I haven't tried this with SPM8 yet but in general the following code
should do the trick:
P1 and P2 should have equal length! If your reference image has no
coresponding image in the images to correct either set the reference
image manually or change the loop to go from 2:n_images(1) (in this case
you need to change the last two lines as well: (P2(n,:)) --> (P2(n-1,:))
P1 = spm_select(Inf,'image','Select realigned images, first image is
reference');
V1 = spm_vol(P1);
P2 = spm_select(Inf,'image','Select images to copy movement parameters to');
rM = spm_vol(V1(1)); %here you can set the reference image manually, if
n_images = size(P1);
for n = 1:n_images(1)
%x = spm_imatrix(V1(n).mat/V1(1).mat);
%M = (spm_matrix(x));
M = V1(n).mat/rM;
MM = spm_get_space(P2(n,:));
spm_get_space(P2(n,:), M*MM);
end
On 01/29/2010 06:54 AM, Mark Daglish wrote:
> Hi,
>
> I want to try to implement in SPM8 something I used to do back in the
> old days of SPM99. I want to generate realignment parameters from a
> time-series of images and apply them to another time-series of images.
>
> Basically I have two time-series of images acquired simultaneously, one
> with a lot more anatomical information in them than the other. I used to
> use these images to generate realignment parameters (that used to be
> saved in the matching *.mat files). I would then copy the *.mat files
> across to the other images and then reslice.
>
> Now that the realignment movement parameters are stored in the header of
> the NIfTI images, I am not sure how to do this. I can try hacking the
> code, but wanted to see if this wheel had already been invented for SPM8.
>
> Many thanks for any help.
>
> mark
>
> *******Dr Mark Daglish********* I Senior Lecturer in Addiction
> Psychiatry******** I The University of Queensland School of Medicine l K
> Floor, Mental Health Centre, Royal Brisbane & Women's Hospital, Herston
> QLD 4029 l ( +61 7 3365 5142 l M +61 408 771 591 I 7 +61 7 3365 5488 l :
> [log in to unmask] <mailto:[log in to unmask]> I 8 www.som.edu.au I
> CRICOS Provider No: 00025B
>
--
Dr. med. Benjamin Bender
Abteilung Diagnostische und Interventionelle Neuroradiologie
Universitätsklinikum Tübingen
Hoppe-Seyler- Str. 3
72076 Tübingen
Tel. (07071) 29-85397
|