From 0ee2f04b920e9582c21b240f0664bc09e6089d04 Mon Sep 17 00:00:00 2001 From: David Baddeley Date: Fri, 24 Sep 2021 08:47:21 +1200 Subject: [PATCH] pass parent to OMDialog constructor --- PYME/LMVis/Extras/objectMeasurements.py | 101 ++++++++++++------------ 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/PYME/LMVis/Extras/objectMeasurements.py b/PYME/LMVis/Extras/objectMeasurements.py index 5541a6802..fa6ad01eb 100644 --- a/PYME/LMVis/Extras/objectMeasurements.py +++ b/PYME/LMVis/Extras/objectMeasurements.py @@ -146,67 +146,68 @@ def OnMeasure(self, event): # except(KeyError): # continue - dlg = OMDialog(pipeline.keys()) + dlg = OMDialog(pipeline.keys(), parent=self.visFr) if not dlg.ShowModal() == wx.ID_OK: dlg.Destroy() raise RuntimeError('User cancelled column selection') + else: - key = dlg.label_key - ids = set(pipeline.mapping[key].astype('i')) - edge_cutoff = dlg.edge_cutoff - - dlg.Destroy() - - # ids = set(pipeline.mapping['objectID'].astype('i')) - - pipeline.objectMeasures = {} + key = dlg.label_key + ids = set(pipeline.mapping[key].astype('i')) + edge_cutoff = dlg.edge_cutoff - if len(chans) == 0: - pipeline.objectMeasures['Everything'] = objectMeasure.measureObjectsByID(pipeline.colourFilter, edge_cutoff, ids, - key) + dlg.Destroy() + + # ids = set(pipeline.mapping['objectID'].astype('i')) - from PYME.ui import recArrayView - f = recArrayView.ArrayFrame(pipeline.objectMeasures['Everything'], parent=self.visFr, title='Object Measurements') - f.Show() - - else: - curChan = pipeline.colourFilter.currentColour + pipeline.objectMeasures = {} - chanNames = chans[:] + if len(chans) == 0: + pipeline.objectMeasures['Everything'] = objectMeasure.measureObjectsByID(pipeline.colourFilter, edge_cutoff, ids, + key) -# 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, edge_cutoff, ids, - key) + from PYME.ui import recArrayView + f = recArrayView.ArrayFrame(pipeline.objectMeasures['Everything'], parent=self.visFr, title='Object Measurements') + f.Show() - pipeline.colourFilter.setColour(curChan) + 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, edge_cutoff, 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) + from PYME.ui import recArrayView + from PYME.IO import tabular + from PYME.recipes.tablefilters import AggregateMeasurements - args['outputName'] = 'aggregated' - - agg = AggregateMeasurements(**args) - agg.execute(om) - - f = recArrayView.ArrayFrame(om['aggregated'], parent=self.visFr, title='Object Measurements') - f.Show() + 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() def gen_pairwise_distance_features(self, event=None):