From 34c9e2c3226370717c2f86703a21154dd56d8607 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 23 Jan 2024 18:33:34 +0000 Subject: [PATCH 1/2] Fix HistogramWidget for multiscale data --- src/napari_matplotlib/histogram.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/napari_matplotlib/histogram.py b/src/napari_matplotlib/histogram.py index 073620d..ffbd1ff 100644 --- a/src/napari_matplotlib/histogram.py +++ b/src/napari_matplotlib/histogram.py @@ -4,6 +4,8 @@ import numpy as np import numpy.typing as npt from matplotlib.container import BarContainer +from napari.layers import Image +from napari.layers._multiscale_data import MultiScaleData from qtpy.QtWidgets import ( QComboBox, QLabel, @@ -67,14 +69,18 @@ def draw(self) -> None: """ Clear the axes and histogram the currently selected layer/slice. """ - layer = self.layers[0] + layer: Image = self.layers[0] + data = layer.data - if layer.data.ndim - layer.rgb == 3: + if isinstance(layer.data, MultiScaleData): + data = data[layer.data_level] + + if layer.ndim - layer.rgb == 3: # 3D data, can be single channel or RGB - data = layer.data[self.current_z] + # Slice in z dimension + data = data[self.current_z] 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) From 31c8fac9bacb87c34a6dffa46781ac7849be1c70 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 23 Jan 2024 18:39:17 +0000 Subject: [PATCH 2/2] Fix pandas deprecation warning --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 22ff307..ba9f9e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,14 +6,15 @@ build-backend = "setuptools.build_meta" write_to = "src/napari_matplotlib/_version.py" [tool.pytest.ini_options] -qt_api = "pyqt6" -addopts = "--mpl --mpl-baseline-relative" filterwarnings = [ "error", + "ignore:(?s).*Pyarrow will become a required dependency of pandas", # Coming from vispy "ignore:distutils Version classes are deprecated:DeprecationWarning", "ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning", ] +qt_api = "pyqt6" +addopts = "--mpl --mpl-baseline-relative" [tool.black] line-length = 79 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