mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 17:17:07 +08:00
labelplugin, images with multiple channels
This change lets label tool work with images that have multiple channels. Before this change we would a value error.
Test:
```
import skimage
from skimage.viewer import plugins
from skimage import data, viewer, transform, color
imdata = skimage.data.astronaut()
viewer = skimage.viewer.ImageViewer(imdata)
viewer+=skimage.viewer.plugins.LabelPainter()
viewer.show()
```
Previous error:
```
...skimage/viewer/canvastools/painttool.py in at(self, row, col)
188
189 def at(self, row, col):
--> 190 h, w = self.array_shape
191 r = self.radius
192 xmin = max(0, col - r)
ValueError: too many values to unpack (expected 2)
```
This commit is contained in:
@@ -37,7 +37,7 @@ class LabelPainter(Plugin):
|
||||
super(LabelPainter, self).attach(image_viewer)
|
||||
|
||||
image = image_viewer.original_image
|
||||
self.paint_tool = PaintTool(image_viewer, image.shape,
|
||||
self.paint_tool = PaintTool(image_viewer, image.shape[:2],
|
||||
on_enter=self.on_enter)
|
||||
self.paint_tool.radius = self.radius
|
||||
self.paint_tool.label = self._label_widget.index = 1
|
||||
|
||||
Reference in New Issue
Block a user