diff --git a/KUL_VBG.sh b/KUL_VBG.sh index 44cb904..3abdcfa 100755 --- a/KUL_VBG.sh +++ b/KUL_VBG.sh @@ -323,7 +323,11 @@ if [[ "$bids_flag" -eq 1 ]] && [[ "$s_flag" -eq 0 ]]; then # now we need to search for the images # then also find which modalities are available and set wf accordingly - + + ### STEFAN NEED TO DO: check what is the best input T1w: with or whitout Gd? + ### to select use something like: + ### find_T1w=($(find ${cwd}/BIDS/sub-${participant}/anat/ -name "*_T1w.nii.gz" ! -name "*gadolinium*")) + search_T1=($(find $search_sessions -type f | grep T1w.nii.gz)); # search_T2=($(find $search_sessions -type f | grep T2w.nii.gz)); # search_FLAIR=($(find $search_sessions -type f | grep FLAIR.nii.gz)); @@ -371,8 +375,12 @@ elif [[ "$bids_flag" -eq 1 ]] && [[ "$s_flag" -eq 1 ]]; then if [[ "$num_sessions" -eq 1 ]]; then echo " One session " $ses " specified in BIDS dir, good." + + ### STEFAN NEED TO DO: check what is the best input T1w: with or whitout Gd? + ### to select use something like: + ### find_T1w=($(find ${cwd}/BIDS/sub-${participant}/anat/ -name "*_T1w.nii.gz" ! -name "*gadolinium*")) - search_T1=($(find $search_sessions -type f | grep T1w.nii.gz)); + search_T1=($(find $search_sessions -type f | grep T1w.nii.gz)); # search_T2=($(find $search_sessions -type f | grep T2w.nii.gz)); # search_FLAIR=($(find $search_sessions -type f | grep flair.nii.gz)); @@ -392,6 +400,9 @@ elif [[ "$bids_flag" -eq 1 ]] && [[ "$s_flag" -eq 1 ]]; then fi + + + ### STEFAN NEED TO DO: prefer to set KUL_compute/sub-participant/VBG as default output? if [[ "$o_flag" -eq 0 ]]; then output_d="${cwd}/BIDS/derivatives/output_VBG/${subj}${ses_long}" @@ -1086,6 +1097,7 @@ function task_exec { wait ${pid} + ### STEFAN NEED TO DO: is the sleep needed, or can it be shorter? sleep 5 if [ $? -eq 0 ]; then @@ -1155,6 +1167,11 @@ function KUL_antsBETp { # task_exec + ### STEFAN NEED TO DO: nvcc is not always installed even if you have a working nvidia GPU + ### it would be better to check the available free GPU mem + ### This can be done with, outputs kb + ### nvidia-smi --query-gpu=memory.free --format=csv + ### and if more the 4096 continue with GPU nvd_cu=$(nvcc --version) if [[ ${BET_m} -eq 1 ]]; then diff --git a/README.md b/README.md index dfde63d..df420a4 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,53 @@ # KUL_VBG -A workflow to allow Freesurfer recon-all to run on brain images with large lesions. -VBG is a bash script tested in Mac OSX, Ubuntu 18.0 and CentOS. -The first commit on this repository corresponds to the version of the workflow used in the preprint "Virtual brain grafting: Enabling whole brain parcellation in the presence of large lesions. Radwan et al., 2020, DOI: https://doi.org/10.1101/2020.09.30.20204701, available via: https://www.medrxiv.org/content/10.1101/2020.09.30.20204701v1). This work was published in Neuroimage, 2021 available here: https://doi.org/10.1016/j.neuroimage.2021.117731 +KUL_VBG or "KULeuven - Virtual brain grafting" enables whole brain parcellation in the presence of large lesions. + +Whole brain parcellation means labeling the brain in parts, gyri, etc... +Many parcellation software packages fail in the presence of large brain lesions. + +The approach taken here is to: + +- extract the gross brain lesion using a mask +- replace the brain lesion with normal looking tissue (hence virtual brain grafting) +- run parellation software like freesufer or fastsurfer (which only work well on non-lesioned brains) +- reinsert the lesion mask into the parcellation + +## Introduction + +For reference we point to the paper published in Neuroimage, 2021 available here: https://doi.org/10.1016/j.neuroimage.2021.117731 + +## Posing the problem and solution + +An image to explain the problem: Freesurfer will not parcellate these brains + +![VBG fig1](figs4readme/fig1.jpg) + +The graphical solution of the VBG workflow is show here: + +![VBG fig1](figs4readme/fig2.jpg) + + +## Using VBG + +VBG was tested in Mac OSX, WSL2 on WIN11, Ubuntu 18.0, 20.04 and CentOS. **Updated Dependencies:** + a) ANTs v2.3.1 and ANTsX scripts + b) FSL v6.0 + c) MRtrix3 v3.0.2-64-g3eadb340 + d) HD-BET + f) Freesurfer v6.0 + e) FastSurfer + +## Examples + Inputs: Obligatory: diff --git a/figs4readme/fig1.jpg b/figs4readme/fig1.jpg new file mode 100644 index 0000000..15d178e Binary files /dev/null and b/figs4readme/fig1.jpg differ diff --git a/figs4readme/fig2.jpg b/figs4readme/fig2.jpg new file mode 100644 index 0000000..e3d6bbe Binary files /dev/null and b/figs4readme/fig2.jpg differ