class AtContrastWidget(QtWidgets.QWidget): def __init__(self, parent, tileview, featuredlg=None, *args, **kw): super(AtContrastWidget, self).__init__(parent) self.tileview = tileview self.featuredlg = featuredlg self.parent = parent self.colors = None vbox = QtWidgets.QVBoxLayout(self) self.enhancer = AtEnhancerWidget(self) vbox.addWidget(self.enhancer) vbox.setContentsMargins(0, 0, 0, 0) self.enhancer.sliderReleased.connect(self.enhanceContrast) def setChannelNames(self, channels, colors): self.colors = colors self.enhancer.clear() for channel in channels: self.enhancer.addChannel(cn.display(channel), no_auto_button=True) def enhanceContrast(self): try: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) i = self.enhancer.currentChannelIndex() color = QtGui.QColor(self.colors[i]) lut = self.enhancer.lut_from_color(i, color, 256) for item in self.tileview.items: item.enhancePixmap(i, lut) finally: QApplication.restoreOverrideCursor()
class AtContrastWidget(QtWidgets.QWidget): def __init__(self, parent, tileview, featuredlg=None, *args, **kw): super(AtContrastWidget, self).__init__(parent) self.tileview = tileview self.featuredlg = featuredlg self.parent = parent self.colors = None vbox = QtWidgets.QVBoxLayout(self) self.enhancer= AtEnhancerWidget(self) vbox.addWidget(self.enhancer) vbox.setContentsMargins(0, 0, 0, 0) self.enhancer.sliderReleased.connect(self.enhanceContrast) def setChannelNames(self, channels, colors): self.colors = colors self.enhancer.clear() for channel in channels: self.enhancer.addChannel(cn.display(channel), no_auto_button=True) def enhanceContrast(self): try: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) i = self.enhancer.currentChannelIndex() color = QtGui.QColor(self.colors[i]) lut = self.enhancer.lut_from_color(i, color, 256) for item in self.tileview.items: item.enhancePixmap(i, lut) finally: QApplication.restoreOverrideCursor()
class AtContrastWidget(QtWidgets.QWidget): def __init__(self, parent, view, featuredlg=None, *args, **kw): super(AtContrastWidget, self).__init__(parent) self.view = view self.featuredlg = featuredlg self.parent = parent vbox = QtWidgets.QVBoxLayout(self) vbox.setContentsMargins(2, 2, 2, 2) self.enhancer = AtEnhancerWidget(self) vbox.addWidget(self.enhancer) self.enhancer.sliderReleased.connect(self.enhanceContrast) def setChannelNames(self, channels, colors): self.enhancer.clear() for channel, color in zip(channels, colors): self.enhancer.addChannel(cn.display(channel), color, no_auto_button=True) def updateView(self, index=None): channels = self.enhancer.channelFlags() for item in self.view.items: item.setActiveChannels(channels) item.toggleOutline(self.view.vflags & ViewFlags.Outline) self.enhanceContrast(index) def enhanceContrast(self, index=None): if index is None: index = self.enhancer.currentChannelIndex() try: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) lut = self.enhancer.lut_from_channel(index, 256) for item in self.view.items: item.enhancePixmap(index, lut) finally: QApplication.restoreOverrideCursor()