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:
M Clark
2016-08-15 14:33:39 +08:00
committed by GitHub
parent 99136abfc6
commit 06f73d7611
+1 -1
View File
@@ -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