Hi,
If the other image had the same voxel-world mapping before the
realignment (e.g. could be true for brain masks with longitudinal
structural data), then I think:
spm_get_space('Second.nii', spm_get_space('rFirst.nii'));
should be sufficient to copy over the new voxel-world mapping (backup
data before you try this though)
If the images had different voxel-world mappings, then, firstly, check
that it really makes sense to apply the same realignment parameters,
rather than estimating new ones. If so, then I think there are two
ways you could do this.
If you have access to a copy of the data *before* realignment, then
you can derive just the world-world realignment, and combine this with
the voxel-world mapping of the new (corresponding) data. Something
like this should work, I hope:
VW1 = spm_get_space('First.nii'); % the copy after realign
VW1orig = spm_get_space('First_orig.nii'); % the copy before realign
WW = VW1/VW1orig;
VW2orig = spm_get_space('Second.nii'); % the image to apply to
VW2 = WW*VW2orig;
spm_get_space('Second.nii', VW2);
Back things up before trying and let me know if it doesn't work -- I
haven't tested the above.
Otherwise, you need to reconstruct the WW matrix above from the text
file. I haven't really looked into this, but I think something like:
Q = load('rp_blah.txt');
for j=1:size(Q,1)
qq = Q(j, :);
WW = spm_matrix(qq);
VW2orig = spm_get_space(CORRESPONDING_jth_image)
VW2 = WW*VW2orig;
spm_get_space(CORRESPONDING_jth_image, VW2)
end
might do the trick... Good luck,
Ged
On 31/12/2007, JinSu Kim <[log in to unmask]> wrote:
> Dear SPMer
>
> I am SPM5 user
> I would like to apply realign parameter to another data.
>
> As you know, there are no "mat" file in SPM5.
> realign parameter was in text file
>
> How I can re-use realign parameter
>
> Happy New year !!
>
|