File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
Changelog
2
2
=========
3
+ 1.0.2
4
+ -----
5
+ Bug fixes
6
+ ~~~~~~~~~
7
+ - A full dataset is no longer read into memory when using ``HistogramWidget ``.
8
+ Only the current slice is loaded.
9
+
10
+ Changes
11
+ ~~~~~~~
12
+ - Histogram bin limits are now caclualted from the slice being histogrammed, and
13
+ not the whole dataset. This is as a result of the above bug fix.
3
14
4
15
1.0.1
5
16
-----
Original file line number Diff line number Diff line change @@ -33,14 +33,19 @@ def draw(self) -> None:
33
33
Clear the axes and histogram the currently selected layer/slice.
34
34
"""
35
35
layer = self .layers [0 ]
36
- bins = np .linspace (np .min (layer .data ), np .max (layer .data ), 100 )
37
36
38
37
if layer .data .ndim - layer .rgb == 3 :
39
38
# 3D data, can be single channel or RGB
40
39
data = layer .data [self .current_z ]
41
40
self .axes .set_title (f"z={ self .current_z } " )
42
41
else :
43
42
data = layer .data
43
+ # Read data into memory if it's a dask array
44
+ data = np .asarray (data )
45
+
46
+ # Important to calculate bins after slicing 3D data, to avoid reading
47
+ # whole cube into memory.
48
+ bins = np .linspace (np .min (data ), np .max (data ), 100 )
44
49
45
50
if layer .rgb :
46
51
# Histogram RGB channels independently
You can’t perform that action at this time.
0 commit comments