Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options for mrtrix_track_roi2roi parameters, that allow setting FA threshold, curvature threshold and length threshold #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions external/mrtrix/mrtrix_track_roi2roi.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [pdb_file, status, results] = mrtrix_track_roi2roi(files, roi1, roi2, seed, mask, mode, n, n_max, bkgrnd, verbose)

function [pdb_file, status, results] = mrtrix_track_roi2roi(files, roi1, roi2, seed, mask, mode, n, n_max, bkgrnd, verbose, varargin)
% ,fiber_length,fa_th,fa_th_init,curv_th,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want this line to be here

% Provided a csd estimate, generate estimates of the fibers starting in the
% seed region, touching both roi1 and roi2.
%
Expand All @@ -19,7 +19,13 @@
% defaults (which is 100 x n).
% bkgrnd: on unix, whether to perform the operation in another process
% verbose: whether to display stdout to the command window.
%
%
% the next parameters are optional, if not added or empty [], the default is used:
% fiber_length: maximum fiber length, if not added, set to 200 as in mrtrix default.
% fa_th: fa threshold, if not added, set to .1 as in mrtrix default.
% fa_th_init: fa initiation threshold, if not added, set to .2 as in mrtrix default.
% curv_th: curvature threshold, if not added, set to 1 or 2 as in mrtrix default.
%
% Franco, Bob & Ariel (c) Vistalab Stanford University 2013

if notDefined('verbose'),verbose = true; end
Expand All @@ -38,15 +44,55 @@
error('Input "%s" is not a valid tracking mode', mode);
end

% define mrtrix default parameters:
fiber_length=200;
fa_th=.1;
fa_th_init=2*.1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular intention with writing 0.2 as 2 * .1? I had to read this a couple of times to understand what this is supposed to be

switch mode_str
case {'SD_PROB'}
curv_th=2;
case {'SD_STREAM','DT_STREAM'}
curv_th=1;
end
% change mrtrix default if there is an entry:
if ~isempty(varargin)
if length(varargin)>=1
if ~isempty(varargin{1})
fiber_length=varargin{1};
end
end
if length(varargin)>=2
if ~isempty(varargin{2}),
fa_th=varargin{2};
end
end
if length(varargin)>=3
if ~isempty(varargin{3}),
fa_th_init=varargin{3};
end
end
if length(varargin)>=4
if ~isempty(varargin{4})
curv_th=varargin{4};
end
end
end

% disp parameters
disp(['tracking parameters: fiber length=' int2str(fiber_length) ', fa th=' num2str(fa_th),...
', fa init th=' num2str(fa_th_init) ', curv th=' num2str(curv_th)])

% Track, using deterministic estimate:
tck_file = strcat(strip_ext(files.csd), '_' , strip_ext(roi1), '_', strip_ext(roi2), '_', ...
strip_ext(seed) , '_', strip_ext(mask), '_', mode, '.tck');

% Generate a UNIX command string.
switch mode_str
case {'SD_PROB', 'SD_STREAM'}
cmd_str = sprintf('streamtrack -seed %s -mask %s -include %s -include %s %s %s %s -number %d -maxnum %d -stop',...
seed,mask, roi1, roi2, mode_str, files.csd, tck_file, n, n_max);
cmd_str = sprintf(['streamtrack -seed %s -mask %s -include %s -include %s %s %s %s -number %d -maxnum %d -stop', ...
' -length %d -cutoff %g -initcutoff %g -curvature %d'],...
seed,mask, roi1, roi2, mode_str, files.csd, tck_file, n, n_max,...
fiber_length,fa_th,fa_th_init,curv_th);
% The following lines of code could be intergated here, to allow for
% tracking between ROIs using a tensor-based deterministic tractography
% case {'DT_STREAM'}
Expand Down