Skip to content

Commit 626474b

Browse files
Make export script more efficient
1 parent 3999582 commit 626474b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/export_lower_resolution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pandas as pd
88
import tifffile
99
import zarr
10+
from elf.parallel import isin
1011

1112
from flamingo_tools.s3_utils import get_s3_path, BUCKET_NAME, SERVICE_ENDPOINT
1213
from flamingo_tools.segmentation.postprocessing import filter_cochlea_volume, filter_cochlea_volume_single
@@ -25,7 +26,8 @@ def filter_component(fs, segmentation, cochlea, seg_name, components):
2526
if max(keep_label_ids) > np.iinfo("uint16").max:
2627
warnings.warn(f"Label ID exceeds maximum of data type 'uint16': {np.iinfo('uint16').max}.")
2728

28-
filter_mask = ~np.isin(segmentation, keep_label_ids)
29+
filter_mask = np.zeros(segmentation.shape, dtype="bool")
30+
filter_mask = ~isin(segmentation, keep_label_ids, out=filter_mask, verbose=True, block_shape=(128, 128, 128))
2931
segmentation[filter_mask] = 0
3032
segmentation = segmentation.astype("float32")
3133
return segmentation

0 commit comments

Comments
 (0)