ToFFi_Toolbox
Revision 20211013.
view repo
Spectral fingerprints (SFs) are unique power spectra signatures of human brain regions of interest (ROIs, Keitel Gross, 2016). SFs allow for accurate ROI identification and can serve as biomarkers of differences exhibited by non-neurotypical groups. At present, there are no open-source, versatile tools to calculate spectral fingerprints. We have filled this gap by creating a modular, highly-configurable MATLAB Toolbox for Frequency-based Fingerprinting (ToFFi). It can transform MEG/EEG signals into unique spectral representations using ROIs provided by anatomical (AAL, Desikan-Killiany), functional (Schaefer), or other custom volumetric brain parcellations. Toolbox design supports reproducibility and parallel computations.
READ FULL TEXT VIEW PDFRevision 20211013.
Brain dynamics and brain oscillations are among the most important topics in neuroscience. Different methods proved to be useful for studying robust whole-brain, as well as regionally-specific patterns of activity, called brain fingerprints. They can serve as signatures for mental states during task execution or rest bola_dynamic_2015 , krienen_reconfigurable_2014 , ciric_contextual_2017 , keynan_limbic_2016 . Frequency of oscillations turned out to be one of the key features in many studies describing particular regions of interest (ROIs) siegel_spectral_2012 , mellem_intrinsic_2017 , keitel_individual_2016 and large-scale brain networks mahjoory_frequency_2020 , samogin_shared_2019 , marino_neuronal_2019 , hacker_frequency-specific_2017 , rosanova_natural_2009 . Spectral fingerprints (Fig. 1) play a role as biomarkers that are sufficiently specific to permit the successful identification of brain regions using their spectral characteristics. Moreover, spectral profiles’ peaks that correspond to the natural frequencies of ROIs rosanova_natural_2009 , ferrarelli_reduced_2012 , are consistently modulated by specific tasks, neurological or mental disorders. They can be generalized across groups of participants lubinus_data-driven_2021 , keitel_individual_2016 . In this paper, we introduce a novel implementation of the Spectral Fingerprinting technique, in a highly configurable MATLAB toolbox.
There are many open software packages available to analyze neural data. The Fieldtrip Toolbox111https://www.fieldtriptoolbox.org/ ; accessed: 14.10.2021 oostenveld_fieldtrip:_2010 was designed to perform analysis both on sensor and source level of EEG/MEG/iEEG/NIRS data. EEGLAB222https://eeglab.org/ ; accessed: 14.10.2021 delorme_eeglab_2004 helps with processing continuous and event-related electrophysiological data implementing many analytic methods (ICA, time/frequency analysis, artifact rejection, event-related statistics, microstates analysis) and several useful routines for visualization. To simulate brain dynamics, perform connectivity analyses, and solve forward/inverse problems, the supFunSim333https://github.com/nikadon/supFunSim ; accessed: 14.10.2021 toolbox rykaczewski_supfunsim_2021 and the Virtual Brain444https://www.thevirtualbrain.org/ ; accessed: 14.10.2021 system sanz_leon_virtual_2013 are among suitable choices. However, there is no open software for analyzing spectral fingerprints, and our work attempts to fill this gap. We designed the Toolbox for Frequency-based Fingerprinting (ToFFi, https://github.com/micholeodon/ToFFi_Toolbox) for analysis of MEG, EEG, and other multichannel data. Users can configure many parameters for each stage of processing, including the selection of the brain parcellation, and decide which of them will run in parallel (cluster computations are supported). Results of the calculations are reproducible thanks to the implemented control using pseudo-random number generators and visualization scripts.
ToFFi is a modular piece of software that consists of five components: I. Data Preparation, II. Spectral Fingerprinting, III. Analysis, IV. Presentation, and V. Maintenance (Fig. 2). The Data Preparation module (I) is responsible for arranging sensor time series signals, spatial filters, and brain parcellation data, for processing by the second step routines. The Spectral Fingerprinting (II) module transforms MEG/EEG multichannel array of signals, through a series of five stages, into spatially localized power spectrum-driven representations called spectral fingerprints (Fig. 3
). Fourier Transform, source reconstruction (beamforming), and Gaussian Mixture Modeling algorithms are used to compute spectral fingerprints both at the individual and the group level. The third component (III) consists of additional routines that can analyze particular output files from component II. Currently, we have implemented group-level brain regions identification, individual-level brain regions identification, and regional clustering (network analysis) - all based on the concept of modeling brain activity as spectral fingerprints. The Presentation component (IV) is a collection of auxiliary scripts used to visualize particular results of performed computations for easier interpretation. Maintenance routines (V) are used to automate some parts of the workflow, e.g.: manage configuration files, manage output data files, etc. A more detailed description of how the data are transformed can be found in
A (6. METHODS), Fig. 4, Fig. 5, and Fig. 6, which summarize the whole pipeline.Spectral Fingerprinting can be performed on multichannel time series data (e.g. MEG, EEG) of arbitrary size, with any sampling-frequency adjusted to the desired frequency resolution, acquired from a single multiple subjects, and divided into segments of selected, equal duration (e.g. 1000 ms). These segments may contain non-overlapping pieces of a continuous recording (e.g. resting-state) or trials with brain responses for several repetitions of the same experimental condition (event-related paradigm). For individual-level analysis, the toolbox offers a reconstruction of voxel-wise time series power spectra with beamforming using precomputed spatial filters (e.g. LCMV, van_veen_localization_1997 , sekihara_adaptive_2008
) and multichannel empirical sensor signals or artificial white Gaussian noise signals. Power spectra of ROIs can be estimated both at individual and group level, using different brain parcellations (anatomical: AAL
tzourio-mazoyer_automated_2002 , Desikan-Killiany desikan_automated_2006 ; functional: Schaefer schaefer_local-global_2018), and optionally normalized. These spectra can be clustered (currently, only the k-means algorithm is implemented) with arbitrary distance metric and subsequently modeled as a regularized Gaussian mixture of regional spectra with a fixed or optimal number of clusters to construct group-level fingerprints. The user can also estimate the accuracy of identification of brain regions from their spectral fingerprints using cross-validation. Hierarchical clustering of spectral fingerprints (network analysis) was also implemented. The scope of selected brain regions of interest (ROIs) and set of subjects of choice can be limited if desired. For the majority of stages, one can perform computations in parallel on a single computer with multiple cores, or on a grid of multiple-core machines orchestrated via workload manager (currently, only SLURM manager is supported). Interpretation of the outputs of the software components II and III are supported with visualization routines. For reproducibility, data maintenance routines and pseudo-random generator control are implemented as well.
The toolbox can be operated under Linux, macOS, and Windows systems. Maintenance scripts (V) are coded mostly in Bash, which is accessible both for Linux (as default) and Windows (using Cygwin, cmder, or other shell emulator). All calculations are carried out entirely in MATLAB (version R2021a or newer is recommended) with Signal Processing Toolbox, Statistics and Machine Learning Toolbox, Parallel Computing Toolbox, and open-source Fieldtrip Toolbox (version 20210816 or newer is preferred,
oostenveld_fieldtrip:_2010 ). Additionally, vline.m and hline.m functions555https://www.mathworks.com/matlabcentral/fileexchange/1039-hline-and-vline ; accessed: 14.10.2021 by Brandon Kuczenski are used for plotting, and HZmvntest.m function666https://www.mathworks.com/matlabcentral/fileexchange/17931-hzmvntest ; accessed: 14.10.2021 by Antonio Trujillo-Ortiz for multivariate normality testing. If the user wishes to enable cluster computations, the toolbox is prepared to work in coordination with the SLURM workload manager777https://slurm.schedmd.com/ ; accessed: 14.10.2021. To the best of our knowledge, there is no other software for Spectral Fingerprinting available, apart from the illustrative beta-version script referenced by the authors of keitel_individual_2016 .Keitel and Gross keitel_individual_2016 showed that rendering regional brain activity as a combination of spectra via Spectral Fingerprinting allows for the identification of ROIs with high accuracy. They noticed that clustering of the brain areas according to the similarity of spectral profiles shows patterns similar to macroscale organization of the human brain cortex. Auditory spectral profiles turned out to be modulated during auditory processing. Lubinus and colleagues lubinus_data-driven_2021 have discovered that visual deprivation is reflected in the modulation of spectral fingerprints, indicating possible correspondence with the structural and functional adaptation of the human brain. Likewise, Mellem with collaborators mellem_intrinsic_2017 demonstrated via a similar method that there is a mix of lower and higher frequency peaks across the brain and it does not follow a simple lower order-higher order processing hierarchy.
Please consult the following parts of A to run Illustrative Example smoothly: Chapter 2. Conventions - to learn notation used throughout the documentation; Chapter 3. Installation - to set up a computational environment properly, Sections 5.3 and 5.4 - to get the input data.
After installation, one is advised to follow the instructions in Chapter 4. Illustrative Example in A to complete the illustrative example using the Human Connectome Project MEG dataset (HCP Reference Manual, van_essen_wu-minn_2013 ). We have selected N=10 subjects with the MEG resting-state cleaned signal acquired via a 248 channel array in three subsequent runs, approximately 3 min each.
Spectral Fingerprinting routines were configured to optimize the frequency resolution for the lower frequencies, thus accounting for the power trend present in the typical electrophysiological activity of the human brain. The proper number of clusters to be constructed was estimated using the Silhouette optimality criterion. Choosing cosine dissimilarity as a distance measure helped to compose frequency clusters of power spectra similar in shape, diminishing the influence of the power spectra amplitude. To speed up computations, the number of CPU cores was set to two.
Group-level fingerprints in the 1–40 Hz frequency interval from 8 distant regions of the human brain (ROIs; Fig. 7) were found (Fig. 8). The similarity of fingerprints was assessed (Fig. 9), together with the accuracy of how well one can identify them (Fig. 10).
The proposed method allowed for discrimination between different modes of operation for a range of brain areas. Dominant and supportive group-level oscillation profiles were recognized and separated. Functional similarity between homologue areas was confirmed using hierarchical clustering analysis. Recognition of the brain areas based on their spectral fingerprints turned out to be challenging among homologue areas due to their functional similarity, yet remaining informative.
Spectral Fingerprinting allows for the discovery of meaningful oscillatory patterns from electrophysiological time series that can show task-induced modulations or serve as a signature of the brain’s regional activity in the particular parcellation. Our novel Toolbox for Frequency-based Fingerprinting (ToFFi) provides researchers with a modular, highly configurable tool for computing regional source-reconstructed power spectra, finding optimal prototypes common for a group of subjects via individual- and group-level clustering algorithms, together with testing their properties using additional analytical routines. The efficiency is boosted with parallel computation support, and reproducibility is controlled with pseudo-random number generator parameters. An in-depth understanding of the underlying algorithms is facilitated by the function reference (B) and the toolbox manual (A). Presented software is compatible with various modern tools used by the neuroscientific community and allows easy adaptation of its modular structure to specific tasks.
Funding: This work has been supported by the National Science Centre, Poland, grant UMO-2016/20/W/NZ4/00354. Data were provided [in part] by the Human Connectome Project, WU-Minn Consortium (Principal Investigators: David Van Essen and Kamil Ugurbil; 1U54MH091657) funded by the 16 NIH Institutes and Centers that support the NIH Blueprint for Neuroscience Research; and by the McDonnell Center for Systems Neuroscience at Washington University. Calculations were carried out at the Tricity Academic Supercomputer & Network Center in Gdańsk. We thank professor Joachim Gross for his generous technical support, Ewa Ratajczak, and Bartosz Kochański for helping out with testing and debugging the software.
A spectral fingerprint of the inferior parietal lobule. For this particular region, it consists of two spectral modes. It is formed by clustering power spectra segments (normalized, i.e. spectral power in comparison to the whole brain) first on the individual subjects level and then clustered again on the group level. Each mode corresponds to one of the centroids found by the clustering algorithm. Shaded regions depict the standard deviation (
) estimated from the covariance matrix of the Gaussian Mixture Model component corresponding to the given spectral mode. The first mode peaks at 12.5 Hz, and the second mode peaks at 20.5 Hz. The frequency axis resolution can be set to logarithmic to optimize spectral analysis resolution of lower frequencies. Duration is shown as a percentage of time segments in which each spectral mode was present on average during recording.of a given brain region and depicted as an interpolant curve spanned between the frequencies of interest in the resulting fingerprint (interpolation type is arbitrary, as it serves visualization purpose only).
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Group-level identification accuracy: a) bar plot showing the average identification accuracy across cross-validation iterations (leave-one-out), b) confusion matrix showing in each row a distribution of ”votes” for each ROI. Each ROI was tested ten times (model trained on nine subjects versus one validation subject). For ideal identification, this matrix would have a value of 10 for the diagonal elements and zeros elsewhere. Confusion happens mostly between homologue areas (2x2 red boxes). Left hemisphere ROIs are recognized as the right hemisphere homologue areas.
Functions reference documents most important M-File Functions of the ToFFi Toolbox.
It can be accessed after downloading/cloning the ToFFi Toolbox repository (https://github.com/micholeodon/ToFFi_Toolbox).
Functions reference can be found here:
ToFFi_Toolbox-YYYYMMDD/docs/FUNCTIONS_REFERENCE.html, where YYYYMMDD stands for the toolbox revision number.
M. Siegel, T. H. Donner, A. K. Engel, Spectral fingerprints of large-scale neuronal interactions, Nature Reviews Neuroscience 13 (2) (2012) 121–134.
doi:10.1038/nrn3137.A. Delorme, S. Makeig, EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics including independent component analysis, Journal of Neuroscience Methods 134 (1) (2004) 9–21.
doi:10.1016/j.jneumeth.2003.10.009.B. Van Veen, W. Van Drongelen, M. Yuchtman, A. Suzuki, Localization of brain electrical activity via linearly constrained minimum variance spatial filtering, IEEE Transactions on Biomedical Engineering 44 (9) (1997) 867–880.
doi:10.1109/10.623056.