Utilities for extracting information on various input files using MRtrix3’s mrinfo tool. All values are returned in basic Python data types.

designer.preprocessing.mrinfoutil.commandhistory(path)

Returns a list of command history (manipulations or transformations) performed on MRtrix file format .mif

Parameters

path (str) – Path to input image or directory

Returns

command history of input file

Return type

list of str

designer.preprocessing.mrinfoutil.datatype(path)

Returns the data type used for storing input DWI

Parameters

path (str) – Path to input image or directory

Returns

MRtrix3 datatype

Return type

str

designer.preprocessing.mrinfoutil.dwscheme(path)

Returns a list of input DWI’s diffusion weighting scheme

Parameters

path (str) – Path to input image or directory

Returns

diffusion weighing scheme

Return type

list of float

designer.preprocessing.mrinfoutil.echotime(path)

Returns the echo time(s) of DWI in miliseconds

Parameters

path (str) – Path to input image or directory

Returns

  • int if all DWIs have the same echo time – Echo time in miliseconds

  • str if all DWIs have different echo time – ‘variable’

designer.preprocessing.mrinfoutil.format(path)

Returns the file format of input DWI

Parameters

path (str) – Path to input image or directory

Returns

Image file format

Return type

str

designer.preprocessing.mrinfoutil.getconsole(path, flag)

Fetches the console output of MRtrix3’s mrinfo with specified flag

Parameters
  • path (str) – Path to input image or directory

  • flag (str) – Flag to pass onto mrinfo

Returns

MRtrix3’s mrinfo console output

Return type

str

designer.preprocessing.mrinfoutil.is_fullsphere(path)

Returns boolean value indicating whether input file has full spherical sampling

Parameters

path (str) – Path to input image or directory

Returns

True if full spherical sampling False if half-spherical sampling

Return type

bool

designer.preprocessing.mrinfoutil.max_shell(path)

Returns the maximum b-value shell in DWI

Parameters

path (str) – Path to input image or directory

Returns

Max b-value

Return type

int

designer.preprocessing.mrinfoutil.multiplier(path)

Returns the input DWI’s intensity multiplier

Parameters

path (str) – Path to input image or directory

Returns

Image intensity multiplier

Return type

float

designer.preprocessing.mrinfoutil.ndim(path)

Returns the number of image dimensions of input DWI

Parameters

path (str) – Path to input image or directory

Returns

Number of dimensions in image

Return type

int

designer.preprocessing.mrinfoutil.num_shells(path)

Returns the number of b-value shells detected in input file

Parameters

path (str) – Path to input image or directory

Returns

Number of shells

Return type

int

designer.preprocessing.mrinfoutil.offset(path)

Returns the input DWI’s intensity offset

Parameters

path (str) – Path to input image or directory

Returns

Image intensity offset

Return type

float

designer.preprocessing.mrinfoutil.pescheme(path)

Returns a list of phase encoding scheme. If len(pescheme) > 1, the .mif DWI contains more than one directons

Parameters

path (str) – Path to input image or directory

Returns

  • nPE (int) – Number of PE directions

  • PE (int or list of int) – Phase encoding direction(s)

designer.preprocessing.mrinfoutil.shells(path)

Returns the number of b-value shells detected in input file

Parameters

path (str) – Path to input image or directory

Returns

Number of shells

Return type

int

designer.preprocessing.mrinfoutil.size(path)

Returns the size of input DWI image along each axis

Parameters

path (str) – Path to input image or directory

Returns

Number of voxels in [X, Y, Z, B-value]

Return type

tuple of int

designer.preprocessing.mrinfoutil.spacing(path)

Returns the voxel spacing along each of input DWI’s dimensions

Parameters

path (str) – Path to input image or directory

Returns

Number of spacing between voxels [X, Y, Z, B-value]

Return type

tuple of int

designer.preprocessing.mrinfoutil.strides(path)

Returns data strides of input DWI

Parameters

path (str) – Path to input image or directory

Returns

MRtrix3’s strides

Return type

tuple of ints

designer.preprocessing.mrinfoutil.transform(path)

Returns the input DWI’s 4x4 voxel to image transformation matrix

Parameters

path (str) – Path to input image or directory

Returns

Image transformation matrix

Return type

tuple of float