Interfaces

Module contents

Interface classes for various MRI data processing tools.

Subpackages

Submodules

django_mri.analysis.interfaces.dcm2niix module

Definition of the Dcm2niix class.

django_mri.analysis.interfaces.dcm2niix.BASE_DIR = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/django-mri/checkouts/latest/django_mri')

Project’s base directory.

class django_mri.analysis.interfaces.dcm2niix.Dcm2niix(path: pathlib.Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/django-mri/checkouts/latest/django_mri/utils/dcm2niix'))

Bases: object

An interface for dcm2niix.

BOOLEAN = {False: 'n', True: 'y'}

Convert boolean configurations to “y” or “n”.

FLAGS = {'BIDS': '-b', 'compressed': '-z', 'directory': '-o', 'name': '-f'}

Arguemnts dictionary. Keys are the interface’s verbose names and values are the actual CLI’s arguments.

convert(path: pathlib.Path, destination: pathlib.Path, compressed: bool = True, generate_json: bool = True) → pathlib.Path

Coverts the series in the provided path from DICOM to NIfTI.

Parameters:
  • path (Path) – Input DICOM directory
  • destination (Path) – Output destination directory
  • compressed (bool, optional) – Whether to create compressed (.nii.gz) files or not, by default True
  • generate_json (bool, optional) – Whether to generate a “BIDS sidecar” JSON file with supplementary information, by default True
Returns:

Output file path

Return type:

Path

Raises:
extract_output_path(stdout: str, compressed: bool) → pathlib.Path

Returns the path of the output file.

Parameters:
  • stdout (str) – dcm2niix run output
  • compressed (bool) – Whether the file is compressed (.nii.gz) or not, by default True
Returns:

Output file path

Return type:

Path

generate_command(path: pathlib.Path, destination: pathlib.Path, compressed: bool = True, generate_json: bool = True) → list

Generate the command to execute to run dcm2niix.

Parameters:
  • path (Path) – Input path
  • destination (Path) – Output file destination
  • compressed (bool, optional) – Whether to compress the file or not, by default True
  • generate_json (bool, optional) – Whether to generate a JSON or not, by default True
Returns:

Command to run, split at spaces

Return type:

list

django_mri.analysis.interfaces.messages module

A module storing strings used to display messages.