This folder contains the analysis scripts used to generate the results presented in the manuscript. The scripts analyze FlowGAN-generated synthetic FDG-PET images for two patient populations: Temporal Lobe Epilepsy (TLE) and Mild Cognitive Impairment (MCI).
The analysis pipeline compares three imaging modalities:
- Real FDG-PET: Ground truth metabolic imaging
- Synthetic FDG-PET: FlowGAN-generated images from ASL and T1w MRI
- ASL: Arterial Spin Labeling perfusion imaging
Two brain atlases are supported:
- DKT Atlas: Native space parcellation
- Harvard-Oxford Atlas: MNI space parcellation
| Script | Description |
|---|---|
00_prepare_data.py |
Data preparation from raw imaging files (requires original NIfTI data) |
01_quality_metrics.py |
Image quality metrics - SSIM, PSNR, RMSE, NCC (requires original NIfTI data) |
02_regional_analysis.py |
Regional correlation and Bland-Altman analyses |
03_congruency_analysis.py |
Sign congruency analysis for asymmetry direction |
04_lateralization_cohens_d.py |
Cohen's d effect sizes for clinical discrimination |
manuscript_values.py |
Extracts all manuscript values with statistics |
utils.py |
Shared utility functions |
run_all.py |
Master script to run all analyses |
Note: Scripts 00_prepare_data.py and 01_quality_metrics.py require access to original NIfTI imaging data which are not included in this package. Reviewers should use the pre-computed pickle files and run analyses 02-04.
| File | Description |
|---|---|
df_pet_merged.pkl |
TLE dataset (DKT atlas) |
df_pet_merged_mci.pkl |
MCI dataset (DKT atlas) |
df_pet_merged_ho.pkl |
TLE dataset (Harvard-Oxford atlas) |
df_pet_merged_mci_ho.pkl |
MCI dataset (Harvard-Oxford atlas) |
Each pickle file contains a pandas DataFrame with columns:
subject: Subject identifierregion_name: Brain region nameside: Hemisphere (L/R)value_pet_original: Real FDG-PET SUVRvalue_pet_recon: Synthetic FDG-PET SUVRvalue_asl: ASL rCBFatlas_index: Atlas region index
| File | Description |
|---|---|
clinical_metadata.xlsx |
TLE clinical metadata (lateralization info) |
list_of_control_subjects.txt |
MCI control subject list |
list_of_MCI_subjects.txt |
MCI patient subject list |
dkt.csv |
DKT atlas region definitions |
ho.csv |
Harvard-Oxford atlas region definitions |
Install required packages:
pip install -r requirements.txtTo run the complete pipeline (using pre-computed pickle files):
python run_all.py --skip-data-prepThe --skip-data-prep flag uses the pre-computed pickle files instead of regenerating them from raw imaging data.
Each script can be run independently:
python 02_regional_analysis.py
python 03_congruency_analysis.py
python 04_lateralization_cohens_d.py
python manuscript_values.py--skip-data-prep: Use existing pickle files (recommended for reviewers)--tle-only: Run only TLE analyses--mci-only: Run only MCI analyses--include-ho: Include Harvard-Oxford atlas analyses
Results are saved to:
figures/: PDF and PNG figures organized by analysistables/: CSV and Excel tables organized by analysis
The flowgan_code/ directory contains the full FlowGAN pipeline for training and running inference. See flowgan_code/README.md for detailed instructions.
- Inference: Run FlowGAN on new ASL + T1 data to generate synthetic FDG-PET images using pretrained models (TLE or MCI cohort)
- Training: Train new FlowGAN models from scratch (standard, augmented, or k-fold cross-validation)
Quick start (inference):
cd flowgan_code/code
python run_FlowGAN.py --subs_file ../sample_list_of_subjects.txt --data ../sample_data/ --output_dir ../sample_data_outputs/ --model MCI