compute_framewise_displacement
- bidsaid.qc.compute_framewise_displacement(input_data, has_header=True, rotation_units='radians', radius=50, verbose=False)[source]
Computes the framewise displacement using the Power (2012) formula:
FDi=|Δxi|+|Δyi|+|Δzi|+|Δαi|+|Δβi|+|Δγi|
where i is the timepoint/volume
x, y and z are the three translation parameters
α, β and γ are the three rotational parameters
Δxi=xi−1−xi
Parameters
- input_data
str,Path,pandas.DataFrame, orNDArray Input data containing values to threshold. Can be a path to a text file (where delimiter is whitespace, tabs, or commas), a DataFrame.
Important
If
has_headeris False, then the first six columns will be assumed to be the three translations and three rotations.Assumes first three columns are translation parameters in mm and last three columns are rotation parameters in radians or degrees.
- has_header
bool, default=True Whether the input file has a header row. Only used when
input_datais a file path.- rotation_units
Literal["radians", "degrees"], default=”radians” The units of the rotation parameters.
- radius
intorfloat, default=50 The radius of the head in mm.
- verbose
bool, default=False Logs “INFO” level information if True.
Returns
- NDArray
A numpy array of the computed framewise displacements. Note that the first value will always be 0.
References
Power, J. D., Barnes, K. A., Snyder, A. Z., Schlaggar, B. L., & Petersen, S. E. (2012). Spurious but systematic correlations in functional connectivity MRI networks arise from subject motion. NeuroImage, 59(3), 2142–2154. https://doi.org/10.1016/j.neuroimage.2011.10.018
Mejia, A., Muschelli, J., & Pham, D. fMRIscrub: fMRI scrubbing (R package). https://neuroconductor.org/help/fMRIscrub/reference/FD.html