Skip to content

Commit

Permalink
Allow to specify wkw file len (#146)
Browse files Browse the repository at this point in the history
* allow to specify wkw file len
* black
* fix
* fix
  • Loading branch information
philippotto authored and bulldozer-boy[bot] committed Oct 28, 2019
1 parent 66dd9f5 commit ab0420b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions wkcuber/cubing.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def create_parser():
default="uint8",
)

parser.add_argument(
"--wkw_file_len",
default=32,
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.",
)

add_batch_size_flag(parser)

parser.add_argument(
Expand Down Expand Up @@ -198,7 +204,7 @@ def cubing_job(args):
raise exc


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

source_files = find_source_filenames(source_path)

Expand All @@ -212,7 +218,11 @@ def cubing(source_path, target_path, layer_name, dtype, batch_size, args=None) -
target_path,
layer_name,
target_mag,
wkw.Header(convert_element_class_to_dtype(dtype), num_channels),
wkw.Header(
convert_element_class_to_dtype(dtype),
num_channels,
file_len=args.wkw_file_len,
),
)
interpolation_mode = parse_interpolation_mode(
args.interpolation_mode, target_wkw_info.layer_name
Expand Down

0 comments on commit ab0420b

Please sign in to comment.