def updateImage(self, dummy=None): if self._images is None: raise RuntimeError("No images set!") images = list() contours = dict() ccolor = AtConfig().contours_complementary_color for i, n in self.checkedChannels().iteritems(): # converting the gray image to the color defined in the button color = self.widgetAt(i, 1).currentColor() image = self._images[i] lut = self.enhancer.lut_from_color(i, color, 256) image.setColorTable(lut) images.append(image) if self._contours is not None: if ccolor: color = AtPainter.complementaryColor(color) contours[color] = self._contours[n] pixmap = AtPainter.blend(images) # sometimes qt segfaults when drawing polygons if AtConfig().draw_contours_in_pixmap: pixmap = AtPainter.drawContours(pixmap, contours) self.newContourImage.emit(pixmap, None) else: self.newContourImage.emit(pixmap, contours)
def enhancePixmap(self, index, lut): self.qimages[index].setColorTable(lut) qimages = [img for img, flag in zip(self.qimages, self._image_flags) if flag] if not qimages: self._pixmap = QtGui.QPixmap(self.shape[0], self.shape[1]) self._pixmap.fill(Colors.black) else: self._pixmap = AtPainter.blend(qimages) self._pixmapItem.setPixmap(self._pixmap)
def updateView(self, dummy=None): if self._images is None: raise RuntimeError("No images set!") images = list() contours = dict() ccolor = AtConfig().contours_complementary_color for i, n in self.checkedChannels().iteritems(): # converting the gray image to the color defined in the button image = self._images[i] lut = self.lut_from_channel(i, 256) image.setColorTable(lut) images.append(image) if self._contours is not None: color = QtGui.QColor(self.colors[n]) if ccolor: color = AtPainter.complementaryColor(color) contours[color] = self._contours[n] pixmap = AtPainter.blend(images) self.newContourImage.emit(pixmap, contours)
def pixmap(self): # XXX be aware of thread safety images = list(self.iterQImages()) return AtPainter.blend(images)
def enhancePixmap(self, index, lut): self.qimages[index].setColorTable(lut) self._pixmap = AtPainter.blend(self.qimages) self._pixmapItem.setPixmap(self._pixmap)