def __init__(self, manager, name, config): Module.__init__(self, manager, name, config) self.ui = multipatch_nwb_viewer.MultipatchNwbViewer() self.ui.resize(1600, 900) self.ui.show() self.load_from_dm_btn = QtGui.QPushButton("load from data manager") self.ui.vsplit.insertWidget(0, self.load_from_dm_btn) self.load_from_dm_btn.clicked.connect(self.load_from_dm_clicked)
def __init__(self, manager, name, config): Module.__init__(self, manager, name, config) self.ui = submit_expt.ExperimentSubmitUi() self.ui.resize(1600, 900) self.ui.show() self.load_from_dm_btn = QtGui.QPushButton("load from data manager") self.ui.left_layout.insertWidget(0, self.load_from_dm_btn) self.load_from_dm_btn.clicked.connect(self.load_from_dm_clicked)
def __init__(self, manager, name, config): Module.__init__(self, manager, name, config) self.ui = vimaging.VImagingAnalyzer() self.ui.resize(1600, 900) self.ui.show() self.load_from_dm_btn = QtGui.QPushButton("load from data manager") self.ui.layout.addWidget(self.load_from_dm_btn, self.ui.layout.rowCount(), 0) self.load_from_dm_btn.clicked.connect(self.load_from_dm_clicked)
def __init__(self, manager, name, config): Module.__init__(self, manager, name, config) self.ui = vimaging.VImagingAnalyzer2() self.ui.resize(1600, 900) self.ui.show() self.load_from_dm_btn = QtGui.QPushButton("load from data manager") self.load_from_dm_btn.setParent(self.ui) self.load_from_dm_btn.resize(160, 30) self.load_from_dm_btn.show() self.load_from_dm_btn.clicked.connect(self.load_from_dm_clicked)
def __init__(self, mosaic_editor): self.mosaic_editor = mosaic_editor QtGui.QWidget.__init__(self) self.layout = QtGui.QGridLayout() self.setLayout(self.layout) self.load_btn = QtGui.QPushButton("Download 20x") self.layout.addWidget(self.load_btn, 0, 0) self.load_btn.clicked.connect(self.load_clicked) self.submit_btn = pg.FeedbackButton("Submit cell positions to LIMS") self.layout.addWidget(self.submit_btn, 1, 0) self.submit_btn.clicked.connect(self.submit)
def __init__(self): QtGui.QWidget.__init__(self) self.layout = QtGui.QGridLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) # Set up filter buttons self.btns = OrderedDict() row, col = 0, 0 for name in ['Mean', 'Max', 'Max w/Gaussian', 'Max w/Median', 'Edge']: btn = QtGui.QPushButton(name) self.btns[name] = btn btn.setCheckable(True) self.layout.addWidget(btn, row, col) btn.clicked.connect(self.filterBtnClicked) col += 1 if col > 1: col = 0 row += 1 # show flowchart control panel inside a collapsible group box self.fcGroup = pg.GroupBox('Filter Settings') fgl = QtGui.QVBoxLayout() self.fcGroup.setLayout(fgl) fgl.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(self.fcGroup, row + 1, 0, 1, 2) self.fc = pg.flowchart.Flowchart(terminals={ 'dataIn': { 'io': 'in' }, 'dataOut': { 'io': 'out' } }) fgl.addWidget(self.fc.widget()) self.fcGroup.setCollapsed(True) self.fc.sigStateChanged.connect(self.sigStateChanged)
def __init__(self, image=None, **opts): ## If no image was specified, check for a file handle.. if image is None: image = opts.get('handle', None) item = None self.data = None if isinstance(image, QtGui.QGraphicsItem): item = image elif isinstance(image, np.ndarray): self.data = image elif isinstance(image, DataManager.FileHandle): opts['handle'] = image self.handle = image self.data = self.handle.read() if 'name' not in opts: opts['name'] = self.handle.shortName() try: if 'transform' in self.handle.info(): tr = pg.SRTTransform3D(self.handle.info()['transform']) tr = pg.SRTTransform(tr) ## convert to 2D opts['pos'] = tr.getTranslation() opts['scale'] = tr.getScale() opts['angle'] = tr.getRotation() else: ## check for older info formats if 'imagePosition' in self.handle.info(): opts['scale'] = self.handle.info()['pixelSize'] opts['pos'] = self.handle.info()['imagePosition'] elif 'Downsample' in self.handle.info(): ### Needed to support an older format stored by 2p imager if 'pixelSize' in self.handle.info(): opts['scale'] = self.handle.info()['pixelSize'] if 'microscope' in self.handle.info(): m = self.handle.info()['microscope'] opts['pos'] = m['position'][0:2] else: info = self.data._info[-1] opts['pos'] = info.get('imagePosition', None) elif hasattr(self.data, '_info'): info = self.data._info[-1] opts['scale'] = info.get('pixelSize', None) opts['pos'] = info.get('imagePosition', None) else: opts['defaultUserTransform'] = {'scale': (1e-5, 1e-5)} opts['scalable'] = True except: debug.printExc( 'Error reading transformation for image file %s:' % image.name()) if item is None: item = pg.ImageItem() CanvasItem.__init__(self, item, **opts) self.splitter = QtGui.QSplitter() self.splitter.setOrientation(QtCore.Qt.Vertical) self.layout.addWidget(self.splitter, self.layout.rowCount(), 0, 1, 2) self.filterGroup = pg.GroupBox("Image Filter") fgl = QtGui.QGridLayout() fgl.setContentsMargins(3, 3, 3, 3) fgl.setSpacing(1) self.filterGroup.setLayout(fgl) self.filter = ImageFilterWidget() self.filter.sigStateChanged.connect(self.filterStateChanged) fgl.addWidget(self.filter) self.splitter.addWidget(self.filterGroup) self.histogram = pg.HistogramLUTWidget() self.histogram.setImageItem(self.graphicsItem()) # addWidget arguments: row, column, rowspan, colspan self.splitter.addWidget(self.histogram) self.imgModeCombo = QtGui.QComboBox() self.imgModeCombo.addItems( ['SourceOver', 'Overlay', 'Plus', 'Multiply']) self.layout.addWidget(self.imgModeCombo, self.layout.rowCount(), 0, 1, 1) self.imgModeCombo.currentIndexChanged.connect(self.imgModeChanged) self.autoBtn = QtGui.QPushButton("Auto") self.autoBtn.setCheckable(True) self.autoBtn.setChecked(True) self.layout.addWidget(self.autoBtn, self.layout.rowCount() - 1, 1, 1, 1) self.timeSlider = QtGui.QSlider(QtCore.Qt.Horizontal) self.layout.addWidget(self.timeSlider, self.layout.rowCount(), 0, 1, 2) self.timeSlider.valueChanged.connect(self.timeChanged) # ## controls that only appear if there is a time axis self.timeControls = [self.timeSlider] if self.data is not None: if isinstance(self.data, pg.metaarray.MetaArray): self.filter.setInput(self.data.asarray()) else: self.filter.setInput(self.data) self.updateImage() # Needed to ensure selection box wraps the image properly tr = self.saveTransform() self.resetUserTransform() self.restoreTransform(tr)
def __init__(self, image=None, **opts): """ CanvasItem displaying an image. The image may be 2 or 3-dimensional. Options: image: May be a fileHandle, ndarray, or GraphicsItem. handle: May optionally be specified in place of image """ ## If no image was specified, check for a file handle.. if image is None: image = opts.get('handle', None) item = None self.data = None self.currentT = None if isinstance(image, QtGui.QGraphicsItem): item = image elif isinstance(image, np.ndarray): self.data = image elif isinstance(image, DataManager.FileHandle): opts['handle'] = image self.handle = image self.data = self.handle.read() if 'name' not in opts: opts['name'] = self.handle.shortName() try: if 'transform' in self.handle.info(): tr = pg.SRTTransform3D(self.handle.info()['transform']) tr = pg.SRTTransform(tr) ## convert to 2D opts['pos'] = tr.getTranslation() opts['scale'] = tr.getScale() opts['angle'] = tr.getRotation() else: ## check for older info formats if 'imagePosition' in self.handle.info(): opts['scale'] = self.handle.info()['pixelSize'] opts['pos'] = self.handle.info()['imagePosition'] elif 'Downsample' in self.handle.info(): ### Needed to support an older format stored by 2p imager if 'pixelSize' in self.handle.info(): opts['scale'] = self.handle.info()['pixelSize'] if 'microscope' in self.handle.info(): m = self.handle.info()['microscope'] print 'm: ', m print 'mpos: ', m['position'] opts['pos'] = m['position'][0:2] else: info = self.data._info[-1] opts['pos'] = info.get('imagePosition', None) elif hasattr(self.data, '_info'): info = self.data._info[-1] opts['scale'] = info.get('pixelSize', None) opts['pos'] = info.get('imagePosition', None) else: opts['defaultUserTransform'] = {'scale': (1e-5, 1e-5)} opts['scalable'] = True except: debug.printExc( 'Error reading transformation for image file %s:' % image.name()) if item is None: item = pg.ImageItem() CanvasItem.__init__(self, item, **opts) self.histogram = pg.PlotWidget() self.blockHistogram = False self.histogram.setMaximumHeight(100) self.levelRgn = pg.LinearRegionItem() self.histogram.addItem(self.levelRgn) self.updateHistogram(autoLevels=True) # addWidget arguments: row, column, rowspan, colspan self.layout.addWidget(self.histogram, self.layout.rowCount(), 0, 1, 3) self.timeSlider = QtGui.QSlider(QtCore.Qt.Horizontal) #self.timeSlider.setMinimum(0) #self.timeSlider.setMaximum(self.data.shape[0]-1) self.layout.addWidget(self.timeSlider, self.layout.rowCount(), 0, 1, 3) self.timeSlider.valueChanged.connect(self.timeChanged) self.timeSlider.sliderPressed.connect(self.timeSliderPressed) self.timeSlider.sliderReleased.connect(self.timeSliderReleased) thisRow = self.layout.rowCount() self.edgeBtn = QtGui.QPushButton('Edge') self.edgeBtn.clicked.connect(self.edgeClicked) self.layout.addWidget(self.edgeBtn, thisRow, 0, 1, 1) self.meanBtn = QtGui.QPushButton('Mean') self.meanBtn.clicked.connect(self.meanClicked) self.layout.addWidget(self.meanBtn, thisRow + 1, 0, 1, 1) self.tvBtn = QtGui.QPushButton('tv denoise') self.tvBtn.clicked.connect(self.tvClicked) self.layout.addWidget(self.tvBtn, thisRow + 2, 0, 1, 1) self.maxBtn = QtGui.QPushButton('Max no Filter') self.maxBtn.clicked.connect(self.maxClicked) self.layout.addWidget(self.maxBtn, thisRow, 1, 1, 1) self.maxBtn2 = QtGui.QPushButton('Max w/Gaussian') self.maxBtn2.clicked.connect(self.max2Clicked) self.layout.addWidget(self.maxBtn2, thisRow + 1, 1, 1, 1) self.maxMedianBtn = QtGui.QPushButton('Max w/Median') self.maxMedianBtn.clicked.connect(self.maxMedianClicked) self.layout.addWidget(self.maxMedianBtn, thisRow + 2, 1, 1, 1) self.filterOrder = QtGui.QComboBox() self.filterLabel = QtGui.QLabel('Order') for n in range(1, 11): self.filterOrder.addItem("%d" % n) self.layout.addWidget(self.filterLabel, thisRow + 3, 2, 1, 1) self.layout.addWidget(self.filterOrder, thisRow + 3, 3, 1, 1) self.zPlanes = QtGui.QComboBox() self.zPlanesLabel = QtGui.QLabel('# planes') for s in ['All', '1', '2', '3', '4', '5']: self.zPlanes.addItem("%s" % s) self.layout.addWidget(self.zPlanesLabel, thisRow + 3, 0, 1, 1) self.layout.addWidget(self.zPlanes, thisRow + 3, 1, 1, 1) ## controls that only appear if there is a time axis self.timeControls = [ self.timeSlider, self.edgeBtn, self.maxBtn, self.meanBtn, self.maxBtn2, self.maxMedianBtn, self.filterOrder, self.zPlanes ] if self.data is not None: self.updateImage(self.data) self.graphicsItem().sigImageChanged.connect(self.updateHistogram) self.levelRgn.sigRegionChanged.connect(self.levelsChanged) self.levelRgn.sigRegionChangeFinished.connect( self.levelsChangeFinished)