xcp_d.ingression.utils module

Functions to support ingression of non-BIDS preprocessing derivatives.

xcp_d.ingression.utils.collect_anatomical_files(anat_dir_orig, anat_dir_bids, base_anatomical_ents)[source]

Collect anatomical files from ABCD or HCP-YA derivatives.

xcp_d.ingression.utils.collect_hcp_confounds(task_dir_orig, out_dir, prefix, work_dir, bold_file, brainmask_file, csf_mask_file, wm_mask_file)[source]

Create confound regressors from ABCD-BIDS or HCP-YA derivatives.

Parameters:
  • task_dir_orig (str) – Path to folder containing original preprocessing derivatives.

  • out_dir (str) – Path to BIDS derivatives ‘func’ folder, to which the confounds file will be written.

  • prefix (str) – The filename prefix to use for the confounds file. E.g., “sub-X_ses-Y_task-rest”.

  • work_dir (str) – Path to working directory, where temporary files created by nilearn during the masking procedure will be stored.

  • bold_file (str) – Path to preprocessed BOLD file.

  • brainmask_file (str) – Path to brain mask file in same space/resolution as BOLD file.

  • csf_mask_file (str) – Path to CSF mask file in same space/resolution as BOLD file.

  • wm_mask_file (str) – Path to WM mask file in same space/resolution as BOLD file.

xcp_d.ingression.utils.collect_meshes(anat_dir_orig, anat_dir_bids, sub_id, subses_ents)[source]

Collect mesh files from ABCD or HCP-YA derivatives.

xcp_d.ingression.utils.collect_morphs(anat_dir_orig, anat_dir_bids, sub_id, subses_ents)[source]

Collect and convert morphometry files to CIFTIs.

xcp_d.ingression.utils.collect_ukbiobank_confounds(task_dir_orig, out_dir, prefix, work_dir, bold_file, brainmask_file)[source]

Create confound regressors from UK Biobank derivatives.

Parameters:
  • task_dir_orig (str) – Path to folder containing original preprocessing derivatives.

  • out_dir (str) – Path to BIDS derivatives ‘func’ folder, to which the confounds file will be written.

  • prefix (str) – The filename prefix to use for the confounds file. E.g., “sub-X_ses-Y_task-rest”.

  • work_dir (str) – Path to working directory, where temporary files created by nilearn during the masking procedure will be stored.

  • bold_file (str) – Path to preprocessed BOLD file.

  • brainmask_file (str) – Path to brain mask file in same space/resolution as BOLD file.

xcp_d.ingression.utils.copy_file(src, dst)[source]

Copy a file from source to dest.

source and dest must be file-like objects, i.e. any object with a read or write method, like for example StringIO.

xcp_d.ingression.utils.copy_files_in_dict(copy_dictionary)[source]

Copy files in dictionary.

xcp_d.ingression.utils.extract_mean_signal(mask, nifti, work_dir)[source]

Extract mean signal within mask from NIFTI.

xcp_d.ingression.utils.plot_bbreg(fixed_image, moving_image, contour, out_file='report.svg')[source]

Plot bbref_fig_fmriprep results.

xcp_d.ingression.utils.write_json(data, outfile)[source]

Write dictionary to JSON file.