June 03, 2010

SPM2 Gem 7: Extracting realignment parameters

The referenced script is here save_parameters.m

Subject: Re: [SPM] realignment parameter
From: John Ashburner <john@FIL.ION.UCL.AC.UK>
Date: Fri, 23 Apr 2004 11:25:27 +0000 (07:25 EDT)
To: SPM@JISCMAIL.AC.UK

> I have switched from spm99 to spm2 and am learning new things.
> When I realign images interactively with GUI interface,
> the rp*.txt file is created. However, the parameter file
> is not created - or, I cannot find it -, when I realign
> with a batch script.
> I am sure I left out something, but I don't know it.
> Any suggestion will be very appreciated.

If you call spm_realign with output (left-hand) arguments, then no rp_*.txt
file is saved.  You could create a save_parameters.m file, containing:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function save_parameters(V)
fname = [spm_str_manip(prepend(V(1).fname,'rp_'),'s') '.txt'];
n = length(V);
Q = zeros(n,6);
for j=1:n,
        qq     = spm_imatrix(V(j).mat/V(1).mat);
        Q(j,:) = qq(1:6);
end;
save(fname,'Q','-ascii');
return;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

and derive the values from your realigned images:

    P = spm_get(Inf,'*.IMAGE','Select realigned images');
    save_parameters(spm_vol(P))

Best regards,
-John

- No comments Not publicly viewable


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

Search this blog

Tags

Most recent comments

  • I love this quote: "Complete reporting of results, i.e. filing of statistical maps in public reposit… by Kevin Black on this entry
  • Taylor: I've just quickly scanned the BrainVoyager documentation, and it appears that the Cluster–Le… by Thomas Nichols on this entry
  • Cindy, I can see you didn't like my comments but I didn't get based on what you deemed them outrageo… by Yolanda on this entry
  • Thomas, Could you comment on the applicability of your findings to BrainVoyager's Cluster–Level Stat… by Taylor on this entry
  • Here is a sample of recent corrections from PNAS, collated by Mike Angstadt. Correction for Crockett… by Thomas Nichols on this entry

Blog archive

Loading…
Not signed in
Sign in

Powered by BlogBuilder
© MMXXI