xcp_d.utils.restingstate module
Functions for calculating resting-state derivatives (ReHo and ALFF).
- xcp_d.utils.restingstate.compute_2d_reho(datat, adjacency_matrix)[source]
Calculate ReHo on 2D data.
- Parameters:
datat (numpy.ndarray of shape (V, T)) – data matrix in vertices by timepoints
adjacency_matrix (numpy.ndarray of shape (V, V)) – surface adjacency matrix
- Returns:
kcc – ReHo values.
- Return type:
numpy.ndarray of shape (V,)
- xcp_d.utils.restingstate.compute_alff(data_matrix, low_pass, high_pass, TR, sample_mask=None)[source]
Compute amplitude of low-frequency fluctuation (ALFF).
- Parameters:
data_matrix (numpy.ndarray) – data matrix points by timepoints
low_pass (float) – low pass frequency in Hz
high_pass (float) – high pass frequency in Hz
TR (float) – repetition time in seconds
sample_mask (numpy.ndarray or None) – (timepoints,) 1D array with 1s for good volumes and 0s for censored ones.
- Returns:
alff – ALFF values.
- Return type:
Notes
Implementation based on Yu-Feng et al.[1], although the ALFF values are not scaled by the mean ALFF value across the brain.
If a
sample_mask
is provided, then the power spectrum will be estimated using a Lomb-Scargle periodogram [2][3][4][5].References
- xcp_d.utils.restingstate.mesh_adjacency(hemi)[source]
Calculate adjacency matrix from mesh timeseries.
- Parameters:
hemi ({“L”, “R”}) – Surface sphere to be load from templateflow Either left or right hemisphere
- Returns:
Adjacency matrix.
- Return type:
Notes
Modified by Taylor Salo to loop over all vertices in faces.