qsirecon.interfaces.utils module

Miscellaneous utilities

class qsirecon.interfaces.utils.ConformAtlas(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Conform a series of dwi images to enable merging.

Performs three basic functions: #. Orient image to requested orientation #. Validate the qform and sform, set qform code to 1

Mandatory Inputs:

in_file (a pathlike object or string representing a file) – Dwi image.

Optional Inputs:

orientation (‘LPS’ or ‘LAS’) – (Nipype default value: LPS)

Outputs:

out_file (a pathlike object or string representing an existing file) – Conformed dwi image.

class qsirecon.interfaces.utils.ExtractAtlasFiles(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

atlas_configs (a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. Keys are atlas names and values are dictionaries with the following keys: ‘file’, ‘label’, ‘metadata’. ‘file’ is the path to the atlas file. ‘label’ is the path to the label file. ‘metadata’ is a dictionary with relevant metadata. ‘xfm_to_anat’ is the path to the transform to get the atlas into ACPC space.

Outputs:
  • atlases (a list of items which are a string) – List of atlas names.

  • mif_files (a list of items which are a pathlike object or string representing a file) – List of mif files.

  • mrtrix_lut_files (a list of items which are a pathlike object or string representing a file) – List of mrtrix lut files.

  • nifti_files (a list of items which are a pathlike object or string representing a file) – List of nifti files.

  • orig_lut_files (a list of items which are a pathlike object or string representing a file) – List of orig lut files.

class qsirecon.interfaces.utils.RecombineAtlasConfigs(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

atlas_configs (a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. Keys are atlas names and values are dictionaries with the following keys: ‘file’, ‘label’, ‘metadata’. ‘file’ is the path to the atlas file. ‘label’ is the path to the label file. ‘metadata’ is a dictionary with relevant metadata. ‘xfm_to_anat’ is the path to the transform to get the atlas into ACPC space.

Optional Inputs:
  • atlases (a list of items which are a string) – List of atlas names.

  • mif_files (a list of items which are a pathlike object or string representing a file) – List of mif files.

  • mrtrix_lut_files (a list of items which are a pathlike object or string representing a file) – List of mrtrix lut files.

  • nifti_files (a list of items which are a pathlike object or string representing a file) – List of nifti files.

  • orig_lut_files (a list of items which are a pathlike object or string representing a file) – List of orig lut files.

Outputs:

atlas_configs (a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. Keys are atlas names and values are dictionaries with the following keys: ‘file’, ‘label’, ‘metadata’. .

class qsirecon.interfaces.utils.SplitAtlasConfigs(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

atlas_configs (a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. Keys are atlas names and values are dictionaries with the following keys: ‘file’, ‘label’, ‘metadata’. ‘file’ is the path to the atlas file. ‘label’ is the path to the label file. ‘metadata’ is a dictionary with relevant metadata. ‘xfm_to_anat’ is the path to the transform to get the atlas into ACPC space.

Outputs:

atlas_configs (a list of items which are a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. This interface adds the following keys: ‘dwi_resolution_file’, ‘dwi_resolution_mif’, ‘orig_lut’, ‘mrtrix_lut’. The values are the paths to the transformed atlas files and the label files.

class qsirecon.interfaces.utils.TestReportPlot(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

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

Outputs:

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

class qsirecon.interfaces.utils.WarpConnectivityAtlases(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

atlas_configs (a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. Keys are atlas names and values are dictionaries with the following keys: ‘file’, ‘label’, ‘metadata’. ‘file’ is the path to the atlas file. ‘label’ is the path to the label file. ‘metadata’ is a dictionary with relevant metadata. ‘xfm_to_anat’ is the path to the transform to get the atlas into T1w space.

Optional Inputs:
  • reference_image (a pathlike object or string representing an existing file)

  • space (a string) – (Nipype default value: T1w)

Outputs:
  • atlas_configs (a dictionary with keys which are any value and with values which are any value) – Dictionary of atlas configurations. This interface adds the following keys: ‘dwi_resolution_file’, ‘dwi_resolution_mif’, ‘orig_lut’, ‘mrtrix_lut’. The values are the paths to the transformed atlas files and the label files.

  • commands (a pathlike object or string representing a file)

class qsirecon.interfaces.utils.WriteSidecar(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Optional Inputs:

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

Outputs:

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

qsirecon.interfaces.utils.label_convert(original_atlas, output_mif, orig_txt, mrtrix_txt, atlas_labels_file)[source]

Create a mrtrix label file from an atlas.

Parameters:
  • original_atlas (str) – Path to the original atlas file, in NIfTI format.

  • output_mif (str) – Path to the output mrtrix label file (mif[.gz]) to be written out.

  • orig_txt (str) – Path to the output original label file (txt) to be written out.

  • mrtrix_txt (str) – Path to the output mrtrix label file (txt) to be written out.

  • atlas_labels_file (str) – Path to the atlas labels file (txt) to be read in. This file should have at least two columns: index and label.