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 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) 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