From 7a19fed150d9c188670a345d65aae34580cb6ec2 Mon Sep 17 00:00:00 2001 From: Rohan Banerjee Date: Mon, 28 Nov 2022 01:49:11 -0500 Subject: [PATCH 1/4] adding preprocessing script --- preprocessing/preprocess.sh | 85 +++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 preprocessing/preprocess.sh diff --git a/preprocessing/preprocess.sh b/preprocessing/preprocess.sh new file mode 100644 index 0000000..439113c --- /dev/null +++ b/preprocessing/preprocess.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# +# Process data. +# For T1 : From raw images, proceeds to resampling and reorientation to RPI. +# +# Crop all images. +# Generates soft segmentations. +# Usage: +# ./process_data.sh +# +# +# Authors: Rohan Banerjee + +# The following global variables are retrieved from the caller sct_run_batch +# but could be overwritten by uncommenting the lines below: +# PATH_DATA_PROCESSED="~/data_processed" +# PATH_RESULTS="~/results" +# PATH_LOG="~/log" +# PATH_QC="~/qc" + +# Uncomment for full verbose +set -x + +# Exit if user presses CTRL+C (Linux) or CMD+C (OSX) +trap "echo Caught Keyboard Interrupt within script. Exiting now.; exit" INT + +# Print retrieved variables from sct_run_batch to the log (to allow easier debug) +echo “Retrieved variables from from the caller sct_run_batch:” +echo “PATH_DATA: ${PATH_DATA}” +echo “PATH_DATA_PROCESSED: ${PATH_DATA_PROCESSED}” +echo “PATH_RESULTS: ${PATH_RESULTS}” +echo “PATH_LOG: ${PATH_LOG}” +echo “PATH_QC: ${PATH_QC}” + +# Retrieve input params +SUBJECT=$1 + +# echo SUBJECT + +# Save script path +PATH_SCRIPT=$PWD + +get starting time: +start=`date +%s` + +# SCRIPT STARTS HERE +# ============================================================================== +# Display useful info for the log, such as SCT version, RAM and CPU cores available +sct_check_dependencies -short + +# Go to folder where data will be copied and processed +cd $PATH_DATA_PROCESSED + + +Copy list of participants in processed data folder +if [[ ! -f "participants.tsv" ]]; then + rsync -avzh $PATH_DATA/participants.tsv . +fi + +if [[ ! -f "participants.json" ]]; then + rsync -avzh $PATH_DATA/participants.json . +fi + +if [[ ! -f "README.md" ]]; then + rsync -avzh $PATH_DATA/README.md . +fi + +if [[ ! -f "dataset_description.tsv" ]]; then + rsync -avzh $PATH_DATA/dataset_description . +fi + +# Copy source images +rsync -avzh $PATH_DATA/$SUBJECT . + +#copy derivatives +rsync -avzh $PATH_DATA/derivatives . + +# Script starts here +cd ${SUBJECT}/func +file_bold=${SUBJECT}_task-rest_bold +file_bold_seg=${PATH_DATA}/derivatives/labels/${SUBJECT}/func/${SUBJECT}_task-rest_bold_seg-manual + +sct_register_multimodal -i ${file_bold}.nii.gz -d ${file_bold_seg}.nii.gz -o ${file_bold}_to_${file_bold}_reg.nii.gz -identity 0 +rm warp_${SUBJECT}_task-rest_bold_seg-manual2${SUBJECT}_task-rest_bold.nii.gz warp_${SUBJECT}_task-rest_bold2${SUBJECT}_task-rest_bold_seg-manual.nii.gz ${SUBJECT}_task-rest_bold.nii.gz +mv ${file_bold}_to_${file_bold}_reg.nii.gz ${file_bold}.nii.gz From 431efdb31c90e24afb84024ef21c378b78db2dc3 Mon Sep 17 00:00:00 2001 From: Rohan Banerjee Date: Mon, 28 Nov 2022 02:08:20 -0500 Subject: [PATCH 2/4] adding config file for 2D segmentation --- .DS_Store | Bin 0 -> 6148 bytes config/{seg_csf_2D.json => mni_bmpd_csf-2d.json} | 12 ++++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .DS_Store rename config/{seg_csf_2D.json => mni_bmpd_csf-2d.json} (93%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..47138d2b7bbab4e3ae5aca3d93b28e1e2abfd96b GIT binary patch literal 6148 zcmeH~O-{ow5QS%;sw!1TU9$8QdV^4<8@9Os>JOn(5=TXJ?Q?JkZo$EL;~9|BMzBK& z%~bYt>>1nnq}mxG;?>J;NwgrM8Hy-NW5lF;bm+>Qr%=vw9H?&UWwniMKQhr@?2^4t zX-knhdZh9F560VAmYXJS5C~vPdK|d0Vm)DoPZPfhJf5Fu-RPIYbW3YoWK_WIUfRwXknUE^U;AS zrvT6iy0f7zxrD?7)50{VVg$w-3e`}y6oWM!{lWYS)1<25#Fl)pt^Aq1a9$nrhwM&V zsCw-LoWPL4wLUK7{$JxSGn(WNL;T4JIDvmgfG1^DuJBTJw_d!S+_eGa0Yyywk~Cmw m4?Y6$Am_+!9@Oz5ZTJ+DhdEXN literal 0 HcmV?d00001 diff --git a/config/seg_csf_2D.json b/config/mni_bmpd_csf-2d.json similarity index 93% rename from config/seg_csf_2D.json rename to config/mni_bmpd_csf-2d.json index a8ba048..f414887 100644 --- a/config/seg_csf_2D.json +++ b/config/mni_bmpd_csf-2d.json @@ -8,9 +8,17 @@ "object_detection_path": null, "safety_factor": [1.0, 1.0, 1.0] }, + + "wandb": { + "wandb_api_key": "b5241158351bb1892078087d4fc9d0c3ae5e2b9b", + "project_name": "data_training_human_sc_csf_moco", + "run_name": "run-2d" + + }, + "loader_parameters": { - "path_data": "/mnt/duke/temp/rohan/data_training_human_sc_csf_moco/BIDS_conv", + "path_data": "/mnt/duke/temp/rohan/data_training_human_sc_csf_moco/processed_data", "subject_selection": {"n": [], "metadata": [], "value": []}, "target_suffix": ["_seg-manual"], "extensions": [".nii.gz"], @@ -49,7 +57,7 @@ "name": "DiceLoss" }, "training_time": { - "num_epochs": 1, + "num_epochs": 20, "early_stopping_patience": 50, "early_stopping_epsilon": 0.001 }, From b93ccc23180c8aff4c8a66c4d54300bfdad2ba26 Mon Sep 17 00:00:00 2001 From: Rohan Banerjee Date: Sun, 4 Dec 2022 18:25:27 -0500 Subject: [PATCH 3/4] changed project name inside the config file --- .DS_Store | Bin 6148 -> 0 bytes config/mni_bmpd_csf-2d.json | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 47138d2b7bbab4e3ae5aca3d93b28e1e2abfd96b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~O-{ow5QS%;sw!1TU9$8QdV^4<8@9Os>JOn(5=TXJ?Q?JkZo$EL;~9|BMzBK& z%~bYt>>1nnq}mxG;?>J;NwgrM8Hy-NW5lF;bm+>Qr%=vw9H?&UWwniMKQhr@?2^4t zX-knhdZh9F560VAmYXJS5C~vPdK|d0Vm)DoPZPfhJf5Fu-RPIYbW3YoWK_WIUfRwXknUE^U;AS zrvT6iy0f7zxrD?7)50{VVg$w-3e`}y6oWM!{lWYS)1<25#Fl)pt^Aq1a9$nrhwM&V zsCw-LoWPL4wLUK7{$JxSGn(WNL;T4JIDvmgfG1^DuJBTJw_d!S+_eGa0Yyywk~Cmw m4?Y6$Am_+!9@Oz5ZTJ+DhdEXN diff --git a/config/mni_bmpd_csf-2d.json b/config/mni_bmpd_csf-2d.json index f414887..a7593fe 100644 --- a/config/mni_bmpd_csf-2d.json +++ b/config/mni_bmpd_csf-2d.json @@ -1,7 +1,7 @@ { "command": "train", "gpu_ids": [2], - "path_output": "/mnt/duke/temp/rohan/data_training_human_sc_csf_moco/initial_run", + "path_output": "/mnt/duke/temp/rohan/data_training_human_sc_csf/initial_run", "model_name": "test_model", "debugging": true, "object_detection_params": { @@ -10,15 +10,15 @@ }, "wandb": { - "wandb_api_key": "b5241158351bb1892078087d4fc9d0c3ae5e2b9b", - "project_name": "data_training_human_sc_csf_moco", + "wandb_api_key": "", + "project_name": "data_training_human_sc_csf", "run_name": "run-2d" }, "loader_parameters": { - "path_data": "/mnt/duke/temp/rohan/data_training_human_sc_csf_moco/processed_data", + "path_data": "/mnt/duke/temp/rohan/data_training_human_sc_csf/processed_data", "subject_selection": {"n": [], "metadata": [], "value": []}, "target_suffix": ["_seg-manual"], "extensions": [".nii.gz"], From ca59762002cf6fbaf99cc2e4fce1a5c1c9426879 Mon Sep 17 00:00:00 2001 From: Rohan Banerjee Date: Fri, 6 Jan 2023 18:54:19 -0500 Subject: [PATCH 4/4] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5ecf0ad..c115dd2 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,13 @@ git clone https://github.com/ivadomed/model_seg_csf_epi.git ## Get the data -- git@data.neuro.polymtl.ca:datasets/data_gre-epi +- git@data.neuro.polymtl.ca:datasets/mni-bmpd ### Example calls to get the data ~~~ -git clone git@data.neuro.polymtl.ca:datasets/data_gre-epi -cd data_gre-epi +git clone git@data.neuro.polymtl.ca:datasets/mni-bmpd +cd mni-bmpd git annex get . cd .. ~~~