-
Notifications
You must be signed in to change notification settings - Fork 15
Linking it all together
johncolby edited this page Jan 14, 2011
·
18 revisions
Back to Table of Contents
The individual processing steps that we saw in Basic Workflow can be linked together into a core pipeline for along tract processing.
trkPath = fullfile(exDir, 'cst.trk'); volPath = fullfile(exDir, 'dti_fa.nii.gz'); [header tracks] = trk_read(trkPath); volume = read_avw(volPath);
tracks_interp = trk_interp(tracks, 50); tracks_interp = trk_flip(header, tracks_interp, [97 110 4]); tracks_interp_str = trk_restruc(tracks_interp); [header_sc tracks_sc] = trk_add_sc(header, tracks_interp_str, volume, 'FA'); [scalar_mean scalar_sd] = trk_mean_sc(header_sc, tracks_sc);
We can time these steps to get a feel for how long it might take if we were to scale up the process over many tracts and subjects.
profile on tic
trkPath = fullfile(exDir, 'cst.trk'); volPath = fullfile(exDir, 'dti_fa.nii.gz'); [header tracks] = trk_read(trkPath); volume = read_avw(volPath);
tracks_interp = trk_interp(tracks, 50); tracks_interp = trk_flip(header, tracks_interp, [97 110 4]); tracks_interp_str = trk_restruc(tracks_interp); [header_sc tracks_sc] = trk_add_sc(header, tracks_interp_str, volume, 'FA'); [scalar_mean scalar_sd] = trk_mean_sc(header_sc, tracks_sc);
toc profile viewer
Output:
Elapsed time is 3.764054 seconds.
Since most of the time is being spent fitting the splines and resampling the streamlines, we can get a nice boost in speed if we parallelize this step.
matlabpool 7 profile on tic
trkPath = fullfile(exDir, 'cst.trk'); volPath = fullfile(exDir, 'dti_fa.nii.gz'); [header tracks] = trk_read(trkPath); volume = read_avw(volPath);
tracks_interp = trk_interp(tracks, 50); tracks_interp = trk_flip(header, tracks_interp, [97 110 4]); tracks_interp_str = trk_restruc(tracks_interp); [header_sc tracks_sc] = trk_add_sc(header, tracks_interp_str, volume, 'FA'); [scalar_mean scalar_sd] = trk_mean_sc(header_sc, tracks_sc);
toc profile viewer matlabpool close
Output:
Elapsed time is 1.238922 seconds.
The processing modules that we’ve seen so far can form the core of a loop as we process many subjects and tracts. A bit of pseudo-code looks like this
loop over subjects
loop over tracts
loop over hemispheres
do along-tract processing steps
end
end
end
Back to Table of Contents
Back to Wiki Home