Home > track > feTrack.m

feTrack

PURPOSE ^

This function creates whole-brain white-matter connectome.

SYNOPSIS ^

function [status, results, fg, pathstr] = feTrack(trackingAlgorithm, dtFile,fibersFolder,lmax,nSeeds,wmMask)

DESCRIPTION ^

 This function creates whole-brain white-matter connectome.

 [status, results, fg, pathstr] = feTrack(trackingAlgorithm, dtFile,fibersFolder,[lmax],[nSeeds],[wmMask])

 Inputs:
  - dt6Dir - directory containing the dt6.mt file.
  - fibersFolder - folder to use to save all the fibers computed.
  - lmax - Max harmonic order. Default = 10.
  - nSeeds - number of seeds to use for mrtrix, this determines the final
             number of fibers.


 Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [status, results, fg, pathstr] = feTrack(trackingAlgorithm, dtFile,fibersFolder,lmax,nSeeds,wmMask)
0002 % This function creates whole-brain white-matter connectome.
0003 %
0004 % [status, results, fg, pathstr] = feTrack(trackingAlgorithm, dtFile,fibersFolder,[lmax],[nSeeds],[wmMask])
0005 %
0006 % Inputs:
0007 %  - dt6Dir - directory containing the dt6.mt file.
0008 %  - fibersFolder - folder to use to save all the fibers computed.
0009 %  - lmax - Max harmonic order. Default = 10.
0010 %  - nSeeds - number of seeds to use for mrtrix, this determines the final
0011 %             number of fibers.
0012 %
0013 %
0014 % Copyright (2013-2014), Franco Pestilli, Stanford University, pestillifranco@gmail.com.
0015 if notDefined('trackingAlgorithm'), trackingAlgorithm = {'tensor'};end
0016 if notDefined('dtFile'),            dtFile = ...
0017     '/biac2/wandell6/data/frk/LiFE/data/fp20120420/150dirs_b1000_1/dt6.mat';end
0018 if notDefined('wmMask'),            wmMask  = [];end
0019 if notDefined('fibersFolder'),      fibersFolder = ...
0020     '/azure/scr1/frk/150dirs_b1000_b2000_b4000/life_mrtrix_rep1';end
0021 if notDefined('lmax'),              lmax    = [8];end
0022 if notDefined('nSeeds'),            nSeeds  = 500000; end
0023   
0024 runInBackground = 0;
0025 verbose = 1;
0026   
0027 % make the fibers' folder if it does not exist
0028 if ~exist(fibersFolder,'dir'), system(sprintf('mkdir -v %s',fibersFolder)); end
0029 
0030 fprintf('\n\n[%s] Performing whole-brain tractograpy ...\n\n',mfilename);
0031 
0032 % Track with MRTRIX
0033 for il = 1:length(lmax)
0034   % This first step initializes all the files necessary for mrtrix.
0035   % This can take a long time.
0036   files           = mrtrix_init(dtFile, lmax(il),fibersFolder,wmMask);
0037   
0038   % MRTRIX - We run this first because it is fast.
0039   for ii = 1:length(trackingAlgorithm)
0040     % Track and save fibers using mrtrix
0041     [status, results, fg, pathstr] = mrtrix_track(files, files.brainmask, files.wm, switchAlgo(trackingAlgorithm{ii}), nSeeds, runInBackground, verbose);
0042   end
0043 end
0044 
0045 return
0046 
0047 %%%%%%%%%%%%%%%%%%%%%
0048 % Choose algorithm. %
0049 %%%%%%%%%%%%%%%%%%%%%
0050 function algo = switchAlgo(algo)
0051 % Gets the algorithm type for tracktography.
0052 %
0053 % Tracking algorithm:
0054 %
0055 % 1=prob, 2=stream, 3=tensor.
0056 %
0057 %
0058 % Copyright Franco Pestilli (2013) Vistasoft Stanford University.
0059 if isnumeric(algo) % from index to string
0060   switch algo
0061     case {1}
0062       algo = 'prob';
0063     case {2}
0064       algo = 'stream';
0065     case {3}
0066       algo = 'tensor';
0067     otherwise
0068       keyboard
0069   end
0070   
0071 elseif ischar(algo)
0072   switch algo
0073      case {'prob','probabilistic','mrtrix probabilistic'}
0074       algo = 'prob';
0075     case {'stream','streamline','deterministic', 'mrtrix deterministic'}
0076       algo = 'stream';
0077     case {'tensor','tensor based','mrtrix tensor based tractography'}
0078       algo = 'tensor';
0079     otherwise
0080       keyboard
0081   end
0082   
0083 else
0084   keyboard
0085 end

Generated on Wed 16-Jul-2014 19:56:13 by m2html © 2005