Skip to content

Commit 8b410d4

Browse files
authored
adds layers_to_ignore to Dataset.copy_dataset (#1321)
* adds layers_to_ignore to Dataset.copy_dataset * changelog
1 parent 36d894f commit 8b410d4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
1515
### Breaking Changes
1616

1717
### Added
18+
- Added `layers_to_ignore` argument to `Dataset.copy_dataset`. [#1321](https://github.com/scalableminds/webknossos-libs/pull/1321)
1819

1920
### Changed
2021

webknossos/webknossos/dataset/dataset.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,6 +2562,7 @@ def copy_dataset(
25622562
exists_ok: bool = False,
25632563
executor: Executor | None = None,
25642564
voxel_size_with_unit: VoxelSize | None = None,
2565+
layers_to_ignore: Iterable[str] | None = None,
25652566
) -> "Dataset":
25662567
"""
25672568
Creates an independent copy of the dataset with all layers at a new location.
@@ -2578,6 +2579,7 @@ def copy_dataset(
25782579
exists_ok: Whether to overwrite existing datasets and layers
25792580
executor: Optional executor for parallel copying
25802581
voxel_size_with_unit: Optional voxel size specification with units
2582+
layers_to_ignore: List of layer names to exclude from the copy
25812583
25822584
Returns:
25832585
Dataset: The newly created copy
@@ -2632,6 +2634,8 @@ def copy_dataset(
26322634

26332635
with get_executor_for_args(None, executor) as executor:
26342636
for layer in self.layers.values():
2637+
if layers_to_ignore is not None and layer.name in layers_to_ignore:
2638+
continue
26352639
new_dataset.add_copy_layer(
26362640
layer,
26372641
chunk_shape=chunk_shape,

0 commit comments

Comments
 (0)