-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.sh
executable file
·43 lines (35 loc) · 1018 Bytes
/
script.sh
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
#!/usr/bin/env bash
EXE=/opt/bioformats2raw/bin/bioformats2raw
set -e
set -u
set -x
IMAGE_OR_FILE=$1; shift
INPUT=$1; shift
OUTPUT=$1; shift
EXTRA_ARGS=
echo "Converting $INPUT to /$OUTPUT..."
if [ -e "${IMAGE_OR_FILE}" ];
then
echo Found file: $IMAGE_OR_FILE
# Use the first column of the CSV (%3) as the group and omit use of the series ID (%1)
EXTRA_ARGS="--scale-format-string=%3\$s/%2\$s --additional-scale-format-string-args=${IMAGE_OR_FILE}"
fi
time $EXE "$INPUT" "/$OUTPUT" --file_type=zarr --dimension-order=XYZCT ${EXTRA_ARGS}
ls "/$OUTPUT"
if [ -e "${IMAGE_OR_FILE}" ];
then
for IMAGE in $(cut -f1 -d, "${IMAGE_OR_FILE}");
do
echo Image:${IMAGE}
mv /$OUTPUT/data.zarr/${IMAGE} /v0.1/${IMAGE}.zarr
done
else
# Move first (and only) of series to the image name
mv /$OUTPUT/data.zarr/0 /v0.1/${IMAGE_OR_FILE}.zarr
fi
# Cleanup
rm /$OUTPUT/data.zarr/.zattrs
rm /$OUTPUT/data.zarr/.zgroup
rmdir /$OUTPUT/data.zarr
rm /$OUTPUT/METADATA.ome.xml
rmdir /$OUTPUT/