This release is a pre-release and may not be stable for production use.
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 modellabel: 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_ = 0prioritizes the CTF ratio, leading to better localization of sources potential contributing to the extracted signallambda_ = 1prioritizes 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 oflambda_to obtain a fraction (controlled withthreshold) of the maximal CTF ratio or homogeneity (controlled withcriteria):threshold- a number between 0 and 1 controlling the fractioncriteria- use either ratio (criteria="ratio") or homogeneity (criteria="homogeneity") for automatic suggestion oflambda_
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.4rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| roiextract-0.0.4rc1.tar.gz | 218.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| roiextract-0.0.4rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 254.2 kB
Release files / roiextract-0.0.4rc1.tar.gz
| Download URL | roiextract-0.0.4rc1.tar.gz |
|---|---|
| Size | 218.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b4ae667c30c24a1753dec2daa765148793c146704094a82ace5af1f386e93ee
|
|
BLAKE2b-256 checksum How to use checksums |
3cad26db4ceadac8e9def272b456347c8795dad1adf9cc7978842c93539d159f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 23, 2026.
Transparency logRelease files / roiextract-0.0.4rc1-py3-none-any.whl
| Download URL | roiextract-0.0.4rc1-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a82610176aaec0e8c1747ffa3f61fe17493114a8fcee10f10bb877402593464b
|
|
BLAKE2b-256 checksum How to use checksums |
50ddc828170282fcf34914b51b6c5de45c8fca5b4313f6a96cb80af7dab93c15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 23, 2026.
Transparency logSecurity for roiextract 0.0.4rc1
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.
Attestation for roiextract-0.0.4rc1.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 Sep 23, 2026.
Transparency logA 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.