dmriprep.interfaces.vectors module

Handling the gradient table.

class dmriprep.interfaces.vectors.CheckGradientTable(from_file=None, resource_monitor=None, **inputs)View on GitHub

Bases: SimpleInterface

Ensure the correctness of the gradient table.

Example

>>> os.chdir(tmpdir)
>>> check = CheckGradientTable(
...     dwi_file=str(data_dir / 'dwi.nii.gz'),
...     in_rasb=str(data_dir / 'dwi.tsv')).run()
>>> check.outputs.pole
(0.0, 0.0, 0.0)
>>> check.outputs.full_sphere
True
>>> check.outputs.num_shells
3
>>> check.outputs.shell_dist
{0: 12, 1200: 32, 2500: 61}
>>> check = CheckGradientTable(
...     dwi_file=str(data_dir / 'dwi.nii.gz'),
...     in_bvec=str(data_dir / 'bvec'),
...     in_bval=str(data_dir / 'bval')).run()
>>> check.outputs.pole
(0.0, 0.0, 0.0)
>>> check.outputs.full_sphere
True
>>> check.outputs.num_shells
3
>>> check.outputs.shell_dist
{0: 12, 1200: 32, 2500: 61}
>>> newrasb = np.loadtxt(check.outputs.out_rasb, skiprows=1)
>>> oldrasb = np.loadtxt(str(data_dir / 'dwi.tsv'), skiprows=1)
>>> np.allclose(newrasb, oldrasb, rtol=1.e-3)
True
Mandatory Inputs:

dwi_file (a pathlike object or string representing an existing file)

Optional Inputs:
  • b0_threshold (a float) – (Nipype default value: 50)

  • b_mag (an integer or None) – (Nipype default value: None)

  • b_scale (a boolean) – (Nipype default value: True)

  • bvec_norm_epsilon (a float) – (Nipype default value: 0.1)

  • in_bval (a pathlike object or string representing an existing file) – Mutually exclusive with inputs: in_rasb.

  • in_bvec (a pathlike object or string representing an existing file) – Mutually exclusive with inputs: in_rasb.

  • in_rasb (a pathlike object or string representing an existing file) – Mutually exclusive with inputs: in_bval, in_bvec.

Outputs:
  • b0_ixs (a list of items which are an integer)

  • b0_mask (a list of items which are a boolean)

  • full_sphere (a boolean)

  • num_shells (an integer)

  • out_bval (a pathlike object or string representing an existing file)

  • out_bvec (a pathlike object or string representing an existing file)

  • out_rasb (a pathlike object or string representing an existing file)

  • pole (a tuple of the form: (a float, a float, a float))

  • shell_dist (a dictionary with keys which are any value and with values which are any value)