forked from saalfeldlab/parallel-elastic-alignment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-import-overlap
executable file
·53 lines (42 loc) · 1.01 KB
/
make-import-overlap
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# call create-import <file-list> <chunk-size> <min> <max> <type>
#
# create the file list e.g.
# find `pwd`/raw/ -name "*.tif" | sort > ls-sorted.txt
# chunk-size - the number of layers in one range, overlap is 50%
# min - minimum intensity, mapped to 0 in uint8
# max - maximum intensity, mapped to 255 in uint8
# type - 0: uint8 (gray), 1: uint16 (gray), 2: float32 (gray), 3: uint8 (indexed color), 4s: uint32 (RGB color)
#
IFS=$'\n'
mod=${2:-100}
min=${3:-11000}
max=${4:-30000}
t=${5:-1}
z=0
zmod=0
zmoda=0
file="$z-$(($mod-1))"
filea="$z-$(($mod/2-1))"
mkdir -p "$file"
mkdir -p "$filea"
for row in `cat "${1}"`
do
if [ "$zmod" -eq "$mod" ]
then
zmod=0
file="$z-$(($z+$mod-1))"
mkdir "$file"
fi
if [ "$zmoda" -eq "$(($mod/2))" ]
then
zmoda=$((-$mod/2))
filea="$z-$(($z+$mod-1))"
mkdir "$filea"
fi
echo "$row 0 0 $z - - $min $max $t" >> "${file}/import.txt"
echo "$row 0 0 $z - - $min $max $t" >> "${filea}/import.txt"
zmod=$(($zmod+1))
zmoda=$(($zmoda+1))
z=$(($z+1))
done