MRtrix3

Module contents

Interfaces for MRtrix3 scripts.

Submodules

django_mri.analysis.interfaces.mrtrix3.dwifslpreproc module

Definition of the dwifslpreproc interface.

class django_mri.analysis.interfaces.mrtrix3.dwifslpreproc.DwiFslPreproc(configuration: dict)

Bases: object

An interface for the MRtrix3 dwifslpreproc script.

References

DEFAULT_OUTPUT_NAME = 'preprocessed_dwi.mif'

Default name for primary output file.

EDDY_OUTPUTS = {'eddy_mask': 'eddy_mask.nii', 'out_movement_rms': 'eddy_movement_rms', 'out_outlier_map': 'eddy_outlier_map', 'out_outlier_n_sqr_stdev_map': 'eddy_outlier_n_sqr_stdev_map', 'out_outlier_n_stdev_map': 'eddy_outlier_n_stdev_map', 'out_outlier_report': 'eddy_outlier_report', 'out_parameter': 'eddy_parameters', 'out_restricted_movement_rms': 'eddy_restricted_movement_rms', 'out_shell_alignment_parameters': 'eddy_post_eddy_shell_alignment_parameters', 'out_shell_pe_translation_parameters': 'eddy_post_eddy_shell_PE_translation_parameters'}

eddy output files by key.

References

FLAGS = ('align_seepi', 'rpe_none', 'rpe_pair', 'rpe_all', 'rpe_header', 'force', 'quiet', 'info', 'nocleanup')

“Flags” indicate parameters that are specified without any arguments, i.e. they are a switch for some binary configuration.

SUPPLEMENTARY_OUTPUTS = ('eddyqc_text', 'eddyqc_all')

Non-default output configurations.

add_supplementary_outputs(destination: pathlib.Path) → dict

Adds the eddy output files to the interface’s configuration before generating the command to run.

References

Parameters:destination (Path) – Output directory
Returns:Updated configuration dictionary
Return type:dict
generate_command(scan, destination: pathlib.Path, config: str) → str

Returns the command to be executed in order to run the analysis.

Parameters:
  • scan (Scan) – Input scan
  • destination (Path) – Output files destination direcotry
  • config (str) – Configuration arguments for the command
Returns:

Complete execution command

Return type:

str

generate_output_dict(destination: pathlib.Path) → dict

Generates a dictionary of the expected output file paths by key.

Parameters:destination (Path) – Output files destination directory
Returns:Output files by key
Return type:dict
run(scan, destination: pathlib.Path = None) → dict

Runs dwifslpreproc with the provided scan as input. If destination is not specified, output files will be created within scan’s directory.

Parameters:
  • scan (Scan) – Input scan
  • destination (Path, optional) – Output files destination directory, by default None
Returns:

Output files by key

Return type:

dict

Raises:

RuntimeError – Run failure