|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -xe |
| 3 | +mkdir -p testoutput/tiff4 |
| 4 | + |
| 5 | +# simplest case: Only XY and I (alternative Z axis name) axis |
| 6 | +python -m wkcuber.convert_image_stack_to_wkw \ |
| 7 | + --jobs 2 \ |
| 8 | + --batch_size 8 \ |
| 9 | + --layer_name color \ |
| 10 | + --max_mag 4 \ |
| 11 | + --target_mag 2\ |
| 12 | + --scale 1,1,1 \ |
| 13 | + --name awesome_data \ |
| 14 | + --no_compress \ |
| 15 | + --wkw_file_len 8 \ |
| 16 | + testdata/various_tiff_formats/test_I.tif testoutput/tiff4 |
| 17 | +[ -d testoutput/tiff4/color ] |
| 18 | +[ -d testoutput/tiff4/color/2 ] |
| 19 | +[ $(find testoutput/tiff4/color/2 -mindepth 3 -name "*.wkw" | wc -l) -eq 1 ] |
| 20 | +[ -e testoutput/tiff4/datasource-properties.json ] |
| 21 | +rm -r testoutput/tiff4/* |
| 22 | + |
| 23 | +# to make output wk_compatible, these files require multiple layer |
| 24 | +python -m wkcuber.convert_image_stack_to_wkw \ |
| 25 | + --jobs 2 \ |
| 26 | + --batch_size 8 \ |
| 27 | + --layer_name color \ |
| 28 | + --max_mag 1 \ |
| 29 | + --scale 1,1,1 \ |
| 30 | + --name awesome_data \ |
| 31 | + --no_compress \ |
| 32 | + --wkw_file_len 8 \ |
| 33 | + testdata/various_tiff_formats/test_C.tif testoutput/tiff4 |
| 34 | +[ -d testoutput/tiff4/color_0 ] |
| 35 | +[ -d testoutput/tiff4/color_1 ] |
| 36 | +[ -d testoutput/tiff4/color_2 ] |
| 37 | +[ -d testoutput/tiff4/color_3 ] |
| 38 | +[ -d testoutput/tiff4/color_4 ] |
| 39 | +[ -d testoutput/tiff4/color_0/1 ] |
| 40 | +[ $(find testoutput/tiff4/color_0/1 -mindepth 3 -name "*.wkw" | wc -l) -eq 1 ] |
| 41 | +[ -e testoutput/tiff4/datasource-properties.json ] |
| 42 | +rm -r testoutput/tiff4/* |
| 43 | + |
| 44 | +python -m wkcuber.convert_image_stack_to_wkw \ |
| 45 | + --jobs 2 \ |
| 46 | + --batch_size 8 \ |
| 47 | + --layer_name color \ |
| 48 | + --max_mag 1 \ |
| 49 | + --scale 1,1,1 \ |
| 50 | + --name awesome_data \ |
| 51 | + --no_compress \ |
| 52 | + --wkw_file_len 8 \ |
| 53 | + testdata/various_tiff_formats/test_S.tif testoutput/tiff4 |
| 54 | +[ -d testoutput/tiff4/color_0 ] |
| 55 | +[ -d testoutput/tiff4/color_1 ] |
| 56 | +[ -d testoutput/tiff4/color_2 ] |
| 57 | +[ -d testoutput/tiff4/color_0/1 ] |
| 58 | +[ $(find testoutput/tiff4/color_0/1 -mindepth 3 -name "*.wkw" | wc -l) -eq 1 ] |
| 59 | +[ -e testoutput/tiff4/datasource-properties.json ] |
| 60 | +rm -r testoutput/tiff4/* |
| 61 | + |
| 62 | +python -m wkcuber.convert_image_stack_to_wkw \ |
| 63 | + --jobs 2 \ |
| 64 | + --batch_size 8 \ |
| 65 | + --layer_name color \ |
| 66 | + --max_mag 1 \ |
| 67 | + --scale 1,1,1 \ |
| 68 | + --name awesome_data \ |
| 69 | + --no_compress \ |
| 70 | + --wkw_file_len 8 \ |
| 71 | + testdata/various_tiff_formats/test_CS.tif testoutput/tiff4 |
| 72 | +[ -d testoutput/tiff4/color_0 ] |
| 73 | +[ -d testoutput/tiff4/color_1 ] |
| 74 | +[ -d testoutput/tiff4/color_2 ] |
| 75 | +[ -d testoutput/tiff4/color_3 ] |
| 76 | +[ -d testoutput/tiff4/color_4 ] |
| 77 | +[ -d testoutput/tiff4/color_0/1 ] |
| 78 | +[ $(find testoutput/tiff4/color_0/1 -mindepth 3 -name "*.wkw" | wc -l) -eq 1 ] |
| 79 | +[ -e testoutput/tiff4/datasource-properties.json ] |
| 80 | +rm -r testoutput/tiff4/* |
| 81 | + |
| 82 | +# test wk incompatible configs, program should fail because force parameter was not given |
| 83 | +if python -m wkcuber.convert_image_stack_to_wkw \ |
| 84 | + --jobs 2 \ |
| 85 | + --batch_size 8 \ |
| 86 | + --layer_name color \ |
| 87 | + --max_mag 1 \ |
| 88 | + --scale 1,1,1 \ |
| 89 | + --prefer_channels \ |
| 90 | + --name awesome_data \ |
| 91 | + --no_compress \ |
| 92 | + --wkw_file_len 8 \ |
| 93 | + testdata/various_tiff_formats/test_C.tif testoutput/tiff4; then |
| 94 | + echo "Conversion worked although invalid config should have been detected." |
| 95 | + exit 1 |
| 96 | +else |
| 97 | + echo "Conversion did not work as expected due to invalid config." |
| 98 | +fi |
| 99 | + |
| 100 | +# power user configuration: should only create single layer |
| 101 | +python -m wkcuber.convert_image_stack_to_wkw \ |
| 102 | + --jobs 2 \ |
| 103 | + --batch_size 8 \ |
| 104 | + --layer_name color \ |
| 105 | + --max_mag 1 \ |
| 106 | + --scale 1,1,1 \ |
| 107 | + --channel_index 3 \ |
| 108 | + --sample_index 2 \ |
| 109 | + --name awesome_data \ |
| 110 | + --no_compress \ |
| 111 | + --wkw_file_len 8 \ |
| 112 | + testdata/various_tiff_formats/test_CS.tif testoutput/tiff4 |
| 113 | +[ -d testoutput/tiff4/color ] |
| 114 | +[ -d testoutput/tiff4/color/1 ] |
| 115 | +[ $(find testoutput/tiff4/color/1 -mindepth 3 -name "*.wkw" | wc -l) -eq 1 ] |
| 116 | +[ -e testoutput/tiff4/datasource-properties.json ] |
0 commit comments