MRF-SEEG
About this project
Project Summary
MRF-SEEG investigates whether quantitative MRI tissue properties derived from Magnetic Resonance Fingerprinting (MRF) can serve as imaging biomarkers for epileptogenic tissue localization in patients with drug-resistant epilepsy undergoing stereo-EEG (SEEG) evaluation.
The core hypothesis is that T1 and T2 relaxation times at SEEG electrode contact locations - and the correlations between those MRF values and interictal/ictal spectral EEG activity - differ systematically between the epileptogenic zone (EZ) and non-involved zones (NIZ).
Cohort: N = 13 patients with drug-resistant focal epilepsy who underwent pre-operative MRF imaging followed by SEEG implantation at Cleveland Clinic. Active patients: ith2, ith5, ith6, ith7, ith9, ith10, ith11, ith13 Related work: MRF-CLIN manuscript (accepted, 2026)
Research Questions
- Do MRF-derived T1/T2 values differ at EZ vs. NIZ electrode contacts?
- Do quantitative tissue properties correlate with interictal/ictal spectral EEG power at those contacts?
- Can multimodal features (MRF + radiomics texture + spectral band power) improve seizure zone classification beyond imaging alone?
- Does distance from the EZ explain variance in MRF or spectral signatures?
Project Timeline & Phases
Phase 1 - Data Preparation (Aug-Oct 2024)
Key scripts: MRF-SEEG-data-prep.R, R/mrf-seeg-data-prep-unified.R, merge-MRF-CLIN-data.R
- Built the core data pipeline: co-registration of post-implant CT to pre-op MRF, electrode contact extraction using POM files (contact names + MNI coordinates)
- Merged clinical annotations (EZ labels, seizure outcome, resection data) to SEEG contact table
- Validated VEP atlas correspondence for anatomical parcellation of contacts
- Established 2 mm spherical ROI around each contact as the unit of MRF sampling (optimized from 1/2/4 mm comparison; see
doc/compare_1_2_4mm.qmd) - Initial cohort: 13 patients; usable contacts from gray matter contacts only
- Output: Master dataset
data/mrf-seeg-initial-13.xlsx,data/ith-all-2024-09-19.xlsx
Phase 2 - Normalization Development (Nov 2024 - Jan 2026)
Key scripts: R/2024-11-24-generate_normalized_brains.R, R/2025-11-14.R, mrf-normalization.py Documentation: doc/2025-01-07-first-look-at-mrf-values.qmd, 2026-01-22-norm_mtg.qmd
Inter-patient variability in raw MRF T1/T2 values is substantial due to scanner drift and protocol differences across acquisition dates. Multiple normalization strategies were evaluated:
| Approach | Notes | Outcome |
|---|---|---|
| Voxel-wise Z-score vs. atlas | Blurring at gray-white junction → spurious values | Abandoned |
| Published lookup tables (AES 2025) | Still boundary artifacts | Partial use |
| Nyúl histogram matching | Good between-patient alignment | Tested |
| LSQ (least-squares) | Computationally stable | Tested |
| Fuzzy C-means tissue segmentation | Promising but complex | Tested |
| Patient-wise Z-score | Simple, interpretable, robust to outliers | Current approach |
Breakthrough: Patient-wise Z-score normalization (T1/T2 standardized within each patient’s own brain tissue distribution) proved most practical. Explored via Python intensity_normalization package and R.
Challenges:
- Voxel-wise atlas approaches failed at tissue boundaries due to atlas blurring
- Nyúl/LSQ require careful anchor tissue selection
- No single normalization was universally superior - documented in
2026-01-22-norm_mtg.qmd
Phase 3 - SEEG Power Spectral Density Ingestion (Feb 2026)
Key scripts: R/2026-02-17-psd-first-look.R, R/2026-02-17-psd-calculations.R, R/2026-02-19-psd_graphs.R
- Ingested per-patient SEEG PSD data stored as MATLAB
.matfiles in HDF5 format (rhdf5package) - Computed frequency band power: delta (1-4 Hz), theta (4-8 Hz), alpha (8-12 Hz), beta (12-30 Hz), gamma (30-80 Hz), high gamma (80-200 Hz)
- Generated per-contact band power summaries and merged to the master MRF-SEEG table
- First-look visualizations showed band power differences across clinical zones
Challenge: HDF5 file structure varied slightly between patients; required patient-specific parsing logic.
Phase 4 - Correlation Analyses & Statistical Modeling (Feb-Apr 2026)
Key scripts: R/2026-02-23-psd-correlations.R, R/2026-02-26-psd-correlations.R, R/2026-03-09-logistic-regression.R, R/2026-04-08-group-level-psd.R, R/2026-04-13-group-analysis-psd.R
- Computed Pearson/Spearman correlations between T1/T2 and each spectral band across contacts within patients
- Fitted generalized linear mixed-effects models (GLMM) with EZ membership as binary outcome, MRF and/or spectral features as predictors, random intercepts per patient
- AUC summaries:
results/glmm_auc_summary_2026-04-13.csv - Logistic regression with bootstrapped 95% CIs for key predictors
Breakthrough: Certain frequency bands (particularly high gamma) showed consistent positive correlation with MRF T1/T2 deviations in the EZ across patients, supporting the multimodal signal.
Challenge: Nested data structure (contacts within patients) requires careful handling; naive models inflate significance. Mixed-effects approach chosen but requires sufficient random-effects variation across N=13 patients.
Phase 5 - Radiomics Feature Extraction (Nov 2025 - Apr 2026)
Key scripts: extract_radiomics.ipynb, merge_radiomics_to_clinical.ipynb, radiomics_feature_decide.ipynb
- Extracted first-order and texture (GLCM) radiomics features from 2 mm spherical ROIs using PyRadiomics
- Features per contact: mean intensity, entropy, GLCM contrast, correlation, energy, homogeneity
- Merged to master table; feature selection via correlation filtering and PCA
- PCA attempted on combined MRF + radiomics feature space (
2026-04-13-pca-attempt.R,2026-04-13-pca-gm-only.R)
Challenge: Radiomics features are highly correlated with mean T1/T2 - limited additive value in univariate analyses. More useful in combined multivariate embedding (UMAP).
Phase 6 - Publication Figures & Final Analyses (Apr-Jun 2026)
Key scripts: R/fig2_raincloud.R, R/fig3_fingerprint.R, R/fig4_corr_spectrum.R, R/fig5_umap.R, R/2026-06-01-distance-to-EZ.R, R/2026-06-02-distance-to-EZ.R
Current focus - generating finalized publication figures and distance-to-EZ analyses:
| Figure | Description | Status |
|---|---|---|
| Fig 1 | T1/T2 distributions across clinical zones | In development |
| Fig 2 | Raincloud plots of spectral band power by zone | Generated (R/fig2_final.png) |
| Fig 3 | Patient fingerprint matrix (T1/T2 vs. band power correlations) | Generated (R/fig3_final.png) |
| Fig 4 | Correlation spectrum across frequency bands | In development |
| Fig 5 | UMAP embedding: MRF + radiomics + spectral features | Generated (R/fig5_umap_v3.R) |
Distance-to-EZ analysis (most recent, Jun 2026): Testing whether MRF and spectral signatures vary as a function of spatial distance from the EZ centroid - may serve as continuous validation of the spatial specificity of the signal.
Data Architecture
Input Data
- Clinical table:
data/ith-all-2025-01-22.xlsx- demographics, EZ labels, surgical outcomes - Per-patient MRF volumes:
mrf_T1__@_#fsWarped.nii.gz,mrf_T2__@_#fsWarped.nii.gz(FreeSurfer-warped to MNI) - Electrode POM files: Contact names and MNI coordinates per patient
- SEEG PSD:
.mat(HDF5) files per patient - VEP atlas:
aparc+aseg.vep.nii.gz+ lookup table for anatomical parcellation
Processed / Intermediate
data/mrf_seeg_merged_data_2025-11-14.csv- master merged dataset (~3.8 MB)data/mrf_psd_long_ith{N}_DATE.Rds- per-patient long-format PSD-merged dataresults/radiomics_features/ith{N}_radiomics_features.csv- per-patient PyRadiomics output
Key Output Files
results/glmm_auc_summary_2026-04-13.csvresults/glmm_coef_table_2026-04-13.csvresults/t1_normalization_stats.csv,results/t2_normalization_stats.csvresults/summary_statistics.csvresults/table1_demographics.docx
Technical Challenges & Solutions
1. MRF Normalization
Problem: Raw MRF T1/T2 values vary substantially between patients due to scanner/protocol drift, making direct cross-patient comparisons unreliable. Attempted solutions: Voxel-wise atlas Z-score, Nyúl histogram matching, LSQ, Fuzzy C-means. Current solution: Patient-wise Z-score normalization. Each contact’s T1/T2 is expressed as standard deviations from that patient’s own tissue distribution. Residual concern: Does not account for true between-patient biological variation; treats all between-patient variance as noise.
2. Electrode Localization
Problem: Post-implant CT to pre-op MRI co-registration is complicated by brain shift post-implantation and susceptibility artifacts from the electrodes. Solution: Manual QC of each patient’s contact localization; contacts with uncertain placement excluded.
3. ROI Definition
Problem: What spatial extent should be used to sample MRF at each contact? Solution: 2 mm sphere (established via doc/compare_1_2_4mm.qmd); 1 mm too noisy, 4 mm over-samples.
4. Statistical Model Structure
Problem: Contacts are nested within patients; patients have different numbers of contacts and EZ proportions. Solution: GLMM with random intercepts per patient. N=13 limits random-effects estimation precision.
5. SEEG PSD Data Format
Problem: MATLAB HDF5 .mat files have patient-specific internal structure. Solution: Custom per-patient parsing logic in rhdf5; harmonized into long-format tidy data.
Key Findings (Preliminary)
- MRF T1/T2 values (patient-normalized) tend to be elevated at EZ contacts compared to NIZ, consistent with microstructural tissue abnormality in epileptogenic regions
- High-gamma band power shows positive correlation with T1/T2 deviation at the contact level
- Patient “fingerprint” patterns (Fig 3) are heterogeneous - some patients show strong MRF-spectral coupling, others do not - suggesting patient-level moderators (lesional vs. non-lesional, focal vs. multifocal EZ)
- UMAP of combined MRF + radiomics + spectral features shows partial separation of EZ from NIZ contacts
- Distance-to-EZ analysis (ongoing) may provide a continuous validation metric
Open Questions & Next Steps
Repository Structure
MRF-SEEG/
├── R/ # 85+ analysis scripts (date-prefixed)
├── data/ # Input and processed datasets
│ └── raw/ # Original source files
├── doc/ # Meeting notes, exploratory QMDs
│ └── AES-2025/ # AES 2025 abstract materials
├── results/ # Model outputs, summary CSVs
│ └── radiomics_features/
├── figures/ # Publication figures and per-patient plots
├── *.ipynb # Python: radiomics extraction, feature selection
├── mrf-normalization.py # Python: normalization comparison tool
├── project-overview.qmd # This file
└── 2026-01-22-norm_mtg.qmd # Normalization methods documentation
Dependencies
R packages: tidyverse, patchwork, ggrepel, lme4, lmerTest, pROC, RNifti, neurobase, rhdf5, caret, umap, ggdist (raincloud), oro.nifti
Python packages: pyradiomics, intensity_normalization, nibabel, numpy, pandas, h5py, matplotlib
Last updated: r Sys.Date()
Concept notes and other ideas
| Date | Title |
|---|---|
| Jun 30, 2026 | MRF-SEEG Coordinate Space Reference |
Reading notes
| year | Title | Author |
|---|
Meeting notes
Weeks in which I worked on this project
| Title | projects | keywords |
|---|---|---|
| Week of 2026-04-20 | syn7T, MRF-SEEG | |
| Week of 2026-05-18 | syn7T, MRF-SEEG | |
| Week of 2026-05-25 | MRF-SEEG | |
| Week of 2026-06-22 | MRF-SEEG | |
| Week of 2026-06-29 | MRF-SEEG, HEMI-SLIM, MULTI-PET, TELE-PET | |
| Week of 2026-07-06 | syn7T, MRF-SEEG, HEMI-SLIM, FB-GEN, TELE-PET | |
| Week of 2026-07-13 | syn7T, MRF-SEEG, mrfx, SEEG-db, MSc |