Skip to content

Labels object has no attribute rgb error #313

@K-Meech

Description

@K-Meech

Steps to reproduce

  • File > Open Sample > napari builtins > Cells (3D + 2Ch)
  • Plugins > napari matplotlib > Histogram
  • Add a new labels layer, by clicking the 'tag' icon above the layer list

Throws:

File ~\miniforge3\envs\napari-env\Lib\site-packages\napari_matplotlib\histogram.py:111, in HistogramWidget.on_update_layers(self=<napari_matplotlib.histogram.HistogramWidget object>)
    108     return
    110 # Reset the num bins based on new layer data
--> 111 layer_data = self._get_layer_data(self.layers[0])
        self = <napari_matplotlib.histogram.HistogramWidget object at 0x0000025D391692E0>
        self.layers = [<Labels layer 'Labels' at 0x25d4cf77d10>]
        self.layers[0] = <Labels layer 'Labels' at 0x25d4cf77d10>    112 self._set_widget_nums_bins(data=layer_data)

File ~\miniforge3\envs\napari-env\Lib\site-packages\napari_matplotlib\histogram.py:134, in HistogramWidget._get_layer_data(self=<napari_matplotlib.histogram.HistogramWidget object>, layer=<Labels layer 'Labels'>)
    131 if isinstance(layer.data, MultiScaleData):
    132     data = data[layer.data_level]
--> 134 if layer.ndim - layer.rgb == 3:
        layer = <Labels layer 'Labels' at 0x25d4cf77d10>    135     # 3D data, can be single channel or RGB
    136     # Slice in z dimension
    137     data = data[self.current_z]
    138     self.axes.set_title(f"z={self.current_z}")

AttributeError: 'Labels' object has no attribute 'rgb'

This error is then repeatedly thrown when selecting different layers in the layer list.

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions