Skip to content

Commit

Permalink
Forgot to pass num_threads
Browse files Browse the repository at this point in the history
  • Loading branch information
vovaf709 committed Jun 5, 2024
1 parent 8a58289 commit d3c220c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions imops/morphology.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ def distance_transform_edt(

if (not return_distances) and (not return_indices):
raise RuntimeError('At least one of `return_distances`/`return_indices` must be True')

input = np.atleast_1d(np.where(input, 1, 0).astype(np.int8))
if input.dtype != bool:
input = np.atleast_1d(np.where(input, 1, 0))
if sampling is not None:
sampling = _ni_support._normalize_sequence(sampling, input.ndim)
sampling = np.asarray(sampling, dtype=np.float64)
Expand All @@ -497,7 +497,10 @@ def distance_transform_edt(
euclidean_feature_transform(input, sampling, ft)

if return_distances:
dt = edt(input, anisotropy=sampling.astype(np.float32)) if sampling is not None else edt(input)
if sampling is not None:
dt = edt(input, anisotropy=sampling.astype(np.float32), parallel=num_threads)
else:
dt = edt(input, parallel=num_threads)

result = []
if return_distances:
Expand Down

0 comments on commit d3c220c

Please sign in to comment.