Skip to content

Commit

Permalink
Merge pull request KUL-Radneuron#5 from treanus/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
treanus authored Nov 11, 2021
2 parents ceb9896 + caf4cb4 commit 27443a9
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
21 changes: 19 additions & 2 deletions KUL_VBG.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));

Expand All @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Binary file added figs4readme/fig1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figs4readme/fig2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 27443a9

Please sign in to comment.