Skip to content

Commit 655e6a9

Browse files
philippottobulldozer-boy[bot]
authored andcommitted
Fix wkw file len (#149)
* set type of wkw_file_len arg * also use wkw_file_len param in tiff_cubing test * black * fix tests
1 parent ab0420b commit 655e6a9

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

tests/scripts/tiff_cubing.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ docker run \
99
--jobs 2 \
1010
--batch_size 8 \
1111
--layer_name color \
12+
--wkw_file_len 32 \
1213
/testdata/tiff /testoutput/tiff
1314
[ -d testoutput/tiff/color ]
1415
[ -d testoutput/tiff/color/1 ]

wkcuber/cubing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def create_parser():
5454
parser.add_argument(
5555
"--wkw_file_len",
5656
default=32,
57+
type=int,
5758
help="Amount of blocks which are written per dimension to a wkw cube. The default value of 32 means that 1024 slices are written to one cube (since one block has 32**3 voxels by default). For single-channel uint8 data, this results in 1 GB per cube file. If file_len is set to 1, only 32 slices are written to one cube. Must be a power of two.",
5859
)
5960

wkcuber/export_wkw_as_tiff.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,17 @@ def export_tiff_slice(
128128
],
129129
]
130130
):
131-
batch_number, (
132-
tiff_bbox,
133-
dest_path,
134-
name,
135-
dataset_path,
136-
tiling_size,
137-
batch_size,
138-
downsample,
131+
(
132+
batch_number,
133+
(
134+
tiff_bbox,
135+
dest_path,
136+
name,
137+
dataset_path,
138+
tiling_size,
139+
batch_size,
140+
downsample,
141+
),
139142
) = export_args
140143
tiff_bbox = tiff_bbox.copy()
141144
number_of_slices = min(tiff_bbox["size"][2] - batch_number * batch_size, batch_size)

wkcuber/tile_cubing.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,16 @@ def find_file_with_dimensions(
183183

184184

185185
def tile_cubing_job(args):
186-
target_wkw_info, z_batches, input_path_pattern, batch_size, tile_size, min_dimensions, max_dimensions, decimal_lengths = (
187-
args
188-
)
186+
(
187+
target_wkw_info,
188+
z_batches,
189+
input_path_pattern,
190+
batch_size,
191+
tile_size,
192+
min_dimensions,
193+
max_dimensions,
194+
decimal_lengths,
195+
) = args
189196
if len(z_batches) == 0:
190197
return
191198

@@ -251,9 +258,12 @@ def tile_cubing(
251258
target_path, layer_name, dtype, batch_size, input_path_pattern, args=None
252259
):
253260
decimal_lengths = get_digit_counts_for_dimensions(input_path_pattern)
254-
min_dimensions, max_dimensions, arbitrary_file, file_count = detect_interval_for_dimensions(
255-
input_path_pattern, decimal_lengths
256-
)
261+
(
262+
min_dimensions,
263+
max_dimensions,
264+
arbitrary_file,
265+
file_count,
266+
) = detect_interval_for_dimensions(input_path_pattern, decimal_lengths)
257267

258268
if not arbitrary_file:
259269
logging.error(

0 commit comments

Comments
 (0)