a b/demo/mbs_demo.sh
1
#!/bin/bash
2
3
#########################################
4
# Demonstrate the comman usage of the
5
# Multi-Brain Separation (MBS) pipeline
6
#########################################
7
8
# Add niftk installation location to system paths: `PATH` and `LD_LIBRARY_PATH`.
9
# This will only work if user followed the installation instruction, and installed packages in the recommended location.
10
# If you installed the packages in other locations, please change the variable `$HOME` to your own installed locations.
11
12
# Option 1: if user installed the default niftk package
13
export PATH=${PATH}:"$HOME/niftk-18.5.4/bin"
14
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"$HOME/niftk-18.5.4/bin"
15
16
# option 2: if use choose to compile the niftyreg/niftyseg from the source code.
17
export PATH=${PATH}:"$HOME/nifty_reg/bin"
18
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}/"$HOME/nifty_reg/lib"
19
export PATH=${PATH}:"$HOME/nifty_seg/bin"
20
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:"$HOME/nifty_seg/lib"
21
22
####################################
23
######## prepare demo data #########
24
####################################
25
# Ref: https://figshare.com/collections/Tc1_and_WT_data/3258139
26
# DOI: 10.6084/m9.figshare.c.3258139
27
# Cohort 1: https://figshare.com/articles/Tc1_and_WT_brains_cohort_1_C1_/3382693
28
# Cohort 2: https://figshare.com/articles/Tc1_and_WT_brains_cohort_2_C2_/3394786
29
HOME=$HOME
30
WORK_DIR=$HOME/Data/TC1
31
RAW_DIR=$WORK_DIR/RAW_DATA
32
script=$WORK_DIR/script
33
mkdir -p $RAW_DIR
34
mkdir -p $script
35
36
# get to the current directory
37
cd $RAW_DIR
38
39
# Get the data if not already existed/downloaded
40
tc1_269455=$RAW_DIR/'tc1_269455.nii.gz'
41
tc1_269455=$RAW_DIR/'010913_02.nii.gz'
42
if [[ ! -e $tc1_269455 ]]; then
43
    wget --content-disposition -P $RAW_DIR https://ndownloader.figshare.com/files/5275453
44
    wget --content-disposition -P $RAW_DIR https://ndownloader.figshare.com/files/5303806
45
46
fi
47
48
####################################
49
######## start demo script #########
50
####################################
51
52
# Download the main script if not yet done
53
(cd $script && svn export --force https://github.com/dancebean/multi-atlas-segmentation/trunk/MultiBrainSepsrationHelperFunctions.sh)
54
(cd $script && svn export --force https://github.com/dancebean/multi-atlas-segmentation/trunk/MASHelperFunctions.sh)
55
56
# source the main script (or use the location of your own copy)
57
source $script/MultiBrainSepsrationHelperFunctions.sh
58
source $script/MASHelperFunctions.sh > /dev/null 2>&1
59
60
# Alternatively, if you want to show the listing of all the available functions, use:
61
# source ./MASHelperFunctions.sh 
62
63
64
65
## Three brain separation
66
67
68
69
## Quickcheck
70
mas_quickcheck [bg_img] [(optional) overlay_img] [qc_dir] [qc_filename]
71
72
73
74
75
###################################