[5a7589]: / scripts / link_binary_infl_norm.sh

Download this file

36 lines (29 with data), 824 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# LINK images for binary classification (inflammation / normal)
#INDIR=~/data_1024/fullsplit
BASE=$1
#BASE=../data/data_1024
INDIR=$BASE/fullsplit/all
OUTDIR=$BASE/infl_split/all
echo -e "linking from\t$INDIR"
echo -e "linking to\t$OUTDIR"
# mv ~/data_1024/* $INDIR
mkdir -p $OUTDIR
mkdir -p $OUTDIR/infl
mkdir -p $OUTDIR/normal
# link inflammation patches
#ln -s $INDIR/*infl*/*png $OUTDIR/infl
find $INDIR/*infl*/*png -exec sh -c 'ln -s $(readlink -f $1) '$OUTDIR/infl'' _ {} \;
# link everything else
dirs=$(ls $INDIR)
for dd in ${dirs[@]}
do
if [[ $dd == *"infl"* ]]; then
# echo "$dd"
continue
else
echo "${dd}"
#ln -s $INDIR/${dd}/*png $OUTDIR/normal/
find $INDIR/${dd}/*png -exec sh -c 'ln -s $(readlink -f $1) '$OUTDIR/normal/'' _ {} \;
fi
done