MELD Graph performs automated FCD (Focal Cortical Dysplasia) lesion detection using FreeSurfer surfaces and deep learning.
- Version:
v2.2.3 - Data directory:
~/derivatives/{dataset}-derivatives/meld_graph_v2.2.3/ - Config directory:
~/code/{dataset}-code/meld_graph_v2.2.3/config/ - Output location:
~/derivatives/{dataset}-derivatives/meld_graph_v2.2.3/data/output/predictions_reports/ - Container:
meldproject/meld_graph:v2.2.3 - FreeSurfer version:
7.2.0(default input - required)
⚠️ Compatibility Note: MELD Graph requires FreeSurfer 7.2.0 or earlier. It does not work with FreeSurfer 7.3 and above. The default FreeSurfer version for MELD Graph is set to 7.2.0.
⚠️ Recommendation: MELD works best with T1w scans only. If using T1w+FLAIR, interpret results with caution as FLAIR may introduce more false positives.
MELD Graph has a unique three-step workflow:
- Download Weights (one-time setup): Download pretrained model weights
- Harmonization (optional but recommended): Compute scanner-specific harmonization parameters using 20+ subjects
- Prediction: Run lesion detection on individual subjects
MELD uses a specific directory structure with data in derivatives and config in code:
~/derivatives/{dataset}-derivatives/
└── meld_graph_v2.2.3/
└── data/
├── input/
│ └── sub-{id}/
│ ├── T1/T1.nii.gz
│ └── FLAIR/FLAIR.nii.gz (optional)
└── output/
├── predictions_reports/
├── fs_outputs/
└── preprocessed_surf_data/
~/code/{dataset}-code/
└── meld_graph_v2.2.3/
└── config/
├── meld_bids_config.json
└── dataset_description.json
Before first use, download the MELD Graph pretrained model weights:
ln2t_tools meld_graph --dataset mydataset --download-weightsThis downloads ~2GB of model weights into the MELD data directory.
Harmonization adjusts for scanner/sequence differences and improves prediction accuracy.
Requirements:
- At least 20 subjects from the same scanner/protocol
- Harmonization code (e.g.,
H1,H2) to identify this scanner - BIDS
participants.tsvfile with demographic data (see below)
Demographics Data:
ln2t_tools automatically creates the MELD-compatible demographics file from your BIDS dataset's participants.tsv. The participants.tsv file should contain:
Required columns:
participant_id: Subject ID (e.g., sub-001)age(orAge): Numeric age valuesex(orSex,gender,Gender): M/F or male/female
Optional columns:
group: patient or control (defaults to 'patient' if missing)
Example participants.tsv:
participant_id age sex group
sub-001 25 M patient
sub-002 28 F control
sub-003 32 M patientCompute harmonization parameters (demographics file auto-generated):
ln2t_tools meld_graph --dataset mydataset \
--participant-label 01 02 03 ... 20 \
--harmonize \
--harmo-code H1The demographics CSV is automatically generated from participants.tsv. If you need to inspect or customize it, it will be created at:
~/derivatives/{dataset}-derivatives/meld_graph_v2.2.3/demographics_H1.csv
The demographics CSV format:
ID,Harmo code,Group,Age at preoperative,Sex
sub-001,H1,patient,25,male
sub-002,H1,control,28,female
sub-003,H1,patient,32,maleThis runs FreeSurfer segmentation, extracts features, and computes harmonization parameters. Results saved in preprocessed_surf_data/.
Note: This step needs to be run only once per scanner. You can reuse the harmonization parameters for all future subjects from the same scanner.
Once setup is complete, run predictions on individual subjects.
# Single subject
ln2t_tools meld_graph --dataset mydataset --participant-label 01
# Multiple subjects
ln2t_tools meld_graph --dataset mydataset --participant-label 01 02 03ln2t_tools meld_graph --dataset mydataset \
--participant-label 01 \
--harmo-code H1If you already have FreeSurfer recon-all outputs:
ln2t_tools meld_graph --dataset mydataset \
--participant-label 01 \
--use-precomputed-fs \
--fs-version 7.2.0This will:
- Look for FreeSurfer outputs in
~/derivatives/{dataset}-derivatives/freesurfer_7.2.0/ - Bind them to
/data/output/fs_outputsin the container - Automatically skip the FreeSurfer segmentation step
- Use the existing FreeSurfer surfaces for feature extraction
If MELD features (.sm3.mgh files) are already extracted from a previous MELD run and you only want to rerun prediction:
ln2t_tools meld_graph --dataset mydataset \
--participant-label 01 \
--skip-feature-extractionImportant:
--skip-feature-extractiontells MELD to skip computing surface features (.sm3.mghfiles). Use this only when those files already exist from a previous MELD run.
Note: When using
--use-precomputed-fs, MELD automatically detects existing FreeSurfer outputs and skips recon-all, but still runs feature extraction to create.sm3.mghfiles. Don't use--skip-feature-extractionunless those feature files already exist.
# 1. Download weights (one-time)
ln2t_tools meld_graph --dataset epilepsy_study --download-weights
# 2. Compute harmonization with 25 subjects (one-time per scanner)
# Demographics automatically created from participants.tsv
ln2t_tools meld_graph --dataset epilepsy_study \
--participant-label 01 02 03 04 05 06 07 08 09 10 \
11 12 13 14 15 16 17 18 19 20 \
21 22 23 24 25 \
--harmonize \
--harmo-code H1
# 3. Run prediction on new patient with harmonization
ln2t_tools meld_graph --dataset epilepsy_study \
--participant-label 26 \
--harmo-code H1
# 4. Run prediction using precomputed FreeSurfer
ln2t_tools meld_graph --dataset epilepsy_study \
--participant-label 27 \
--use-precomputed-fs \
--fs-version 7.2.0 \
--harmo-code H1Results are saved in:
~/derivatives/{dataset}-derivatives/meld_graph_v2.2.3/data/output/predictions_reports/sub-{id}/
├── predictions/
│ ├── predictions.nii.gz # Lesion probability map in native space
│ └── reports/
│ ├── {id}_prediction.pdf # Visual report with inflated brain
│ ├── {id}_saliency.pdf # Model attention maps
│ └── {id}_mri_slices.pdf # Predictions on MRI slices
└── features/
└── {id}.hdf5 # Extracted surface features