xcp_d.utils.boilerplate module
Functions for generating boilerplate code.
- xcp_d.utils.boilerplate.describe_atlases(atlases)[source]
Build a text description of the atlases that will be used.
- xcp_d.utils.boilerplate.describe_censoring(*, motion_filter_type, head_radius, fd_thresh, exact_scans)[source]
Build a text description of the FD censoring process.
- Parameters:
motion_filter_type ({None, “lp”, “notch”}) – Type of filter to use for removing respiratory artifact from motion regressors.
If None, no filter will be applied.
If the filter type is set to “notch”, frequencies between
band_stop_minandband_stop_maxwill be removed with a notch filter. In this case, bothband_stop_minandband_stop_maxmust be defined.If “lp”, frequencies above
band_stop_minwill be removed with a Butterworth filter. In this case, onlyband_stop_minmust be defined.head_radius (
floator “auto”) – Radius of the head, in millimeters, for framewise displacement calculation.xcp_d’s default head radius is 50. The recommended value for infants is 35. A value of ‘auto’ is also supported, in which case the brain radius is estimated from the preprocessed brain mask.fd_thresh (
float) – Framewise displacement threshold for censoring, in millimeters. Any framewise displacement values higher than the threshold are flagged as “high motion”. If set to <=0, no censoring will be performed. Default is 0.2 mm.exact_scans (
listofint, optional) – If used, this parameter will produce correlation matrices limited to each requested amount of time. If there is more than the required amount of low-motion data, then volumes will be randomly selected to produce denoised outputs with the exact amounts of time requested. If there is less than the required amount of ‘good’ data, then the run will not be post-processed.
- Returns:
desc – A text description of the censoring procedure.
- Return type:
- xcp_d.utils.boilerplate.describe_motion_parameters(*, motion_filter_type, motion_filter_order, band_stop_min, band_stop_max, TR)[source]
Build a text description of the motion parameter filtering and FD calculation process.
- Parameters:
motion_filter_type ({None, “lp”, “notch”}) – Type of filter to use for removing respiratory artifact from motion regressors.
If None, no filter will be applied.
If the filter type is set to “notch”, frequencies between
band_stop_minandband_stop_maxwill be removed with a notch filter. In this case, bothband_stop_minandband_stop_maxmust be defined.If “lp”, frequencies above
band_stop_minwill be removed with a Butterworth filter. In this case, onlyband_stop_minmust be defined.motion_filter_order (
int) – Number of filter coefficients for the motion parameter filter. Motion filtering is only performed ifmotion_filter_typeis not None. This parameter is used in conjunction withband_stop_maxandband_stop_min. For “lp” filters, the order is divided by 2 as filtfilt applies the filter twice. For “notch” filters, the order is divided by 4 as iirnotch is a second-order filter and filtfilt applies the filter twice.band_stop_min (
floator None) – Lower frequency for the motion parameter filter, in breaths-per-minute (bpm). Motion filtering is only performed ifmotion_filter_typeis not None. If used with the “lp”motion_filter_type, this parameter essentially corresponds to a low-pass filter (the maximum allowed frequency in the filtered data). This parameter is used in conjunction withmotion_filter_orderandband_stop_max.Here is a list of recommended values, based on participant age:
Age Range (years)
Recommended Value
< 1
30
1 - 2
25
2 - 6
20
6 - 12
15
12 - 18
12
19 - 65
12
65 - 80
12
> 80
10
When
motion_filter_typeis set to “lp” (low-pass filter), another commonly-used value for this parameter is 6 BPM (equivalent to 0.1 Hertz), based on Gratton et al.[1].band_stop_max (
floator None) – Upper frequency for the motion parameter filter, in breaths-per-minute (bpm). Motion filtering is only performed ifmotion_filter_typeis not None. This parameter is only used ifmotion-filter-typeis set to “notch”. This parameter is used in conjunction withmotion_filter_orderandband_stop_min.Here is a list of recommended values, based on participant age:
Age Range (years)
Recommended Value
< 1
60
1 - 2
50
2 - 6
35
6 - 12
25
12 - 18
20
19 - 65
18
65 - 80
28
> 80
30
TR (
float) – Repetition time of the BOLD run, in seconds.
- Returns:
desc – A text description of the motion parameters.
- Return type:
- xcp_d.utils.boilerplate.describe_regression(*, confounds_config, motion_filter_type, motion_filter_order, band_stop_min, band_stop_max, TR, fd_thresh)[source]
Build a text description of the regression that will be performed.
- Parameters:
confounds_config
motion_filter_type ({None, “lp”, “notch”}) – Type of filter to use for removing respiratory artifact from motion regressors.
If None, no filter will be applied.
If the filter type is set to “notch”, frequencies between
band_stop_minandband_stop_maxwill be removed with a notch filter. In this case, bothband_stop_minandband_stop_maxmust be defined.If “lp”, frequencies above
band_stop_minwill be removed with a Butterworth filter. In this case, onlyband_stop_minmust be defined.
- Returns:
desc – A text description of the regression.
- Return type: