Skip to main content

Data-independent and data-driven optimization of spatial filters for extraction of ROI time series based on M/EEG

Project description

ROIextract

Optimization of spatial filters for extraction of ROI time series based on the cross-talk function (CTF) or source reconstruction of spatial patterns (REC). Work in progress!

Background

TODO

Prerequisites

The toolbox is designed to be compatible with MNE-Python as much as possible, and optimization only requires:

  • fwd: mne.Forward - the description of the forward model
  • label: mne.Label - the description of the region of interest (parcel/label)

Parameters

There are several parameters of the optimization that need to be specified by the user:

  • lambda_ - this parameter allows fine-tuning the cross-talk function according to the demands of the analysis:
    • lambda_ = 0 prioritizes the CTF ratio, leading to better localization of sources potential contributing to the extracted signal
    • lambda_ = 1 prioritizes the CTF homogeneity, allowing to force contributions from the sources within the ROI to be more similar to a pre-specified template (see below)
    • values between 0 and 1 lead to a compromise between ratio and homogeneity
    • lambda = auto (experimental) - automatically selects the value of lambda_ to obtain a fraction (controlled with threshold) of the maximal CTF ratio or homogeneity (controlled with criteria):
      • threshold - a number between 0 and 1 controlling the fraction
      • criteria - use either ratio (criteria="ratio") or homogeneity (criteria="homogeneity") for automatic suggestion of lambda_
  • template - this parameter allows specifying the desired contributions of sources within ROIs, the following options are available:
    • mean - equal values for all sources (homogeneous contribution)
    • custom templates (e.g., gaussian) may be provided directly as an array of weights for all sources within the ROI

Usage

Obtain a spatial filter that optimizes CTF properties:

from roiextract import ctf_optimize_label

sf = ctf_optimize_label(fwd, label, template, lambda_)

sf, props = ctf_optimize_label(fwd, label, template, lambda_, quantify=True)

sf = ctf_optimize_label(fwd, label, template, lambda_='auto', threshold=0.95)

Plot the filter as a topomap:

sf.plot(info)

Apply it to the data to obtain the time course of activity in the ROI/label:

label_tc = sf.apply(data)

Estimate the CTF for the filter:

ctf = sf.get_ctf_fwd(fwd)  # ctf is an instance of mne.SourceEstimate

Plot the CTF on the brain surface:

ctf.plot()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roiextract-0.0.3.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

roiextract-0.0.3-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file roiextract-0.0.3.tar.gz.

File metadata

  • Download URL: roiextract-0.0.3.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for roiextract-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0b5340e5c504bc575409bf9259997aff1f067d0bf37fd11d637edf3da1c3eb76
MD5 25ed03adab811d3a31f19a57c0d151d0
BLAKE2b-256 9025bef8ba52dafb54d52aa6d94f5247626d552c204d19d6686816a553ec9907

See more details on using hashes here.

File details

Details for the file roiextract-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: roiextract-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for roiextract-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3dff06c009de422cb0e21f04b22d90eee66d5031b79734ae7825bce94dbe32ce
MD5 20afea99d6446b085b2f9aabbd3452a8
BLAKE2b-256 3cbef5b939b6ea354e9cf2d903f05685136b18f7eabe0479c777844ae6bf4115

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page