Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8dbfdba

Browse files
authored
Merge pull request#191 from dstansby/histogram-data
Don't read full cube into mem for histogramming
2 parentsb3f11a8 +0523d28 commit8dbfdba

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎docs/changelog.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
Changelog
22
=========
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.
314

415
1.0.1
516
-----

‎src/napari_matplotlib/histogram.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ def draw(self) -> None:
3333
Clear the axes and histogram the currently selected layer/slice.
3434
"""
3535
layer=self.layers[0]
36-
bins=np.linspace(np.min(layer.data),np.max(layer.data),100)
3736

3837
iflayer.data.ndim-layer.rgb==3:
3938
# 3D data, can be single channel or RGB
4039
data=layer.data[self.current_z]
4140
self.axes.set_title(f"z={self.current_z}")
4241
else:
4342
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)
4449

4550
iflayer.rgb:
4651
# Histogram RGB channels independently

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp