xcp_d.interfaces.utils module

Miscellaneous utility interfaces.

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

Bases: SimpleInterface

Create an HDF5-format file containing a DCAN-format dataset.

Notes

The metrics in the file are:

  • FD_threshold: a number >= 0 that represents the FD threshold used to calculate the metrics in this list.

  • frame_removal: a binary vector/array the same length as the number of frames in the concatenated time series, indicates whether a frame is removed (1) or not (0)

  • format_string (legacy): a string that denotes how the frames were excluded. This uses a notation devised by Avi Snyder.

  • total_frame_count: a whole number that represents the total number of frames in the concatenated series

  • remaining_frame_count: a whole number that represents the number of remaining frames in the concatenated series

  • remaining_seconds: a whole number that represents the amount of time remaining after thresholding

  • remaining_frame_mean_FD: a number >= 0 that represents the mean FD of the remaining frames

Mandatory Inputs:
  • TR (a float) – Repetition Time.

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

Outputs:

qc_file (a pathlike object or string representing an existing file) – ABCC QC HDF5 file.

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

Bases: SimpleInterface

Downcast files from >32-bit to 32-bit if necessary.

Optional Inputs:
  • bold_file (a pathlike object or string representing an existing file or None) – BOLD file. (Nipype default value: None)

  • bold_mask (a pathlike object or string representing an existing file or None) – BOLD mask file. (Nipype default value: None)

  • boldref (a pathlike object or string representing an existing file or None) – BOLD reference file. (Nipype default value: None)

  • t1w (a pathlike object or string representing an existing file or None) – T1-weighted anatomical file. (Nipype default value: None)

  • t2w (a pathlike object or string representing an existing file or None) – T2-weighted anatomical file. (Nipype default value: None)

Outputs:
  • bold_file (a pathlike object or string representing an existing file or None) – BOLD file.

  • bold_mask (a pathlike object or string representing an existing file or None) – BOLD mask file.

  • boldref (a pathlike object or string representing an existing file or None) – BOLD reference file.

  • t1w (a pathlike object or string representing an existing file or None) – T1-weighted anatomical file.

  • t2w (a pathlike object or string representing an existing file or None) – T2-weighted anatomical file.

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

Bases: SimpleInterface

Extract timeseries and compute connectivity matrices.

Mandatory Inputs:

inlist (a list of items which are a string or a _Undefined or None or None) – List of objects to filter.

Outputs:

outlist (a list of items which are a string) – Filtered list of objects.

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

Bases: SimpleInterface

Calculate QC metrics used by the LINC lab.

Mandatory Inputs:
  • TR (a float) – Repetition time, in seconds.

  • bold_file (a pathlike object or string representing an existing file) – Preprocessed BOLD file, after dummy scan removal. Used in carpet plot.

  • bold_mask_inputspace (a pathlike object or string representing an existing file or None) – Mask file from NIfTI. May be None, for CIFTI processing. The mask is in the same space as the BOLD data, which may not be the same as the bold_mask_stdspace file. Used to load the masked BOLD data. Not used for QC metrics.

  • cleaned_file (a pathlike object or string representing an existing file) – Processed file, after denoising and censoring.

  • dummy_scans (an integer) – Dummy time to drop.

  • head_radius (a float) – Head radius for FD calculation, in mm.

  • motion_file (a pathlike object or string representing an existing file) – FMRIPrep confounds file, after dummy scans removal.

  • name_source (a pathlike object or string representing a file) – Preprocessed BOLD file. Used to find files. In the case of the concatenation workflow, this may be a nonexistent file (i.e., the preprocessed BOLD file, with the run entity removed).

Optional Inputs:
  • anat_mask_anatspace (a pathlike object or string representing an existing file) – Anatomically-derived brain mask in anatomical space. Used to calculate coregistration QC metrics.

  • bold_mask_anatspace (a pathlike object or string representing an existing file) – BOLD mask in anatomical space. Used to calculate coregistration QC metrics.

  • bold_mask_stdspace (a pathlike object or string representing an existing file) – BOLD mask in template space. This matches the space of template_mask, but does not necessarily match the space of bold_mask_inputspace. Used to calculate normalization QC metrics.

  • template_mask (a pathlike object or string representing an existing file) – Template’s official brain mask. This matches the space of bold_mask_stdspace, but does not necessarily match the space of bold_mask_inputspace. Used to calculate normalization QC metrics.

  • temporal_mask (a pathlike object or string representing an existing file or a _Undefined or None) – Temporal mask.

Outputs:
  • qc_file (a pathlike object or string representing an existing file) – QC TSV file.

  • qc_metadata (a pathlike object or string representing an existing file) – Sidecar JSON for QC TSV file.