diff --git a/docs/changelog.rst b/docs/changelog.rst index a31a0d3a..e3b62dae 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,5 +1,16 @@ Changelog ========= +1.0.2 +----- +Bug fixes +~~~~~~~~~ +- A full dataset is no longer read into memory when using ``HistogramWidget``. + Only the current slice is loaded. + +Changes +~~~~~~~ +- Histogram bin limits are now caclualted from the slice being histogrammed, and + not the whole dataset. This is as a result of the above bug fix. 1.0.1 ----- diff --git a/src/napari_matplotlib/histogram.py b/src/napari_matplotlib/histogram.py index 39ad41a3..ab098f38 100644 --- a/src/napari_matplotlib/histogram.py +++ b/src/napari_matplotlib/histogram.py @@ -33,7 +33,6 @@ def draw(self) -> None: Clear the axes and histogram the currently selected layer/slice. """ layer = self.layers[0] - bins = np.linspace(np.min(layer.data), np.max(layer.data), 100) if layer.data.ndim - layer.rgb == 3: # 3D data, can be single channel or RGB @@ -41,6 +40,12 @@ def draw(self) -> None: self.axes.set_title(f"z={self.current_z}") else: data = layer.data + # Read data into memory if it's a dask array + data = np.asarray(data) + + # Important to calculate bins after slicing 3D data, to avoid reading + # whole cube into memory. + bins = np.linspace(np.min(data), np.max(data), 100) if layer.rgb: # Histogram RGB channels independently pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy