qsiprep.interfaces.reports module

Interfaces to generate reportlets

class qsiprep.interfaces.reports.AboutSummary(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SummaryInterface

Optional Inputs:
  • command (a string) – Qsiprep command.

  • version (a string) – Qsiprep version.

Outputs:

out_report (a pathlike object or string representing an existing file) – HTML segment containing summary.

class qsiprep.interfaces.reports.DiffusionSummary(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SummaryInterface

Mandatory Inputs:
  • distortion_correction (a string) – Method used for SDC.

  • hmc_transform (a string) – Transform used during HMC.

  • pe_direction (None or ‘i’ or ‘i-’ or ‘j’ or ‘j-’) – Phase-encoding direction detected.

Optional Inputs:
  • b0_to_t1w_transform (‘Rigid’ or ‘Affine’) – Transform type for coregistration.

  • confounds_file (a pathlike object or string representing an existing file) – Confounds file.

  • denoise_method (a string) – Method used for image denoising.

  • dwi_denoise_window (an integer or a string) – Window size for dwidenoise.

  • hmc_model (a string) – Model used for hmc.

  • impute_slice_threshold (a float) – Threshold for imputing a slice.

  • output_spaces (a list of items which are any value) – Target spaces.

  • validation_reports (a list of items which are a pathlike object or string representing an existing file)

Outputs:

out_report (a pathlike object or string representing an existing file) – HTML segment containing summary.

class qsiprep.interfaces.reports.GradientPlot(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SummaryInterface

Mandatory Inputs:
  • orig_bval_files (a list of items which are a pathlike object or string representing an existing file) – Bvals from DWISplit.

  • orig_bvec_files (a list of items which are a pathlike object or string representing an existing file) – Bvecs from DWISplit.

Optional Inputs:
  • final_bvec_file (a pathlike object or string representing an existing file) – Bval file.

  • source_files (a list of items which are any value) – Source file for each gradient.

Outputs:
  • out_report (a pathlike object or string representing an existing file) – HTML segment containing summary.

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

class qsiprep.interfaces.reports.SeriesQC(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:
  • confounds_file (a pathlike object or string representing an existing file) – Confounds file.

  • pre_qc (a pathlike object or string representing an existing file) – Qc file from the raw data.

Optional Inputs:
  • mni_dice_score (a float)

  • output_file_name (a string or os.PathLike object)

  • t1_b0_series (a pathlike object or string representing an existing file) – Time series of b=0 images.

  • t1_cnr_file (a pathlike object or string representing an existing file) – CNR file in t1 space.

  • t1_dice_score (a float)

  • t1_fieldmap_hz_file (a pathlike object or string representing an existing file) – Fieldmap in Hz file in t1 space.

  • t1_mask_file (a pathlike object or string representing an existing file) – Brain mask in t1 space.

  • t1_qc (a pathlike object or string representing an existing file) – Qc file from preprocessed image in t1 space.

  • t1_qc_postproc (a pathlike object or string representing an existing file) – Qc file from preprocessed image in template space.

Outputs:

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

class qsiprep.interfaces.reports.SubjectSummary(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SummaryInterface

Optional Inputs:
  • dwi_groupings (a dictionary with keys which are any value and with values which are any value) – Groupings of DWI files and their output names.

  • freesurfer_status (‘Not run’ or ‘Partial’ or ‘Full’) – FreeSurfer status.

  • output_spaces (a list of items which are any value) – Target spaces.

  • session_id (a string) – Session ID.

  • subject_id (a string) – Subject ID.

  • subjects_dir (a pathlike object or string representing a directory) – FreeSurfer subjects directory.

  • t1w (a list of items which are a pathlike object or string representing an existing file) – T1w structural images.

  • t2w (a list of items which are a pathlike object or string representing an existing file) – T2w structural images.

  • template (a string) – Template space.

Outputs:
  • out_report (a pathlike object or string representing an existing file) – HTML segment containing summary.

  • subject_id (a string) – FreeSurfer subject ID.

class qsiprep.interfaces.reports.SummaryInterface(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Outputs:

out_report (a pathlike object or string representing an existing file) – HTML segment containing summary.

class qsiprep.interfaces.reports.TopupSummary(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SummaryInterface

Optional Inputs:

summary (a string) – Summary of TOPUP inputs.

Outputs:

out_report (a pathlike object or string representing an existing file) – HTML segment containing summary.

qsiprep.interfaces.reports.calculate_motion_summary(confounds_tsv)[source]
qsiprep.interfaces.reports.get_cnr_values(cnr_image, brain_mask)[source]
qsiprep.interfaces.reports.get_fieldmap_values(fieldmap_image, brain_mask)[source]

Parcellate field map and get summary values for each parcel.

Parameters:
  • fieldmap_image (str) – Path to the field map image.

  • brain_mask (str) – Path to the brain mask image.

Returns:

freqs – Dictionary of field map values for each parcel.

Return type:

dict

qsiprep.interfaces.reports.motion_derivatives(translations, rotations, framewise_disp, original_files)[source]
qsiprep.interfaces.reports.plot_gradients(bvals, orig_bvecs, source_filenums, output_fname, final_bvecs=None, frames=60)[source]
qsiprep.interfaces.reports.topup_selection_to_report(selected_indices, original_files, spec_lookup, image_source='combined DWI series')[source]

Write a description of how the images were selected for TOPUP.

>>> selected_indices = [0, 15, 30, 45]
>>> original_files = ["sub-1_dir-AP_dwi.nii.gz"] * 30 + ["sub-1_dir-PA_dwi.nii.gz"] * 30
>>> spec_lookup = {"sub-1_dir-AP_dwi.nii.gz": "0 1 0 0.087",
...                "sub-1_dir-PA_dwi.nii.gz": "0 -1 0 0.087"}
>>> print(topup_selection_to_report(selected_indices, original_files, spec_lookup))
A total of 2 distortion groups was included in the combined dwi data. Distortion group '0 1 0 0.087' was represented by images 0, 15 from sub-1_dir-AP_dwi.nii.gz. Distortion group '0 -1 0 0.087' was represented by images 0, 15 from sub-1_dir-PA_dwi.nii.gz. "

Or

>>> selected_indices = [0, 15, 30, 45]
>>> original_files = ["sub-1_dir-AP_run-1_dwi.nii.gz"] * 15 + [
...                   "sub-1_dir-AP_run-2_dwi.nii.gz"] * 15 + [
...                   "sub-1_dir-PA_dwi.nii.gz"] * 30
>>> spec_lookup = {"sub-1_dir-AP_run-1_dwi.nii.gz": "0 1 0 0.087",
...                "sub-1_dir-AP_run-2_dwi.nii.gz": "0 1 0 0.087",
...                "sub-1_dir-PA_dwi.nii.gz": "0 -1 0 0.087"}
>>> print(topup_selection_to_report(selected_indices, original_files, spec_lookup))
A total of 2 distortion groups was included in the combined dwi data. Distortion group '0 1 0 0.087' was represented by image 0 from sub-1_dir-AP_run-1_dwi.nii.gz and image 0 from sub-1_dir-AP_run-2_dwi.nii.gz. Distortion group '0 -1 0 0.087' was represented by images 0, 15 from sub-1_dir-PA_dwi.nii.gz.
>>> selected_indices = [0, 15, 30, 45, 60]
>>> original_files = ["sub-1_dir-AP_run-1_dwi.nii.gz"] * 15 + [
...                   "sub-1_dir-AP_run-2_dwi.nii.gz"] * 15 + [
...                   "sub-1_dir-AP_run-3_dwi.nii.gz"] * 15 + [
...                   "sub-1_dir-PA_dwi.nii.gz"] * 30
>>> spec_lookup = {"sub-1_dir-AP_run-1_dwi.nii.gz": "0 1 0 0.087",
...                "sub-1_dir-AP_run-2_dwi.nii.gz": "0 1 0 0.087",
...                "sub-1_dir-AP_run-3_dwi.nii.gz": "0 1 0 0.087",
...                "sub-1_dir-PA_dwi.nii.gz": "0 -1 0 0.087"}
>>> print(topup_selection_to_report(selected_indices, original_files, spec_lookup))
A total of 2 distortion groups was included in the combined dwi data. Distortion group '0 1 0 0.087' was represented by image 0 from sub-1_dir-AP_run-1_dwi.nii.gz, image 0 from sub-1_dir-AP_run-2_dwi.nii.gz and image 0 from sub-1_dir-AP_run-3_dwi.nii.gz. Distortion group '0 -1 0 0.087' was represented by images 0, 15 from sub-1_dir-PA_dwi.nii.gz.
>>> selected_indices = [0, 15, 30, 45]
>>> original_files = ["sub-1_dir-PA_dwi.nii.gz"] * 60
>>> spec_lookup = {"sub-1_dir-PA_dwi.nii.gz": "0 -1 0 0.087"}
>>> print(topup_selection_to_report(selected_indices, original_files, spec_lookup))
A total of 1 distortion group was included in the combined dwi data. Distortion group '0 -1 0 0.087' was represented by images 0, 15, 30, 45 from sub-1_dir-PA_dwi.nii.gz.