Dear Hiroyuki,
here is another script example for collecting the realignment parameter from the separate text files into one text file for an easy overview and to analyze with a statistical package, like spss.
kind regards,
Christoph
%Start
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
studydir = 'Y:\fmri';
scanids = {'subj001','subj002','subj003','subj004','subj005'};
fid=fopen(fullfile(studydir,'rp_report.txt'),'w');
fprintf(fid,'Scan|Session|max_abs_trans|max_abs_rot|max_scan_trans|max_scan_rot|mean scan_trans|mean_scan_rot|var_scan_trans|var_scan_rot\n');
for subj = 1:length(scanids)
path= fullfile(studydir, scanids{subj});
%%%%%%%%%%
% collect movementparameter
% max global movement, max/mean/sd movement between volumes
%%%%%%%%%%
disp(['rp_report: ' scanids{subj}]);
for session = 1:2
rp_file = dir(fullfile(path,'nifti_raw',['session' num2str(session)], 'rp_*.txt'));
rp = load(fullfile(path, 'nifti_raw',['session' num2str(session)],rp_file.name));
rp(:,4:6) = rp(:,4:6)*180/pi;
max_abs_trans = max(max(rp(:,1:3))-min(rp(:,1:3)));
max_abs_rot = max(max(rp(:,4:6))-min(rp(:,4:6)));
d = abs(diff(rp));
max_scan_trans = max(max(d(:,1:3)));
max_scan_rot = max(max(d(:,4:6)));
mean_scan_trans = mean(mean(d(:,1:3)));
mean_scan_rot = mean(mean(d(:,4:6)));
var_scan_trans = max(var(d(:,1:3)));
var_scan_rot = max(var(d(:,4:6)));
fprintf(fid,['%-s|%-s' repmat('|%-2.4f',1,8) '\n'], scanids{subj}, num2str(session), max_abs_trans, max_abs_rot, max_scan_trans,max_scan_rot, mean_scan_trans, mean_scan_rot, var_scan_trans,var_scan_rot);
end;
end;
fclose(fid);
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%End
Am 26.08.2011 08:29, schrieb Marko Wilke:
>
> Dear Hiroyuki,
>
> the realignment parameters are saved in simple text files, which you can open in any way you want. The first three columns represent the shifts, the last three the rotation (in radians). If you want degrees, you need to convert them first. I posted a script to recreate the plots shown by spm some time ago, which may give you some clues, at https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1102&L=SPM&P=R54409&I=-3&d=No+Match%3BMatch%3BMatches
>
> Hope this helps,
> Marko
>
> Hiroyuki AKAMA wrote:
>> Dear SPM users
>>
>> Please forgive me if my question is too basic. It would be much
>> appreciated if someone could let me know how to get and save the matrix
>> for the timecourse of each of the 6 head motion parameter values (min
>> for a translation and degree for a rotation) using some m files of SPM8,
>> that is, the numerical data of the graphs displayed for Image realignment.
>>
>> Best wishes
>>
>> Hiroyuki AKAMA
>> Associate Professor, Graduate School of Decision Science and Technology
>> Tokyo Institute of Technology,
>> W9-10, O-okayama, Meguro-ku, Tokyo-152-8552
>> Japan
--
Dipl.-Ing. Christoph Berger
Universität Rostock
Zentrum für Nervenheilkunde
Klinik und Poliklinik für Psychiatrie und Psychotherapie
Gehlsheimer Straße 20
18147 Rostock
Tel.: +49 381-494-4966
Fax: +49 381-494-9502
[log in to unmask]
www.kpp.med.uni-rostock.de
|