def __init__(self, display, axes, data=None, names=None, **kwargs): for a in axes: a.setPen() # update colour theme ImageView.__init__( self, view=pg.PlotItem( axisItems={ 'bottom': axes[0], 'left': axes[1]})) PyqtgraphgDisplayBase.__init__(self) DisplayWidget.__init__(self, **kwargs) self.display = display self.moveLayerToNewImage = None self.cItems = OrderedDict() # colorlayerItems self.sigTimeChanged.connect(self.display.highlightLayer) # for unified access within different widgets: self.item = self.imageItem self.setTitle = self.view.setTitle self._firstTime = True self._changed = False self._timeline_visible = True self._image_redefined = False self._moved_layer = None self._set_kwargs = {} self.opts['discreteTimeLine'] = True # TODO: better would be to init imageView with given histrogramAxis # ... but this is easier: axes[2].sigLabelChanged.connect(self.setHistogramLabel) self.setHistogramLabel(axes[2].labelText) axes[2].sigRangeChanged.connect(self.ui.histogram.axis.setRange) axes[2].sigFontSizeChanged.connect(self._setHistogramFontSize) # hide buttons self.ui.roiBtn.hide() self.ui.menuBtn.hide() # fixed height for time axis: self.ui.splitter.setSizes([self.height() - 35, 35]) self.ui.splitter.setStretchFactor(0, 1) # Remove ROI plot: self.ui.roiPlot.setMouseEnabled(False, False) self.ui.roiPlot.hide() #default color set #NO: only gray works also with color images #self.ui.histogram.item.gradient.loadPreset('flame') if data is not None: self.update(data) self.updateView()
def close(self): self.sigTimeChanged.disconnect(self.display.highlightLayer) self.clear() # free memory try: ImageView.close(self) except TypeError: pass
def __init__(self, display, axes, data=None, names=None, **kwargs): for a in axes: a.setPen() # update colour theme ImageView.__init__(self, view=pg.PlotItem(axisItems={ 'bottom': axes[0], 'left': axes[1] })) PyqtgraphgDisplayBase.__init__(self) DisplayWidget.__init__(self, **kwargs) self.display = display self.moveLayerToNewImage = None self.cItems = OrderedDict() #colorlayerItems #for unified access within different widgets: self.item = self.imageItem self.setTitle = self.view.setTitle self._firstTime = True self._changed = False self._timeline_visible = True self._image_redefined = False self._moved_layer = None self._set_kwargs = {} self.setOpts(discreteTimeSteps=True) #make splitter an unchangeable small grey line: s = self.ui.splitter s.handle(1).setEnabled(False) s.setStyleSheet("QSplitter::handle{background-color: grey}") s.setHandleWidth(2) #TODO: better would be to init imageView with given histrogramAxis # ... but this is easier: axes[2].sigLabelChanged.connect(self.setHistogramLabel) self.setHistogramLabel(axes[2].labelText) axes[2].sigRangeChanged.connect(self.ui.histogram.axis.setRange) axes[2].sigFontSizeChanged.connect(self._setHistogramFontSize) #hide buttons self.ui.roiBtn.hide() self.ui.normBtn.hide() #fixed height for time axis: self.ui.splitter.setSizes([self.height() - 35, 35]) self.ui.splitter.setStretchFactor(0, 1) #Remove ROI plot: self.ui.roiPlot.setMouseEnabled(False, False) self.ui.roiPlot.hide() if data is not None: self.update(data) self.updateView()
def __init__(self, display, axes, data=None, names=None, **kwargs): for a in axes: a.setPen() # update colour theme ImageView.__init__(self, view=pg.PlotItem(axisItems={'bottom':axes[0],'left':axes[1]})) PyqtgraphgDisplayBase.__init__(self) DisplayWidget.__init__(self, **kwargs) self.display = display self.moveLayerToNewImage = None self.cItems = OrderedDict() #colorlayerItems #for unified access within different widgets: self.item = self.imageItem self.setTitle = self.view.setTitle self._firstTime = True self._changed = False self._timeline_visible = True self._image_redefined = False self._moved_layer = None self._set_kwargs = {} self.setOpts(discreteTimeSteps=True) #make splitter an unchangeable small grey line: s = self.ui.splitter s.handle(1).setEnabled(False) s.setStyleSheet("QSplitter::handle{background-color: grey}") s.setHandleWidth(2) #TODO: better would be to init imageView with given histrogramAxis # ... but this is easier: axes[2].sigLabelChanged.connect(self.setHistogramLabel) self.setHistogramLabel(axes[2].labelText) axes[2].sigRangeChanged.connect(self.ui.histogram.axis.setRange) axes[2].sigFontSizeChanged.connect(self._setHistogramFontSize) #hide buttons self.ui.roiBtn.hide() self.ui.normBtn.hide() #fixed height for time axis: self.ui.splitter.setSizes([self.height()-35, 35]) self.ui.splitter.setStretchFactor (0, 1) #Remove ROI plot: self.ui.roiPlot.setMouseEnabled(False, False) self.ui.roiPlot.hide() if data is not None: self.update(data) self.updateView()
def __init__(self, display, axes, data=None, names=None, **kwargs): for a in axes: a.setPen() # update colour theme ImageView.__init__( self, view=pg.PlotItem( axisItems={ 'bottom': axes[0], 'left': axes[1]}) ) PyqtgraphgDisplayBase.__init__(self) DisplayWidget.__init__(self, **kwargs) self.display = display self.moveLayerToNewImage = None self.cItems = OrderedDict() # colorlayerItems self.sigTimeChanged.connect(self.display.highlightLayer) # for unified access within different widgets: self.item = self.imageItem self.setTitle = self.view.setTitle self._firstTime = True self._changed = False self._timeline_visible = True self._image_redefined = False self._moved_layer = None self._set_kwargs = {} self.opts['discreteTimeLine'] = True # TODO: better would be to init imageView with given histrogramAxis # ... but this is easier: axes[2].sigLabelChanged.connect(self.setHistogramLabel) self.setHistogramLabel(axes[2].labelText) axes[2].sigRangeChanged.connect(self.ui.histogram.axis.setRange) axes[2].sigFontSizeChanged.connect(self._setHistogramFontSize) # hide buttons self.ui.roiBtn.hide() self.ui.menuBtn.hide() # fixed height for time axis: self.ui.splitter.setSizes([self.height() - 35, 35]) self.ui.splitter.setStretchFactor(0, 1) # Remove ROI plot: self.ui.roiPlot.setMouseEnabled(False, False) self.ui.roiPlot.hide() # ------------------- # Context menu over colorbar histogram: vb = self.ui.histogram.vb menu = vb.menu # remove 'Export...' menu: vb.raiseContextMenu = self._cbar_raiseContextMenu # remove mouse mode menu.removeAction(menu.leftMenu.menuAction()) # remove redundsant menus: menu.removeAction( next(a for a in menu.actions() if a.text() == 'X Axis')) # menu.removeAction( # next(a for a in menu.actions() if 'Export' in a.text())) # y-Axis menu yAxisAction = next(a for a in menu.actions() if a.text() == 'Y Axis') yAxisAction.setText('Scale') # connect min-max edit with cbar intensity range change: menu.ctrl[-1].minText.editingFinished.connect(self._cbar_updateRange) menu.ctrl[-1].maxText.editingFinished.connect(self._cbar_updateRange) # add cbar fit: menu.addAction('Fit').triggered.connect(self._cbar_fit)
def close(self): self.clear()#free memory try: ImageView.close(self) except TypeError: pass
def close(self): self.clear() #free memory try: ImageView.close(self) except TypeError: pass