I noticed it was taking 6-7 seconds to read in a wfile (scalar surface
overlay) into matlab using fast_read_wfile.m.  In case anybody else finds
this annoying, here's a faster alternative that produces identical output:

in fast_read_wfile.m, replace everything after the first fread line with:

vnum = fast_fread3(fid) ; % Number of non-zero values
A = uint32(fread(fid,vnum*7,'uchar'));
fclose(fid);

v = bitshift(A(1:7:end), 16) + bitshift(A(2:7:end),8) + A(3:7:end);
w0 = bitshift(A(4:7:end),24) + bitshift(A(5:7:end),16) +
bitshift(A(6:7:end),8) + A(7:7:end);

w = zeros(max(v),1);
w(v+1) = typecast(w0,'single');

-Keith
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

Reply via email to