Skip to content

threshold_local does not preserve data type #426

@hirschmichael

Description

@hirschmichael

Describe the issue:
dask_image.ndfilters.threshold does not preserve the data type. If the input image is dtype np.single then the output is np.double

Minimal Complete Verifiable Example:

import numpy as np
import dask.array as da
from dask_image.ndfilters import threshold_local

data = da.random.normal(size=(100, 200, 200)).astype(np.single)
print(f'{data.dtype=}')
print(f'{threshold_local(data, [5, 10, 10]).dtype=}')

Anything else we need to know?:

Environment:

  • Dask version: '2025.10.0'
  • Python version: Python 3.12.3 (main, Mar 3 2026, 12:15:18) [GCC 13.3.0]
  • Operating System: Ubuntu 24.04.4 LTS
  • Install method (conda, pip, source): pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions