Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions src/napari_matplotlib/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down