def OnSetShiftField(self, event): fdialog = wx.FileDialog(None, 'Select shift field', wildcard='*.sf', style=wx.OPEN, defaultDir = nameUtils.genShiftFieldDirectoryPath()) succ = fdialog.ShowModal() if (succ == wx.ID_OK): sfname = fdialog.GetPath().encode() self.SetShiftField(sfname)
def OnSetShiftField(self, event): fdialog = wx.FileDialog( None, 'Select shift field', wildcard='*.sf', style=wx.OPEN, defaultDir=nameUtils.genShiftFieldDirectoryPath()) succ = fdialog.ShowModal() if (succ == wx.ID_OK): sfname = fdialog.GetPath().encode() self.SetShiftField(sfname)
def OnSetShiftField(self, event=None): from PYME.FileUtils import nameUtils fdialog = wx.FileDialog(None, 'Please select shift field to use ...', wildcard='Shift fields|*.sf', style=wx.OPEN, defaultDir = nameUtils.genShiftFieldDirectoryPath()) succ = fdialog.ShowModal() if (succ == wx.ID_OK): #self.ds = example.CDataStack(fdialog.GetPath().encode()) #self.ds = sfFilename = fdialog.GetPath() self.image.mdh.setEntry('chroma.ShiftFilename', sfFilename) dx, dy = np.load(sfFilename) self.image.mdh.setEntry('chroma.dx', dx) self.image.mdh.setEntry('chroma.dy', dy) #self.md.setEntry('PSFFile', psfFilename) #self.stShiftFieldName.SetLabel('Shifts: %s' % os.path.split(sfFilename)[1]) #self.stShiftFieldName.SetForegroundColour(wx.Colour(0, 128, 0)) return True else: return False
def OnSetShiftField(self, event=None): from PYME.FileUtils import nameUtils fdialog = wx.FileDialog( None, 'Please select shift field to use ...', wildcard='Shift fields|*.sf', style=wx.OPEN, defaultDir=nameUtils.genShiftFieldDirectoryPath()) succ = fdialog.ShowModal() if (succ == wx.ID_OK): #self.ds = example.CDataStack(fdialog.GetPath().encode()) #self.ds = sfFilename = fdialog.GetPath() self.image.mdh.setEntry('chroma.ShiftFilename', sfFilename) dx, dy = np.load(sfFilename) self.image.mdh.setEntry('chroma.dx', dx) self.image.mdh.setEntry('chroma.dy', dy) #self.md.setEntry('PSFFile', psfFilename) #self.stShiftFieldName.SetLabel('Shifts: %s' % os.path.split(sfFilename)[1]) #self.stShiftFieldName.SetForegroundColour(wx.Colour(0, 128, 0)) return True else: return False
def OnGenShiftmapQuad(self, event): from PYME.Analysis import twoColour, twoColourPlot pipeline = self.visFr.pipeline vs = [pipeline.mdh['voxelsize.x']*1e3, pipeline.mdh['voxelsize.y']*1e3, 200.] x0 = (pipeline.mdh['Camera.ROIPosX'] -1)*vs[0] y0 = (pipeline.mdh['Camera.ROIPosY'] -1)*vs[1] lx = len(pipeline.filter['x']) bbox = None#[0,(pipeline.mdh['Camera.ROIWidth'] + 1)*vs[0], 0,(pipeline.mdh['Camera.ROIHeight'] + 1)*vs[1]] dx, dy, spx, spy, good = twoColour.genShiftVectorFieldQ(pipeline.filter['x']+.1*pylab.randn(lx) + x0, pipeline.filter['y']+.1*pylab.randn(lx) + y0, pipeline.filter['fitResults_dx'], pipeline.filter['fitResults_dy'], pipeline.filter['fitError_dx'], pipeline.filter['fitError_dy'], bbox=bbox) #twoColourPlot.PlotShiftField(dx, dy, spx, spy) twoColourPlot.PlotShiftField2(spx, spy, pipeline.mdh['Splitter.Channel0ROI'][2:], voxelsize=vs) twoColourPlot.PlotShiftResiduals(pipeline['x'][good] + x0, pipeline['y'][good] + y0, pipeline['fitResults_dx'][good], pipeline['fitResults_dy'][good], spx, spy) import cPickle defFile = os.path.splitext(os.path.split(self.visFr.GetTitle())[-1])[0] + '.sf' fdialog = wx.FileDialog(None, 'Save shift field as ...', wildcard='Shift Field file (*.sf)|*.sf', style=wx.SAVE|wx.HIDE_READONLY, defaultDir = nameUtils.genShiftFieldDirectoryPath(), defaultFile=defFile) succ = fdialog.ShowModal() if (succ == wx.ID_OK): fpath = fdialog.GetPath() #save as a pickle containing the data and voxelsize fid = open(fpath, 'wb') cPickle.dump((spx, spy), fid, 2) fid.close()