Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3f11a8 commit 38fbccdCopy full SHA for 38fbccd
src/napari_matplotlib/histogram.py
@@ -33,7 +33,6 @@ def draw(self) -> None:
33
Clear the axes and histogram the currently selected layer/slice.
34
"""
35
layer = self.layers[0]
36
- bins = np.linspace(np.min(layer.data), np.max(layer.data), 100)
37
38
if layer.data.ndim - layer.rgb == 3:
39
# 3D data, can be single channel or RGB
@@ -42,6 +41,10 @@ def draw(self) -> None:
42
41
else:
43
data = layer.data
44
+ # Important to calculate bins after slicing 3D data, to avoid reading
45
+ # whole cube into memory.
46
+ bins = np.linspace(np.min(layer.data), np.max(layer.data), 100)
47
+
48
if layer.rgb:
49
# Histogram RGB channels independently
50
for i, c in enumerate("rgb"):
0 commit comments