Skip to main content

Crate bids_eeg

Crate bids_eeg 

Source
Expand description

EEG (Electroencephalography) support for BIDS datasets.

This crate provides typed access to all EEG-specific BIDS files and metadata, corresponding to the BIDS-EEG specification.

§Components

  • EegLayout — High-level interface for querying EEG files, channels, electrodes, events, metadata, coordinate systems, and physio data from a BidsLayout.
  • Channel / ChannelType — Typed representation of _channels.tsv entries with support for all BIDS channel types (EEG, EOG, ECG, EMG, TRIG, MISC, MEGMAG, MEGGRAD, ECOG, SEEG, DBS, etc.).
  • Electrode — Electrode positions from _electrodes.tsv with optional 3D coordinates, material, and impedance.
  • EegEvent — Events from _events.tsv with onset, duration, trial type, value, sample number, and response time.
  • EegMetadata — Typed EEG JSON sidecar metadata including sampling frequency, channel counts, placement scheme, reference, power line frequency, recording duration, and hardware/software filter descriptions.
  • CoordinateSystem — Coordinate system information from _coordsystem.json.
  • EdfHeader — Minimal EDF/BDF header parser for extracting channel count, sampling rates, channel labels, and recording duration directly from EEG data files.
  • EegData / ReadOptions — Read actual signal data from EDF, BDF, and BrainVision files, with support for channel inclusion/exclusion, time-range slicing, stim channel detection, and unit conversion. Use read_eeg_data for automatic format detection, or read_edf / read_brainvision directly.
  • Annotation — Time-stamped annotation parsed from EDF+ TAL channels, BDF status channels, or BrainVision .vmrk marker files.

§Example

use bids_eeg::EegLayout;

let eeg = EegLayout::new(&layout);
let summary = eeg.summary().unwrap();
println!("{}", summary);

for f in &eeg.get_eeg_files().unwrap() {
    if let Some(channels) = eeg.get_channels(f).unwrap() {
        println!("{}: {} channels", f.filename, channels.len());
    }
}

Re-exports§

pub use channels::Channel;
pub use channels::ChannelType;
pub use channels::read_channels_tsv;
pub use coordsystem::CoordinateSystem;
pub use csp::CSP;
pub use data::Annotation;
pub use data::EegData;
pub use data::ReadOptions;
pub use data::read_brainvision;
pub use data::read_brainvision_markers;
pub use data::read_edf;
pub use data::read_eeg_data;
pub use eeg_layout::EdfHeader;
pub use eeg_layout::EegDatasetSummary;
pub use eeg_layout::EegLayout;
pub use eeg_layout::PhysioData;
pub use electrodes::Electrode;
pub use electrodes::read_electrodes_tsv;
pub use events::EegEvent;
pub use events::read_events_tsv;
pub use harmonize::ChannelStrategy;
pub use harmonize::HarmonizationPlan;
pub use harmonize::apply_harmonization;
pub use harmonize::plan_harmonization;
pub use metadata::EegMetadata;
pub use pipeline::Pipeline as EegPipeline;
pub use pipeline::PipelineResult;

Modules§

channels
EEG channel definitions and _channels.tsv parsing.
coordsystem
Coordinate system information from _coordsystem.json.
csp
Common Spatial Patterns (CSP) for motor imagery BCI.
data
EEG signal data reading: EDF, BDF, and BrainVision formats.
eeg_layout
High-level EEG interface on top of BidsLayout.
electrodes
Electrode positions from _electrodes.tsv.
events
EEG events from _events.tsv.
harmonize
Channel harmonization across datasets.
metadata
Typed EEG metadata from JSON sidecars.
pipeline
Composable preprocessing pipeline for EEG data.