Skip to content

Commit 2acfb48

Browse files
authored
Add batch size to convert CLI. (#1158)
* Add batch size to convert CLI. * Update changelog. * Adapt option's help description.
1 parent bb94647 commit 2acfb48

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
2121
- Added options `--layer-name` and `--mag` for compress command of the CLI. [#1141](https://github.com/scalableminds/webknossos-libs/pull/1141)
2222
- Added options `--chunk-shape` and `--chunks-per-shard` for convert command of the CLI. [#1150](https://github.com/scalableminds/webknossos-libs/pull/1150)
2323
- The `from_images` method of the `Dataset` supports directories and single files as `input_path` now. [#1152](https://github.com/scalableminds/webknossos-libs/pull/1152)
24+
- Added option `--batch-size` to the convert command of the CLI. [#1158](https://github.com/scalableminds/webknossos-libs/pull/1158)
2425

2526
### Fixed
2627
- Fixed issue with webknossos URL and context URL being considered different when opening a remote dataset due to trailing slashes. [#1137](https://github.com/scalableminds/webknossos-libs/pull/1137)

webknossos/webknossos/cli/convert.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ def main(
102102
compress: Annotated[
103103
bool, typer.Option(help="Enable compression of the target dataset.")
104104
] = False,
105+
batch_size: Annotated[
106+
Optional[int],
107+
typer.Option(
108+
help="Number of images to be processed in one batch (influences RAM consumption). "
109+
"When creating a WKW dataset, batch-size must be a multiple of chunk-shape's z dimension. "
110+
"When converting to Zarr, batch-size must be a multiple of the z dimension of the "
111+
"shard shape (chunk-shape x chunks-per-shard).",
112+
),
113+
] = None,
105114
jobs: Annotated[
106115
int,
107116
typer.Option(
@@ -146,5 +155,6 @@ def main(
146155
executor=executor,
147156
compress=compress,
148157
layer_name=layer_name,
158+
batch_size=batch_size,
149159
layer_category=category.value if category else None,
150160
)

webknossos/webknossos/dataset/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ def add_layer_from_images(
11611161
* `channel`: may be used to select a single channel, if multiple are available
11621162
* `timepoint`: for timeseries, select a timepoint to use by specifying it as an int, starting from 0
11631163
* `czi_channel`: may be used to select a channel for .czi images, which differs from normal color-channels
1164-
* `batch_size`: size to process the images, must be a multiple of the chunk-size z-axis for uncompressed and the shard-size z-axis for compressed layers, default is the chunk-size or shard-size respectively
1164+
* `batch_size`: size to process the images (influences RAM consumption), must be a multiple of the chunk-size z-axis for uncompressed and the shard-size z-axis for compressed layers, default is the chunk-size or shard-size respectively
11651165
* `allow_multiple_layers`: set to `True` if timepoints or channels may result in multiple layers being added (only the first is returned)
11661166
* `max_layers`: only applies if `allow_multiple_layers=True`, limits the number of layers added via different channels or timepoints
11671167
* `truncate_rgba_to_rgb`: only applies if `allow_multiple_layers=True`, set to `False` to write four channels into layers instead of an RGB channel

0 commit comments

Comments
 (0)