From a38d43f9c510fc257e7db0c7fcdd6d16bd56797e Mon Sep 17 00:00:00 2001 From: mathrip Date: Tue, 12 May 2026 14:21:55 +0100 Subject: [PATCH 1/2] add guidelines to convert dicoms to nifti --- docs/prepare_data.md | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/prepare_data.md b/docs/prepare_data.md index ed1adf3..b62b79c 100644 --- a/docs/prepare_data.md +++ b/docs/prepare_data.md @@ -8,6 +8,56 @@ If you are preparing the data for the harmonisation step, you will also need to In the 'input' folder where your meld data has/is going to be stored, create a folder for each patient with the ID of the subject. +### Convert DICOMs to NIfTI +The input data needs to be in 'NIfTI' format ('.nii.gz'). If you have DICOMS file you will need to convert them in NIfTI. If you already have the data in NIfTI, you can skip this. + +To convert DICOMs to NIfTI, you can use the 'mri_convert' function from FreeSurfer. + +::::{tab-set} +:::{tab-item} Docker +:sync: docker +Open a terminal and `cd` to the meld graph folder. + +```bash +DOCKER_USER="$(id -u):$(id -g)" docker compose run -v ":/data_dcm" meld_graph mri_convert /data_dcm/ /data_dcm/ +``` +with: +- : the path where the dicom folder is saved. +- : the name of the first dicom file (.dcm) in the dicoms folder. +- : the name of the output nifti file. It will need to finish by '.nii.gz'. + +Example: +```bash +DOCKER_USER="$(id -u):$(id -g)" docker compose run -v "/home/user/sub001_dcm:/data_dcm" meld_graph mri_convert /data_dcm/Snake_sub001.Seq3.Ser202.Img1.dcm /data_dcm/T1.nii.gz +``` +Note: Ensure that there is no space in the path to your dicom and nifti file or the command will fail + +WINDOWS USER: On windows, you do not need the `DOCKER_USER="$(id -u):$(id -g)"` part +::: + + +:::{tab-item} Native +:sync: native + +Open a terminal and `cd` to the meld graph folder. + +You will need to first activate FreeSurfer +```bash +export FREESURFER_HOME= +source $FREESURFER_HOME/SetUpFreeSurfer.sh +``` + +Then run the command +```bash +mri_convert +``` + +Note: Ensure that there is no space in the path to your dicom and nifti file or the command will fail +::: + +::: +:::: + ### **MELD format** Chose a subject ID: Please ensure that the subject ID is not just a number. For example, if your id is `0001`, ensure to add a letter, such as `P0001` From 65247d4db7be700cfcb54566d182ca95c3123d2b Mon Sep 17 00:00:00 2001 From: mathrip Date: Tue, 12 May 2026 14:28:25 +0100 Subject: [PATCH 2/2] add guidelines to convert dicoms to nifti --- docs/prepare_data.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/prepare_data.md b/docs/prepare_data.md index b62b79c..4e29f53 100644 --- a/docs/prepare_data.md +++ b/docs/prepare_data.md @@ -52,6 +52,15 @@ Then run the command mri_convert ``` +with: +- : the path of the first dicom file (.dcm) in the dicoms folder. +- : the path of the output nifti file. It will need to finish by '.nii.gz'. + +Example: +```bash +mri_convert /home/user/sub001_dcm/Snake_sub001.Seq3.Ser202.Img1.dcm /home/user/sub001_dcm/T1.nii.gz +``` + Note: Ensure that there is no space in the path to your dicom and nifti file or the command will fail :::