I was reviewing the code for spm_apply_uw and noticed a significant amount of time is taken up by spm_write_plane. The code (lines 332-334) seem to loop and write separately each plane:
for ii=1:PO.dim(3)
PO = spm_write_plane(PO,ivol(:,:,ii),ii);
end
This results in 8352 fx calls for a total of 33s.
However, this seems unreasonable inefficient. In fact, it is much faster to write the entire volume per:
PO = spm_write_plane(PO,ivol,':');
Matlab profiler indicates the code above results in 174 fx calls, for a total of 3s, 1/10 the time.
Is there any inherent reason why NOT do do it this faster way?
Thanks,
Colin
--
Colin L. Sauder, M.S.
Doctoral Candidate
Interim Assistant Director
Krasner Psychological Center
Department of Psychology
Stony Brook University
Stony Brook, NY 11794-2520
Phone: (631) 306-4096
Fax: (631) 632-4632