Skip to content

Commit ab0420b

Browse files
philippottobulldozer-boy[bot]
authored andcommitted
Allow to specify wkw file len (#146)
* allow to specify wkw file len * black * fix * fix
1 parent 66dd9f5 commit ab0420b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

wkcuber/cubing.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ def create_parser():
5151
default="uint8",
5252
)
5353

54+
parser.add_argument(
55+
"--wkw_file_len",
56+
default=32,
57+
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.",
58+
)
59+
5460
add_batch_size_flag(parser)
5561

5662
parser.add_argument(
@@ -198,7 +204,7 @@ def cubing_job(args):
198204
raise exc
199205

200206

201-
def cubing(source_path, target_path, layer_name, dtype, batch_size, args=None) -> dict:
207+
def cubing(source_path, target_path, layer_name, dtype, batch_size, args) -> dict:
202208

203209
source_files = find_source_filenames(source_path)
204210

@@ -212,7 +218,11 @@ def cubing(source_path, target_path, layer_name, dtype, batch_size, args=None) -
212218
target_path,
213219
layer_name,
214220
target_mag,
215-
wkw.Header(convert_element_class_to_dtype(dtype), num_channels),
221+
wkw.Header(
222+
convert_element_class_to_dtype(dtype),
223+
num_channels,
224+
file_len=args.wkw_file_len,
225+
),
216226
)
217227
interpolation_mode = parse_interpolation_mode(
218228
args.interpolation_mode, target_wkw_info.layer_name

0 commit comments

Comments
 (0)