def OnPick(self, event): # FIXME - open rule in respective editing tab raise NotImplementedError from PYME.IO import tabular k = event.artist._data if not (isinstance(k, six.string_types)): self.configureModule(k) else: outp = self.recipes.activeRecipe.namespace[k] if isinstance(outp, ImageStack): if not 'dsviewer' in dir(self.recipes): dv = ViewIm3D(outp, mode='lite') else: if self.recipes.dsviewer.mode == 'visGUI': mode = 'visGUI' else: mode = 'lite' dv = ViewIm3D(outp, mode=mode, glCanvas=self.recipes.dsviewer.glCanvas) elif isinstance(outp, tabular.TabularBase): from PYME.ui import recArrayView f = recArrayView.ArrayFrame(outp, parent=self, title='Data table - %s' % k) f.Show()
def OnPick(self, event): from PYME.IO import tabular from PYME.recipes import graphing k = event.artist._data if not (isinstance(k, six.string_types)): if not self._editing: self._editing = True self.configureModule(k) self._editing = False else: outp = self.recipes.activeRecipe.namespace[k] if isinstance(outp, ImageStack): if not 'dsviewer' in dir(self.recipes): dv = ViewIm3D(outp, mode='lite') else: if self.recipes.dsviewer.mode == 'visGUI': mode = 'visGUI' else: mode = 'lite' dv = ViewIm3D(outp, mode=mode, glCanvas=self.recipes.dsviewer.glCanvas) elif isinstance(outp, tabular.TabularBase): from PYME.ui import recArrayView f = recArrayView.ArrayFrame(outp, parent=self, title='Data table - %s' % k) f.Show() elif isinstance(outp, graphing.Plot): outp.plot()
def OnMeasure(self, event): from PYME.Analysis.points import objectMeasure pipeline = self.visFr.pipeline chans = pipeline.colourFilter.getColourChans() # If we're not using objectIDs from an image, look for other clustering labels # TODO - rather than trying a few pre-set objectID alternatives, make this a dialog instead # - look for objectID and carry on if present # - if not present, display a dialog "No objectID found - did you segment objects? Either cancel, # segment, and come back, or choose an alternative column to use as an ID. keys = ['objectID', 'dbscanClumpID', 'clumpIndex'] key = 'objectID' for k in keys: try: ids = set(pipeline.mapping[k].astype('i')) key = k break except (KeyError): continue # ids = set(pipeline.mapping['objectID'].astype('i')) pipeline.objectMeasures = {} if len(chans) == 0: pipeline.objectMeasures[ 'Everything'] = objectMeasure.measureObjectsByID( pipeline.colourFilter, 10, ids, key) from PYME.ui import recArrayView f = recArrayView.ArrayFrame(pipeline.objectMeasures['Everything'], parent=self.visFr, title='Object Measurements') f.Show() else: curChan = pipeline.colourFilter.currentColour chanNames = chans[:] # if 'Sample.Labelling' in metadata.getEntryNames(): # lab = metadata.getEntry('Sample.Labelling') # # for i in range(len(lab)): # if lab[i][0] in chanNames: # chanNames[chanNames.index(lab[i][0])] = lab[i][1] for ch, i in zip(chans, range(len(chans))): pipeline.colourFilter.setColour(ch) #fitDecayChan(colourFilter, metadata, chanNames[i], i) pipeline.objectMeasures[ chanNames[i]] = objectMeasure.measureObjectsByID( pipeline.colourFilter, 10, ids, key) pipeline.colourFilter.setColour(curChan) from PYME.ui import recArrayView from PYME.IO import tabular from PYME.recipes.tablefilters import AggregateMeasurements om = { k: tabular.RecArraySource(v) for k, v in pipeline.objectMeasures.items() } args = {} for i, name in enumerate(chanNames): args['inputMeasurements%d' % (i + 1)] = name args['suffix%d' % (i + 1)] = ('_' + name) args['outputName'] = 'aggregated' agg = AggregateMeasurements(**args) agg.execute(om) f = recArrayView.ArrayFrame(om['aggregated'], parent=self.visFr, title='Object Measurements') f.Show()