How nathanklineinstitute/natview_eegfmri works
Project Type & Purpose
• Open-source neuroimaging preprocessing toolkit.
• Automates gradient/pulse artifact removal in EEG, CCS-based fMRI preprocessing, eye-tracking conversion/QC, and stimulus presentation scripts for simultaneous EEG-fMRI experiments.
High-Level Architecture & Main Components
A. Data Store (BIDS Input)
• Raw data in BIDS format:
• /sub-*/eeg/*.bvef + .edf
• /sub-*/func/*.nii.gz (fMRI)
• /sub-*/eye/*.edf
• respiratory data
B. EEG Preprocessing Module
• natview_eeg_preprocess_pipeline.m
• BC-MR-64-X52.bvef (cap montage)
• Dependencies: EEGLAB + FMRIB plugin
• Output: cleaned EEG files (e.g., .set/.fdt) in BIDS derivatives
C. fMRI Preprocessing Module
• Bash scripts under fmri/preprocessing (ccs_bids_*.sh)
• Python helper (json2txt)
• Templates: MNI152 brain masks, config files
• Dependencies: CCS pipeline (FSL, FreeSurfer, AFNI)
• Output: preprocessed anatomical/functional images in BIDS derivatives
D. Eye-Tracking Preprocessing Module
• natview_eye_edf2bids.m (EDF→BIDS conversion)
• natview_eye_preprocess_blinks.m (blink detection/interpolation)
• natview_eye_data_qc.m (data-quality metrics)
• Dependencies: EEGLAB, EyeLink SDK
• Output: cleaned eye-tracking .tsv + QC reports
E. Stimulus Presentation Module
• natview_stimuli_checkerboard.m
• natview_stimuli_video.m
• Helpers.zip (custom functions)
• Dependencies: Psychtoolbox-3, EyeLink 1000 Plus drivers
• Output: stimulus timing logs for synchronization
F. Orchestration/Entry Point
• natview_cleaning_pipeline.m (master MATLAB script to launch modalities)
Relationships & Data Flow
• Eye Module: EDF→BIDS → blink detection → QC → output.
• Stimulus Module: initialization → display routines → log output.
• The Orchestration script invokes EEG, Eye, fMRI modules as appropriate.
• All modules write back to “BIDS Derivatives” folder.
Architectural Patterns & Design Principles
• Modularity by modality (EEG, fMRI, Eye, Stimulus).
• BIDS standard enforces consistent data organization.
• Shell/Python drivers wrap third-party pipelines (CCS, EEGLAB).
• MATLAB scripts isolate domain logic per modality.
Technology Stack Call-Outs
• MATLAB + EEGLAB/FMRIB plugin
• Bash + CCS pipeline (FSL, FreeSurfer, AFNI)
• Python (simple JSON→TXT converter)
• Psychtoolbox-3 + EyeLink SDK