11from __future__ import annotations
22
33import argparse
4- from pathlib import Path
54from statistics import median
65from time import perf_counter
76
109from skimage .measure import label as label_components
1110from skimage .segmentation import watershed
1211
12+ def load_problem ():
13+ from bioimage_cpp ._data import load_isbi_affinities
1314
14- PROJECT_ROOT = Path (__file__ ).resolve ().parents [2 ]
15- DEFAULT_DATA_PREFIX = PROJECT_ROOT / "examples" / "segmentation" / "isbi-data-"
16-
17-
18- def load_problem (data_prefix : Path | str = DEFAULT_DATA_PREFIX ):
19- from elf .segmentation .utils import load_mutex_watershed_problem
20-
21- affinities , offsets = load_mutex_watershed_problem (prefix = str (data_prefix ))
15+ affinities , offsets = load_isbi_affinities ()
2216 return np .ascontiguousarray (affinities ), [tuple (offset ) for offset in offsets ]
2317
2418
@@ -227,7 +221,6 @@ def run_compatibility_check(
227221 ndim : int ,
228222 repeats : int ,
229223 threads : int ,
230- data_prefix : Path ,
231224 z : int ,
232225 yx_shape : tuple [int , int ],
233226 zyx_shape : tuple [int , int , int ],
@@ -238,7 +231,7 @@ def run_compatibility_check(
238231 import bioimage_cpp as bic
239232 import nifty .graph .rag as nrag
240233
241- affinities , offsets = load_problem (data_prefix )
234+ affinities , offsets = load_problem ()
242235 if ndim == 2 :
243236 direct_affinities , direct_offsets = prepare_2d_problem (affinities , offsets , z , yx_shape )
244237 elif ndim == 3 :
@@ -310,7 +303,6 @@ def _print_timing(name: str, bic_timings: list[float], nifty_timings: list[float
310303
311304
312305def add_common_arguments (parser : argparse .ArgumentParser ) -> None :
313- parser .add_argument ("--data-prefix" , type = Path , default = DEFAULT_DATA_PREFIX )
314306 parser .add_argument ("--repeats" , type = int , default = 3 )
315307 parser .add_argument ("--threads" , type = int , default = 1 )
316308 parser .add_argument ("--watershed-min-distance" , type = int , default = 5 )
0 commit comments