def openOptions(self): tablename, plotName = self.optButtons[self.sender()] params = dict(allclasses[tablename].plotAptitudes)[plotName]['params'] d = ParamDialog(params, keyformemory = 'plotOptions/'+plotName , applicationdict = self.globalApplicationDict, ) d.update(self.plotParams[tablename][plotName]) if d.exec_(): self.plotParams[tablename][plotName] = d.get_dict()
def changePreProcessOptions(self): dia = ParamDialog(preProcessParamDefault , keyformemory = 'imageserieviewer/preprocess' , applicationdict = self.globalApplicationDict, title = 'Pre-process parameters', ) dia.param_widget.update( self.preProcessParams ) ok = dia.exec_() if ok == QDialog.Accepted: self.preProcessParams = dia.param_widget.get_dict() self.changeimageSerie(self.imageserie)
def changePlotOptions(self): dia = ParamDialog(self.plotParamDefault , #~ keyformemory = 'imageserieviewer/plot' , #~ applicationdict = self.globalApplicationDict, title = 'Plot parameters', ) dia.param_widget.update( self.plotParams ) ok = dia.exec_() if ok == QDialog.Accepted: self.plotParams = dia.param_widget.get_dict() self.refresh()
def changePreProcessOptions(self): dia = ParamDialog( preProcessParamDefault, keyformemory='imageserieviewer/preprocess', applicationdict=self.globalApplicationDict, title='Pre-process parameters', ) dia.param_widget.update(self.preProcessParams) ok = dia.exec_() if ok == QDialog.Accepted: self.preProcessParams = dia.param_widget.get_dict() self.changeimageSerie(self.imageserie)
def save(self): params = [ [ 'save_waveform', { 'value': 'save filtered waveform', 'label': 'Save waveform in database', 'possible': [ 'save filtered waveform', 'do not save', 'save natural waveform' ] } ], [ 'spiketrain_mode', { 'value': 'standalone', 'label': 'SpikeTrain mode (container = spike table, standalone = more efficient)', 'possible': ['standalone', 'container'] } ], ['save_trash', { 'value': True, 'label': 'Save spike in trash', }], [ 'create_empty', { 'value': True, 'label': 'If no spikes have been detected, create an empty neuron', } ], ] d = ParamDialog( params, applicationdict=self.globalApplicationDict, keyformemory='spikesorting/databaseoptions', title='database options', ) if d.exec_(): try: self.spikesorter.save_to_db(**d.get_dict()) except: warn = """A problem occured during saving to db...""" mb = QMessageBox.warning( self, self.tr('Save'), self.tr(warn), QMessageBox.Ok, )
def changePlotOptions(self): dia = ParamDialog( self.plotParamDefault, #~ keyformemory = 'imageserieviewer/plot' , #~ applicationdict = self.globalApplicationDict, title='Plot parameters', ) dia.param_widget.update(self.plotParams) ok = dia.exec_() if ok == QDialog.Accepted: self.plotParams = dia.param_widget.get_dict() self.refresh()
def exportImages(self): param = [ ['path' , { 'value' : '' , 'label' : 'path to export images' , 'widgettype' : ChooseDirWidget }], ['dpi' , { 'value' : 80 , 'label' : 'DPI' }], ['width' , { 'value' : 8. , 'label' : 'Width (inch)' }], ['height' , { 'value' : 6. , 'label' : 'Height (inch)' } ], ['force_proportions' , { 'value' : False , 'label' : 'Force proportions' } ], ] dia = ParamDialog(param , keyformemory = 'imageserieviewer/exportImages' , applicationdict = self.globalApplicationDict, title = 'Export all images', ) dia.param_widget.update( self.preProcessParams ) ok = dia.exec_() if ok == QDialog.Accepted: d = dia.param_widget.get_dict() canvas = SimpleCanvas() canvas.figure.set_dpi(d['dpi']) if not d['force_proportions']: canvas.figure.set_size_inches(d['width'] , d['height']) dpi = d['dpi'] else: canvas.figure.set_size_inches(self.images.shape[2]/10. , self.images.shape[1]/10.) dpi = 10 canvas.figure.set_dpi(dpi) ax = canvas.figure.add_axes([0., 0., 1., 1.]) ax.set_xticks([ ]) ax.set_yticks([ ]) cax = None if self.plotParams['plotColorbar']: cax = canvas.figure.add_axes([.9,.1,.04,.8]) image = ax.imshow(self.images[0] , cmap=self.cmap , interpolation = 'nearest', origin='lower', ) if self.plotParams['plotColorbar']: canvas.figure.colorbar(image , ax = ax , cax= cax) for i in range(self.imageserie.images.shape[0]): image.set_array(self.images[i]) canvas.figure.savefig( os.path.join( d['path'], 'image %04d.png'%i) , dpi = dpi)
def save(self): params = [ [ 'save_waveform' , {'value' :'save filtered waveform' , 'label' : 'Save waveform in database', 'possible' : ['save filtered waveform','do not save' , 'save natural waveform' ] }], [ 'spiketrain_mode' , {'value' :'standalone' , 'label' : 'SpikeTrain mode (container = spike table, standalone = more efficient)', 'possible' : ['standalone','container' ] }], [ 'save_trash' , {'value' : True , 'label' : 'Save spike in trash', } ], [ 'create_empty' , {'value' : True , 'label' : 'If no spikes have been detected, create an empty neuron', } ], ] d = ParamDialog(params, applicationdict = self.globalApplicationDict, keyformemory = 'spikesorting/databaseoptions' , title = 'database options', ) if d.exec_(): try: self.spikesorter.save_to_db(**d.get_dict()) except: warn = """A problem occured during saving to db...""" mb = QMessageBox.warning(self,self.tr('Save'),self.tr(warn), QMessageBox.Ok ,)
def openOptions(self): tablename, plotName = self.optButtons[self.sender()] params = dict(allclasses[tablename].plotAptitudes)[plotName]['params'] d = ParamDialog( params, keyformemory='plotOptions/' + plotName, applicationdict=self.globalApplicationDict, ) d.update(self.plotParams[tablename][plotName]) if d.exec_(): self.plotParams[tablename][plotName] = d.get_dict()
def exportImages(self): param = [ [ 'path', { 'value': '', 'label': 'path to export images', 'widgettype': ChooseDirWidget } ], ['dpi', { 'value': 80, 'label': 'DPI' }], ['width', { 'value': 8., 'label': 'Width (inch)' }], ['height', { 'value': 6., 'label': 'Height (inch)' }], [ 'force_proportions', { 'value': False, 'label': 'Force proportions' } ], ] dia = ParamDialog( param, keyformemory='imageserieviewer/exportImages', applicationdict=self.globalApplicationDict, title='Export all images', ) dia.param_widget.update(self.preProcessParams) ok = dia.exec_() if ok == QDialog.Accepted: d = dia.param_widget.get_dict() canvas = SimpleCanvas() canvas.figure.set_dpi(d['dpi']) if not d['force_proportions']: canvas.figure.set_size_inches(d['width'], d['height']) dpi = d['dpi'] else: canvas.figure.set_size_inches(self.images.shape[2] / 10., self.images.shape[1] / 10.) dpi = 10 canvas.figure.set_dpi(dpi) ax = canvas.figure.add_axes([0., 0., 1., 1.]) ax.set_xticks([]) ax.set_yticks([]) cax = None if self.plotParams['plotColorbar']: cax = canvas.figure.add_axes([.9, .1, .04, .8]) image = ax.imshow( self.images[0], cmap=self.cmap, interpolation='nearest', origin='lower', ) if self.plotParams['plotColorbar']: canvas.figure.colorbar(image, ax=ax, cax=cax) for i in range(self.imageserie.images.shape[0]): image.set_array(self.images[i]) canvas.figure.savefig(os.path.join(d['path'], 'image %04d.png' % i), dpi=dpi)