Skip to main content

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, 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()

Metadata

Release files for roiextract 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for roiextract 0.0.4
File Size Uploaded Provenance
roiextract-0.0.4.tar.gz 218.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for roiextract 0.0.4
File Interpreter ABI Platform
roiextract-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 253.9 kB

Release files / roiextract-0.0.4.tar.gz

Download URL roiextract-0.0.4.tar.gz
Size 218.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0f3918b22bd87004b93728983d78b01aa3b9136a1e97f158db4c487f091629ce
BLAKE2b-256 checksum
How to use checksums
e3619db8dfe5f19778ee1cccc522fd895611905357924711b5f8dac69c3f848d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / roiextract-0.0.4-py3-none-any.whl

Download URL roiextract-0.0.4-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d66fbe714523ae2009484402692455df77a0415218272726b0a7eb611de2d65d
BLAKE2b-256 checksum
How to use checksums
041cd61ac41065f4d7896a7c4cef5f970d70a3be0be3c6695dab00b0b9559d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for roiextract 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for roiextract-0.0.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page