matplotlib / matplotlib/napari-matplotlib

HistogramWidget: 'MultiScaleData' object has no attribute 'ndim'

未关闭
#251 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug
主要语言
Python
星标
46
派生
24
PR 合并指标
30 天内没有已合并 PR

描述

Getting this error trying to use HistogramWidget with some zarr data loaded into napari:

File ~/miniconda3/lib/python3.11/site-packages/napari_matplotlib/histogram.py:72, in HistogramWidget.draw(self=<napari_matplotlib.histogram.HistogramWidget object>)
     67 """
     68 Clear the axes and histogram the currently selected layer/slice.
     69 """
     70 layer = self.layers[0]
---> 72 if layer.data.ndim - layer.rgb == 3:
        layer = <Image layer 'full_rebinned_4' at 0x16d1ad390>
        layer.rgb = False
     73     # 3D data, can be single channel or RGB
     74     data = layer.data[self.current_z]
     75     self.axes.set_title(f"z={self.current_z}")

AttributeError: 'MultiScaleData' object has no attribute 'ndim'

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 napari_matplotlib/histogram.py 中的 HistogramWidget.draw 开始,重点查看访问 layer.data.ndim 的第 72 行。将报告中的 zarr 数据加载到 napari 中以复现错误,并跟踪 MultiScaleData 如何提供给 widget。当 HistogramWidget 能够处理这些数据且不引发报告的 AttributeError 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。