FSL

### PROBTRACKX - probabilistic tracking

For details about probabilistic tractography as implemented by FDT, see here, and for details about crossing fibre modelling in FDT, see Behrens et al, NeuroImage 2007, 34(1):144-55.
Briefly, FDT repetitively samples from the distributions on voxel-wise principal diffusion directions, each time computing a streamline through these local samples to generate a probabilistic streamline or a sample from the distribution on the location of the true streamline. By taking many such samples FDT is able to build up the posterior distribution on the streamline location or the connectivity distribution. The local diffusion directions are calculated using bedpostx, which allows modelling multiple fibre orientations per voxel.

After bedpostx has been applied it is possible to run tractography analyses using probtrackx.

To call the FDT GUI, either run Fdt, or run fsl and press the FDT button. Use the top left drop down menu to select PROBTRACKX.

PROBTRACKX GUI has two main sections:

- Seed Space
- Optional Targets

Also, probtrackx requires the specification of a bedpostX directory. This directory must contain the following images:
- merged_th<i>samples
- merged_ph<i>samples
- merged_f<i>samples
- nodif_brain_mask
(Note that users of previous versions of FDT can still use probtrackx on the old bedpost directories. In this case, the above files are called `merged_thsamples`, etc.)

As explained below, results from probtrackx can be binned in any available space -e.g., diffusion space, structural space or standard space. Note, however, that tractography itself ALWAYS takes place in diffusion space - it is simply the results of probtrackx that are stored in the required space. If probtrackx results are to be stored in a space other than diffusion space then you will need transformations from this space back into the space of the diffusion data.
You can use the FDT registration tab to create the required transformations, which will all be stored in the `xfms` subdirectory of the bedpostX directory.
Probtrackx can take either linear (FLIRT) or nonlinear (FNIRT) transformations. In the latter case, both forward (diffusion to seed space) and backward (seed space to diffusion) transformations are needed. Eg:

For running analyses in structural space:

- Linear: xfms/str2diff.mat
- Nonlinear: xfms/str2diff_warp and xfms/diff2str_warp

For running analyses in standard space:

- Linear: xfms/standard2diff.mat
- Nonlinear: xfms/standard2diff_warp and xfms/diff2standard_warp

### Overview

PROBTRACKX involves generating connectivity distributions from user-specified seed voxel(s). The output will be a single image in the space of the specified seed like this. All brain voxels will have a value (though many of these will be zero) representing the connectivity value between that voxel and the seed voxel (i.e., the number of samples that pass through that voxel). Note that when connectivity distributions are generated from multiple seed voxels within a region of interest then the time required for the analysis to run will be approximately the number of seed voxels multiplied by the time taken to generate a distribution from a single voxel. probtrackx also allows to specify targets for the tractography. These can either be inclusion/exclusion masks, or targets for seed classification based on connectivity.

### Seed specification - prologue

A common feature for all seed specification modes is the ability to provide the seed in another space than the diffusion space. If seed space is not diffusion, then check the corresponding button. Set the transformation matrix from seed space to diffusion space (e.g., subject1.bedpostX/xfms/str2diff.mat if seed space is structural space or subject1.bedpostX/xfms/standard2diff.mat if seed space is standard space, or the forward and backward warpfields if using nonlinear registration). Note that, in all cases, the smaller the voxel size in your seed space image, the lower will be the resulting connectivity values to these voxels (This is intuitive - the smaller a voxel is, the less chance that the true streamline will pass through it!). This highlights the problem with binning a continuous distribution into meaningless discrete bins. In order for the probability values to be truly meaningful, the discrete bins chosen should be anatomically meaningful, as is the case when using classification targets.

#### Single voxel

Generates a connectivity distribution from a single, user-specified voxel.

GUI Options:
Seed reference image Use the browse button to locate a reference image (e.g., subject1.bedpostX/struct.nii.gz if seed space is structral space or subject1.bedpostX/standard.nii.gz if seed space is standard space).
Seeds: Enter the x,y,z co-ordinates of a single seed voxel. Use the buttons to the right to specify whether the co-ordinates are given in voxels or millimetres. Note if the "seed space is not diffusion" is set, and the seed space reference image is the MNI152 average brain, then mm coordinates will have their origin at the AC.

The output will be a single image in the space of the specified seed. All brain voxels will have a value (though many of these will be zero) representing the connectivity value between that voxel and the seed voxel (i.e., the number of samples that pass through that voxel). The example on the right shows the connectivity distribution from a single seed in the internal capsule overlaid on an FA image. Note that when the seed space is a single voxel, the classification targets in the Optional Targets tab is turned off.

#### Single mask

Generates a connectivity distribution from a user-specified region of interest.

GUI Options:
Seed image: Use the browse button to locate the seed image. Probabilistic tractography will be run from every voxel with a value different than 0 in this mask.

The output directory will contain:
probtrackx.log - a text record of the command that was run.
fdt.log - a log of the setup of the FDT GUI when the analysis was run. To recover this GUI setup, type `Fdt fdt.log`
fdt_paths - a 3D image file containing the output connectivity distribution to the seed mask.
waytotal - a text file containing a single number corresponding to the total number of generated tracts that have not been rejected by inclusion/exclusion mask criteria.
The output connectivity distribution file will be a single image in the space of the specified seed mask. All brain voxels will have a value (though many of these may be zero) representing the number of samples that pass through that voxel from the seed mask. Connectivity distributions from multiple seed voxels are summed to produce this output. Therefore the connectivity values will depend on the number of voxels in the seed mask.

#### Multiple masks

Generates a connectivity distribution between a group of seed masks. This option repeatedly samples tracts from every seed mask in a list, and retains only those tracts that pass through at least one of the other seed masks. The output is the sum of the connectivity distributions from each of the seed masks.

GUI Options:
Masks list: Use the add button to locate each seed mask. Seed masks should all be in the same space (e.g., diffusion, structural or standard space). When all masks are loaded you can press the save list button to save the list of masks as a text file. If you already have a text file list of required seed masks (including their path) then you can load it with the load list button.

The output directory will contain:
probtrackx.log - a text record of the command that was run.
fdt.log - a log of the setup of the FDT GUI when the analysis was run. To recover this GUI setup, type `Fdt fdt.log`
fdt_paths - a 3D image file containing the output connectivity distribution.
waytotal - a text file containing one number per seed mask (in the order that has been specified when listing them). These numbers correspond to the total number of generated tracts from each seed mask that have reached at least one of the other masks and have not been rejected by inclusion/exclusion mask criteria.
The output file will be a single image in the space of the specified masks. All brain voxels will have a value (though many of these may be zero) representing the number of samples that pass through that voxel from either of the seed masks and which also pass through at least one of the other seedmasks. Connectivity distributions from multiple seed voxels are summed to produce this output. Therefore the connectivity values will depend on the number of voxels in the seed masks.

### Including targets for tractography - rationale

probtrackx allows you to include target masks for any tractography experiment.
Very Important: Every target mask must be in the same space as the seed masks (or the reference image in the case of a single voxel mode).
Targets can be waypoint masks (a.k.a. inclusion masks), for selecting only tracts passing through particular points in the brain; exclusion masks, for excluding tracts passing through parts of the brain; termination masks, for forcing tracts to stop whenever they reach a certain area; or classification target masks for connectivity-based seed classification. All these targets are optional.

#### Waypoint masks

Use inclusion masks in the tractography. Tracts that do not pass through ALL these masks will be discarded from the calculation of the connectivity distribution.
The example on the right shows the outputs from two different analyses which use the same seed mask (orange) but different waypoint masks (red).
Use the add and remove buttons to make a list of waypoint masks.
Note that the criterion to keep a streamline here is to pass through ALL the waypoint masks in the list. If you need an OR condition, i.e. you want to keep streamlines that pass through at least one of the waypoint masks, then first add all these masks with fslmaths and include the result as a single waypoint mask:
`fslmaths mywaypoint1 -add mywaypoint2 -add ... myORwaypoint`

#### Exclusion mask

If an exclusion mask is to be used then check the box and use the browse button to locate the mask file. Pathways will be discarded if they enter the exclusion mask. For example, an exclusion mask of the midline will remove pathways that cross into the other hemisphere.

#### Termination mask

If a termination mask is to be used then check the box and use the browse button to locate the mask file. Pathways will be terminated as soon as they enter the termination mask. The difference between an exclusion and a termination mask is that in the latter case, the tract is stopped at the target mask, but included in the calculation of the connectivity distribution, while in the former case, the tract is completely discarded. (Note that paths are always terminated when they reach the brain surface as defined by nodif_brain_mask)

#### Classification targets

When using classification targets, probtrackx will quantify connectivity values between a seed mask and any number of user-specified target masks. This option is only active when the seed mask is a single mask. In the example on the right, seed voxels in the thalamus are classified according to the probability of connection to different cortical target masks.
Use the add button to locate each target mask. Targets must be in the same space as the seed mask. When all targets are loaded you can press the save list button to save the list of targets as a text file. If you already have a text file list of required targets (including their path) then you can load it with the load list button.
The output directory will contain a single volume for each target mask, named seeds_to_{target} where {target} is replaced by the file name of the relevant target mask. In these output images, the value of each voxel within the seed mask is the number of samples seeded from that voxel reaching the relevant target mask. The value of all voxels outside the seed mask will be zero.

There are command line utilities that can be run on these outputs:

- proj_thresh - for thresholding some outputs of probtrackx
- find_the_bigggest - for performing hard segmentation on the outputs of probtrackx, see example on the right

### Options Tab

Before running probtrackx, the user is able to change the setting of certain parameters by clicking the options tab.

Number of samples (default 5000): This determines the number of individual pathways (or samples) that are drawn through the probability distributions on principle fibre direction (see appendix for more details on the modelling and tractography methods). By default this is set to 5000 as we are confident that convergence is reached with this number of samples. However, reducing this number will speed up processing and can be useful for preliminary or exploratory analyses.

Curvature Threshold (default 0.2): We limit how sharply pathways can turn in order to exclude implausible pathways. This number is the cosine of the minimum allowable angle between two steps. By default this is set to 0.2 (corresponding to a minimum angle of approximately ±80 degrees). Adjusting this number can enable pathways with sharper angles to be detected.

Verbose: If this option is selected then FDT prints additional logging information to screen while it is running.

Loopcheck: By default, we terminate pathways that loop back on themselves -i.e paths that travel to a point where they have already been.

#### Advanced options:

Use modified Euler streamlining: Use modified Euler integration as opposed to simple Euler for computing probabilistic streamlines. More accurate but slower.

Maximum number of steps (default 2000): By default, samples are terminated when they have travelled 2000 steps. Using a step length of 0.5mm this corresponds to a distance of 1m. These values can be adjusted if required.

Step length (default 0.5mm): This determines the length of each step. This setting may be adjusted from default e.g., depending on the voxel size being used, or if tracking is being performed on different sized brains (e.g., infants or animals).

Use anisotropy to constrain tracking: Use this option if you want the fractional anisotropic volumes (stored in merged_f<i>samples) to influence the tractography. The tracts stop if the anisotropy is lower than a random variable between 0 (low anisotropy) and 1 (high anisotropy).

Use distance correction: This option corrects for the fact that connectivity distribution drops with distance from the seed mask. If this option is checked, the connectivity distribution is the expected length of the pathways that cross each voxel times the number of samples that cross it.