MELD graph

Author

Romain Ligneul

This tutorial explains how to use the tool MELD graph on the cluster, to infer FCD lesion from T1w images.

Note

Given that setting up the environment is a bit tedious, it is better to use the premade one at /mnt/data/meld_env. Please do not make changes to this common resource (i.e. do not run pip / conda install commands once you’ve activated it)

Before running MELD

Log into the CRNL cluster entry point. Then, open a terminal on the GPU node (node23) by typing: ssh node23 This will require your credentials (same as the ones used for wiki.crnl.fr)

Before using MELD, you should always set-up Freesurfer: export FREESURFER_HOME=/mnt/data/soft/freesurfer source $FREESURFER_HOME/SetUpFreeSurfer.sh

If you want to do this only once, you may run these lines

echo 'export FREESURFER_HOME=/mnt/data/soft/freesurfer' >> ~/.bashrc
echo 'source "$FREESURFER_HOME/SetUpFreeSurfer.sh"' >> ~/.bashrc
source ~/.bashrc
Warning

Each time you connect, you should probably tell meld which data folder you’ll be using by typing: /mnt/data/meld_graph/meldgraph.sh prepare_classifier.py Check the current data folder and if it is not the good one, type n and indicate your own data folder (e.g. /mnt/data/meld_data_JJ in this tuto)

Import new data (T1 images)

If you are using sensitive patient’s data, it is probably a good idea to define your own data folder that you will be the only one allowed to access. First, create this folder in /mnt/data/. For example, /mnt/data/meld_data_JJ will be used for this tutorial. All paths refering to it should be changed unless you are JJ ;).

To make sure that only you can read these file, run: chmod -R 700 /mnt/data/meld_data_JJ

Import new data (T1 images)

Use Filezilla or any approach you like to import T1 anatomical files into the folder /mnt/data/meld_data_JJ/input.

Note that MELD uses the BIDS convention, so you should add the data in the following way:

/mnt/data/meld_data_JJ/input
|—subj-01
| |—T1
| | |—T1w.nii.gz

MELD might work with not zipped images as well (i.e. .nii images without .gz extension), but I have not tested it.

You should indicate the name of the subject to be analyzed (e.g. subj-01) in the file /mnt/data/meld_data_JJ/list_subjects.txt and also populate the file /mnt/data/meld_data_JJ/demographics_file.csv that is needed to compute harmonisation parameters.

Note

Full documentation about data preparation is available here.

Compute harmonization parameters

Run the following: /mnt/data/meld_graph/meldgraph.sh new_pt_pipeline.py -harmo_code H1 -ids /mnt/data/meld_data_JJ/list_subjects.txt -demos /mnt/data/meld_data_JJ/demographics_file.csv --harmo_only

The harmo_code parameter should be different for each different scanner / sequence, so it might be a good idea to have different .txt files for lists of subjects acquired with different sequences.

Predict FCD-lesion on a specific subject

Change sub-001 by whatever subject you want to predict (and set the harmonisation code accordingly)

/mnt/data/meld_graph/meldgraph.sh new_pt_pipeline.py -id sub-001 -harmo_code H1

Predict FCD-lesion on all subjects in the dataset

This command will run the pipeline on all the subjects of a given .txt file.

/mnt/data/meld_graph/meldgraph.sh new_pt_pipeline.py -ids list_subjects.txt --parallelise

Leave a message

Feel free to comment, make a question, report a bug, etc. If you want to notify a specific user (e.g. to get a faster response), you may include their Github handle in your message (e.g. @romainligneul or @samuelgarcia).