Capturing brain dynamics with topological data analysis