Home · Quickstart · Documentation · Citation · NiPy

# interfaces.mrtrix.tracking

## DiffusionTensorStreamlineTrack

Link to code

Wraps command streamtrack

Specialized interface to StreamlineTrack. This interface is used for streamline tracking from diffusion tensor data, and calls the MRtrix function ‘streamtrack’ with the option ‘DT_STREAM’

### Example

    >>> import nipype.interfaces.mrtrix as mrt
    >>> dtstrack = mrt.DiffusionTensorStreamlineTrack()
    >>> dtstrack.inputs.in_file = 'data.Bfloat'
    >>> dtstrack.inputs.seed_file = 'seed_mask.nii'
    >>> dtstrack.run()

Inputs:

    [Mandatory]
    gradient_encoding_file: (an existing file name)
            Gradient encoding, supplied as a 4xN text file with each line is in the format [ X Y Z b
            ], where [ X Y Z ] describe the direction of the applied gradient, and b gives the
            b-value in units (1000 s/mm^2). See FSL2MRTrix
    in_file: (an existing file name)
            the image containing the source data.The type of data required depends on the type of
            tracking as set in the preceeding argument. For DT methods, the base DWI are needed. For
            SD methods, the SH harmonic coefficients of the FOD are needed.
    terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
            Control terminal output

    [Optional]
    args: (a string)
            Additional parameters to the command
    cutoff_value: (a float)
            Set the FA or FOD amplitude cutoff for terminating tracks (default is 0.1).
    desired_number_of_tracks: (an integer)
            Sets the desired number of tracks.The program will continue to generate tracks until
            this number of tracks have been selected and written to the output file(default is 100
            for *_STREAM methods, 1000 for *_PROB methods).
    do_not_precompute: (a boolean)
            Turns off precomputation of the legendre polynomial values. Warning: this will slow down
            the algorithm by a factor of approximately 4.
    environ: (a dictionary with keys which are a value of type 'str' and with values which
             are a value of type 'str', nipype default value: {})
            Environment variables
    exclude_spec: (a list of from 4 to 4 items which are an integer)
            exclusion specification in voxels and radius (x y z r)
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the interface fails to
            run
    include_spec: (a list of from 4 to 4 items which are an integer)
            inclusion specification in voxels and radius (x y z r)
    initial_cutoff_value: (a float)
            Sets the minimum FA or FOD amplitude for initiating tracks (default is twice the normal
            cutoff).
    initial_direction: (a list of from 2 to 2 items which are an integer)
            Specify the initial tracking direction as a vector
    inputmodel: ('DT_STREAM' or 'SD_PROB' or 'SD_STREAM', nipype default value: DT_STREAM)
            input model type
    mask_spec: (a list of from 4 to 4 items which are an integer)
            Mask specification in voxels and radius (x y z r). Tracks will be terminated when they
            leave the ROI.
    maximum_number_of_tracks: (an integer)
            Sets the maximum number of tracks to generate.The program will not generate more tracks
            than this number, even if the desired number of tracks hasn't yet been reached(default
            is 100 x number).
    maximum_tract_length: (a float)
            Sets the maximum length of any track in millimeters (default is 200 mm).
    minimum_radius_of_curvature: (a float)
            Set the minimum radius of curvature (default is 2 mm for DT_STREAM, 0 for SD_STREAM, 1
            mm for SD_PROB and DT_PROB)
    minimum_tract_length: (a float)
            Sets the minimum length of any track in millimeters (default is 10 mm).
    no_mask_interpolation: (a boolean)
            Turns off trilinear interpolation of mask images.
    out_file: (a file name)
            output data file
    seed_spec: (a list of from 4 to 4 items which are an integer)
            seed specification in voxels and radius (x y z r)
    step_size: (a float)
            Set the step size of the algorithm in mm (default is 0.2).
    stop: (a boolean)
            stop track as soon as it enters any of the include regions.
    unidirectional: (a boolean)
            Track from the seed point in one direction only (default is to track in both
            directions).

Outputs:

    tracked: (an existing file name)
            output file containing reconstructed tracts

## ProbabilisticSphericallyDeconvolutedStreamlineTrack

Link to code

Wraps command streamtrack

Performs probabilistic tracking using spherically deconvolved data

Specialized interface to StreamlineTrack. This interface is used for probabilistic tracking from spherically deconvolved data, and calls the MRtrix function ‘streamtrack’ with the option ‘SD_PROB’

### Example

    >>> import nipype.interfaces.mrtrix as mrt
    >>> sdprobtrack = mrt.ProbabilisticSphericallyDeconvolutedStreamlineTrack()
    >>> sdprobtrack.inputs.in_file = 'data.Bfloat'
    >>> sdprobtrack.inputs.seed_file = 'seed_mask.nii'
    >>> sdprobtrack.run()

Inputs:

    [Mandatory]
    in_file: (an existing file name)
            the image containing the source data.The type of data required depends on the type of
            tracking as set in the preceeding argument. For DT methods, the base DWI are needed. For
            SD methods, the SH harmonic coefficients of the FOD are needed.
    terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
            Control terminal output

    [Optional]
    args: (a string)
            Additional parameters to the command
    cutoff_value: (a float)
            Set the FA or FOD amplitude cutoff for terminating tracks (default is 0.1).
    desired_number_of_tracks: (an integer)
            Sets the desired number of tracks.The program will continue to generate tracks until
            this number of tracks have been selected and written to the output file(default is 100
            for *_STREAM methods, 1000 for *_PROB methods).
    do_not_precompute: (a boolean)
            Turns off precomputation of the legendre polynomial values. Warning: this will slow down
            the algorithm by a factor of approximately 4.
    environ: (a dictionary with keys which are a value of type 'str' and with values which
             are a value of type 'str', nipype default value: {})
            Environment variables
    exclude_spec: (a list of from 4 to 4 items which are an integer)
            exclusion specification in voxels and radius (x y z r)
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the interface fails to
            run
    include_spec: (a list of from 4 to 4 items which are an integer)
            inclusion specification in voxels and radius (x y z r)
    initial_cutoff_value: (a float)
            Sets the minimum FA or FOD amplitude for initiating tracks (default is twice the normal
            cutoff).
    initial_direction: (a list of from 2 to 2 items which are an integer)
            Specify the initial tracking direction as a vector
    inputmodel: ('DT_STREAM' or 'SD_PROB' or 'SD_STREAM', nipype default value: DT_STREAM)
            input model type
    mask_spec: (a list of from 4 to 4 items which are an integer)
            Mask specification in voxels and radius (x y z r). Tracks will be terminated when they
            leave the ROI.
    maximum_number_of_tracks: (an integer)
            Sets the maximum number of tracks to generate.The program will not generate more tracks
            than this number, even if the desired number of tracks hasn't yet been reached(default
            is 100 x number).
    maximum_number_of_trials: (an integer)
            Set the maximum number of sampling trials at each point (only used for probabilistic
            tracking).
    maximum_tract_length: (a float)
            Sets the maximum length of any track in millimeters (default is 200 mm).
    minimum_radius_of_curvature: (a float)
            Set the minimum radius of curvature (default is 2 mm for DT_STREAM, 0 for SD_STREAM, 1
            mm for SD_PROB and DT_PROB)
    minimum_tract_length: (a float)
            Sets the minimum length of any track in millimeters (default is 10 mm).
    no_mask_interpolation: (a boolean)
            Turns off trilinear interpolation of mask images.
    out_file: (a file name)
            output data file
    seed_spec: (a list of from 4 to 4 items which are an integer)
            seed specification in voxels and radius (x y z r)
    step_size: (a float)
            Set the step size of the algorithm in mm (default is 0.2).
    stop: (a boolean)
            stop track as soon as it enters any of the include regions.
    unidirectional: (a boolean)
            Track from the seed point in one direction only (default is to track in both
            directions).

Outputs:

    tracked: (an existing file name)
            output file containing reconstructed tracts

## SphericallyDeconvolutedStreamlineTrack

Link to code

Wraps command streamtrack

Performs streamline tracking using spherically deconvolved data

Specialized interface to StreamlineTrack. This interface is used for streamline tracking from spherically deconvolved data, and calls the MRtrix function ‘streamtrack’ with the option ‘SD_STREAM’

### Example

    >>> import nipype.interfaces.mrtrix as mrt
    >>> sdtrack = mrt.SphericallyDeconvolutedStreamlineTrack()
    >>> sdtrack.inputs.in_file = 'data.Bfloat'
    >>> sdtrack.inputs.seed_file = 'seed_mask.nii'
    >>> sdtrack.run()

Inputs:

    [Mandatory]
    in_file: (an existing file name)
            the image containing the source data.The type of data required depends on the type of
            tracking as set in the preceeding argument. For DT methods, the base DWI are needed. For
            SD methods, the SH harmonic coefficients of the FOD are needed.
    terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
            Control terminal output

    [Optional]
    args: (a string)
            Additional parameters to the command
    cutoff_value: (a float)
            Set the FA or FOD amplitude cutoff for terminating tracks (default is 0.1).
    desired_number_of_tracks: (an integer)
            Sets the desired number of tracks.The program will continue to generate tracks until
            this number of tracks have been selected and written to the output file(default is 100
            for *_STREAM methods, 1000 for *_PROB methods).
    do_not_precompute: (a boolean)
            Turns off precomputation of the legendre polynomial values. Warning: this will slow down
            the algorithm by a factor of approximately 4.
    environ: (a dictionary with keys which are a value of type 'str' and with values which
             are a value of type 'str', nipype default value: {})
            Environment variables
    exclude_spec: (a list of from 4 to 4 items which are an integer)
            exclusion specification in voxels and radius (x y z r)
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the interface fails to
            run
    include_spec: (a list of from 4 to 4 items which are an integer)
            inclusion specification in voxels and radius (x y z r)
    initial_cutoff_value: (a float)
            Sets the minimum FA or FOD amplitude for initiating tracks (default is twice the normal
            cutoff).
    initial_direction: (a list of from 2 to 2 items which are an integer)
            Specify the initial tracking direction as a vector
    inputmodel: ('DT_STREAM' or 'SD_PROB' or 'SD_STREAM', nipype default value: DT_STREAM)
            input model type
    mask_spec: (a list of from 4 to 4 items which are an integer)
            Mask specification in voxels and radius (x y z r). Tracks will be terminated when they
            leave the ROI.
    maximum_number_of_tracks: (an integer)
            Sets the maximum number of tracks to generate.The program will not generate more tracks
            than this number, even if the desired number of tracks hasn't yet been reached(default
            is 100 x number).
    maximum_tract_length: (a float)
            Sets the maximum length of any track in millimeters (default is 200 mm).
    minimum_radius_of_curvature: (a float)
            Set the minimum radius of curvature (default is 2 mm for DT_STREAM, 0 for SD_STREAM, 1
            mm for SD_PROB and DT_PROB)
    minimum_tract_length: (a float)
            Sets the minimum length of any track in millimeters (default is 10 mm).
    no_mask_interpolation: (a boolean)
            Turns off trilinear interpolation of mask images.
    out_file: (a file name)
            output data file
    seed_spec: (a list of from 4 to 4 items which are an integer)
            seed specification in voxels and radius (x y z r)
    step_size: (a float)
            Set the step size of the algorithm in mm (default is 0.2).
    stop: (a boolean)
            stop track as soon as it enters any of the include regions.
    unidirectional: (a boolean)
            Track from the seed point in one direction only (default is to track in both
            directions).

Outputs:

    tracked: (an existing file name)
            output file containing reconstructed tracts

## StreamlineTrack

Link to code

Wraps command streamtrack

Performs tractography using one of the following models: ‘dt_prob’, ‘dt_stream’, ‘sd_prob’, ‘sd_stream’, Where ‘dt’ stands for diffusion tensor, ‘sd’ stands for spherical deconvolution, and ‘prob’ stands for probabilistic.

### Example

    >>> import nipype.interfaces.mrtrix as mrt
    >>> strack = mrt.StreamlineTrack()
    >>> strack.inputs.inputmodel = 'SD_PROB'
    >>> strack.inputs.in_file = 'data.Bfloat'
    >>> strack.inputs.seed_file = 'seed_mask.nii'
    >>> strack.run()

Inputs:

    [Mandatory]
    in_file: (an existing file name)
            the image containing the source data.The type of data required depends on the type of
            tracking as set in the preceeding argument. For DT methods, the base DWI are needed. For
            SD methods, the SH harmonic coefficients of the FOD are needed.
    terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
            Control terminal output

    [Optional]
    args: (a string)
            Additional parameters to the command
    cutoff_value: (a float)
            Set the FA or FOD amplitude cutoff for terminating tracks (default is 0.1).
    desired_number_of_tracks: (an integer)
            Sets the desired number of tracks.The program will continue to generate tracks until
            this number of tracks have been selected and written to the output file(default is 100
            for *_STREAM methods, 1000 for *_PROB methods).
    do_not_precompute: (a boolean)
            Turns off precomputation of the legendre polynomial values. Warning: this will slow down
            the algorithm by a factor of approximately 4.
    environ: (a dictionary with keys which are a value of type 'str' and with values which
             are a value of type 'str', nipype default value: {})
            Environment variables
    exclude_spec: (a list of from 4 to 4 items which are an integer)
            exclusion specification in voxels and radius (x y z r)
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the interface fails to
            run
    include_spec: (a list of from 4 to 4 items which are an integer)
            inclusion specification in voxels and radius (x y z r)
    initial_cutoff_value: (a float)
            Sets the minimum FA or FOD amplitude for initiating tracks (default is twice the normal
            cutoff).
    initial_direction: (a list of from 2 to 2 items which are an integer)
            Specify the initial tracking direction as a vector
    inputmodel: ('DT_STREAM' or 'SD_PROB' or 'SD_STREAM', nipype default value: DT_STREAM)
            input model type
    mask_spec: (a list of from 4 to 4 items which are an integer)
            Mask specification in voxels and radius (x y z r). Tracks will be terminated when they
            leave the ROI.
    maximum_number_of_tracks: (an integer)
            Sets the maximum number of tracks to generate.The program will not generate more tracks
            than this number, even if the desired number of tracks hasn't yet been reached(default
            is 100 x number).
    maximum_tract_length: (a float)
            Sets the maximum length of any track in millimeters (default is 200 mm).
    minimum_radius_of_curvature: (a float)
            Set the minimum radius of curvature (default is 2 mm for DT_STREAM, 0 for SD_STREAM, 1
            mm for SD_PROB and DT_PROB)
    minimum_tract_length: (a float)
            Sets the minimum length of any track in millimeters (default is 10 mm).
    no_mask_interpolation: (a boolean)
            Turns off trilinear interpolation of mask images.
    out_file: (a file name)
            output data file
    seed_spec: (a list of from 4 to 4 items which are an integer)
            seed specification in voxels and radius (x y z r)
    step_size: (a float)
            Set the step size of the algorithm in mm (default is 0.2).
    stop: (a boolean)
            stop track as soon as it enters any of the include regions.
    unidirectional: (a boolean)
            Track from the seed point in one direction only (default is to track in both
            directions).

Outputs:

    tracked: (an existing file name)
            output file containing reconstructed tracts

## Tracks2Prob

Link to code

Wraps command tracks2prob

Convert a tract file into a map of the fraction of tracks to enter each voxel - also known as a tract density image (TDI) - in MRtrix’s image format (.mif). This can be viewed using MRview or converted to Nifti using MRconvert.

### Example

    >>> import nipype.interfaces.mrtrix as mrt
    >>> tdi = mrt.Tracks2Prob()
    >>> tdi.inputs.in_file = 'dwi_CSD_tracked.tck'
    >>> tdi.inputs.colour = True
    >>> tdi.run()

Inputs:

    [Mandatory]
    in_file: (an existing file name)
            tract file
    terminal_output: ('stream' or 'allatonce' or 'file' or 'none')
            Control terminal output

    [Optional]
    args: (a string)
            Additional parameters to the command
    colour: (a boolean)
            add colour to the output image according to the direction of the tracks.
    environ: (a dictionary with keys which are a value of type 'str' and with values which
             are a value of type 'str', nipype default value: {})
            Environment variables
    fraction: (a boolean)
            produce an image of the fraction of fibres through each voxel (as a proportion of the
            total number in the file), rather than the count.
    ignore_exception: (a boolean, nipype default value: False)
            Print an error message instead of throwing an exception in case the interface fails to
            run
    out_filename: (a file name)
            output data file
    output_datatype: ('nii' or 'float' or 'char' or 'short' or 'int' or 'long' or 'double')
            "i.e. Bfloat". Can be "char", "short", "int", "long", "float" or "double"
    resample: (a float)
            resample the tracks at regular intervals using Hermite interpolation. If omitted, the
            program will select an appropriate interpolation factor automatically.
    template_file: (an existing file name)
            an image file to be used as a template for the output (the output image wil have the
            same transform and field of view)
    voxel_dims: (a list of from 3 to 3 items which are a float)
            Three comma-separated numbers giving the size of each voxel in mm.

Outputs:

    tract_image: (an existing file name)
            Output tract count or track density image