xcp_d.utils.qcmetrics module
Quality control metrics.
- xcp_d.utils.qcmetrics.compute_dvars(datat)[source]
Compute standard DVARS.
- Parameters
datat (numpy.ndarray) – The data matrix from which to calculate DVARS. Ordered as vertices by timepoints.
- Returns
The calculated DVARS array. A (timepoints,) array.
- Return type
- xcp_d.utils.qcmetrics.compute_registration_qc(bold2t1w_mask, t1w_mask, bold2template_mask, template_mask)[source]
Compute quality of registration metrics.
This function will calculate a series of metrics, including Dice’s similarity index, Jaccard’s coefficient, cross-correlation, and coverage, between the BOLD-to-T1w brain mask and the T1w mask, as well as between the BOLD-to-template brain mask and the template mask.
- Parameters
bold2t1w_mask (str) – Path to the BOLD mask in T1w space.
t1w_mask (str) – Path to the T1w mask.
bold2template_mask (str) – Path to the BOLD mask in template space.
template_mask (str) – Path to the template mask.
- Returns
reg_qc – Quality control measures between different inputs.
- Return type
- xcp_d.utils.qcmetrics.coverage(input1, input2)[source]
Estimate the coverage between two masks.
- Parameters
input1/input2 (str) – Path to a NIFTI image. Can be any type but will be converted into binary: False where 0, True everywhere else.
- Returns
cov – Coverage between two images.
- Return type
- xcp_d.utils.qcmetrics.crosscorr(input1, input2)[source]
Calculate cross correlation between two images.
NOTE: TS- This appears to be Pearson’s correlation, not cross-correlation.
- Parameters
input1/input2 (str) – Path to a NIFTI image. Can be any type but will be converted into binary: False where 0, True everywhere else.
- Returns
cc – Correlation between the two images.
- Return type
- xcp_d.utils.qcmetrics.dc(input1, input2)[source]
Calculate Dice coefficient between two images.
Computes the Dice coefficient (also known as Sorensen index) between the binary objects in twom j images.
The metric is defined as .. math:
DC=\frac{2|A\cap B|}{|A|+|B|}
, where \(A\) is the first and \(B\) the second set of samples (here: binary objects).
- Parameters
input1/input2 (str) – Path to a NIFTI image. Can be any type but will be converted into binary: False where 0, True everywhere else.
- Returns
dc – The Dice coefficient between the object(s) in
`input1`
and the object(s) in`input2`
. It ranges from 0 (no overlap) to 1 (perfect overlap).- Return type
Notes
This is a real metric.
- xcp_d.utils.qcmetrics.jc(input1, input2)[source]
Calculate Jaccard coefficient between two images.
Computes the Jaccard coefficient between the binary objects in two images.
- Parameters
input1/input2 (str) – Path to a NIFTI image. Can be any type but will be converted into binary: False where 0, True everywhere else.
- Returns
jc – The Jaccard coefficient between the object(s) in
input1
and the object(s) ininput2
. It ranges from 0 (no overlap) to 1 (perfect overlap).- Return type
Notes
This is a real metric.