threshold_local does not preserve data type
- Dominant language
- Python
- Stars
- 226
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
**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**:
```python
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
Contributor guide
Research direction
Start at the threshold_local entry point and run the self-contained example from the issue to reproduce the dtype mismatch. Trace how the input dtype is handled, then verify that threshold_local returns the same dtype as its input for the shown np.single case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100