def __init__(self, parent): self._init_ctrls(parent) optParse=OptionParser() optParse.add_option('-A','--ADV',action='store_const',dest='userlevel',const=1,default=0,help='Set User to Advanced',metavar='USERLEVEL') optParse.add_option('-X','--EXP',action='store_const',dest='userlevel',const=2,default=0,help='Set User to Expert',metavar='USERLEVEL') optParse.add_option('-H','--HOST',dest='host',type='string',help='Override hostname for computer',default=socket.gethostname(),metavar='HOST') optParse.add_option('-D','--DEBUG',action='store_true',dest='debug',help='Run program in debug mode',default=False,metavar='DEBUG') optParse.add_option('-L','--LOG',action='store_true',dest='log',help='Pump screen output to a log',default=False,metavar='LOG') optParse.add_option('-R','--RO',action='store_true',dest='readonly',help='Epics Variables are Read Only',default=False,metavar='READONLY') optParse.set_description('The graphical tool for the sample alignment code') optParse.print_help() (opt,args)=optParse.parse_args() if opt.log: newPipe=__LoggingPipe__('Autoalign') globals()['sys'].stdout=newPipe globals()['sys'].stderr=newPipe dSize=(2048,2048) self.traceGraph = kPlot(name=u'traceGraph', parent=self, pos=wx.Point(16, 104), size=wx.Size(456-16*2, 464), style=0,xAxis=(-dSize[0]/2,dSize[0]/2),yAxis=(-dSize[1]/2,dSize[1]/2),title='Sample Alignment') self.histoPlot = kPlot(name=u'histoPlot', parent=self, pos=wx.Point(16, 104+16+464), size=wx.Size(464*2+16, 200), style=0,title='Histogram') self.cmbMaterial = dictComboBox(dict=X_ROBOT_X02DA_AALib.sampleThreshLib, name=u'cmbMaterial', parent=self, pos=wx.Point(224, 16), size=wx.Size(112, 27), style=0, value=u'Material...') self.cmbMaterial.SetLabel(u'') self.stime=time.time() self.txtGlob.SetValue('$HOME/*/*/tif/*.tif') # old search string '$HOME/Data10/disk2/*/tif/*.tif' self.graphTimer=wx.Timer(self,-1) self.timerCycle=5000 self.graphTimer.Start(self.timerCycle) self.Bind(wx.EVT_TIMER,self.mainTimerEvent) self.cImg=100 self.cKey='' self.cThresh=self.threshVal.GetValue()/10.0 self.cThresh=1.0 self.OnTxtGlobTextEnter([]) self.dRange=[] self.batchEye=-2 self.previewMode=0 self.myStage=alignStage() self.oldImageName='' self.oldFlatName='' self.oldThresh=[] self.oldMat='' self.searchRunning=0 #self.fltSelection.SetItems(self.imgList.keys()) #self.doLoadImage() self.flatIsLoaded=False
def __init__(self,opt=[]): print "Class Femur Align!!" self.cmbMaterial='Mouse Femur @ 20keV' self.myStage=alignStage() self.cImg=100 self.cKey='' self.cThresh=1.0 self.dRange=[] self.batchEye=-2 self.previewMode=0 self.myStage.SPECtoSNAP() self.xBin=self.myStage.xBinChan.getVal() self.yBin=self.myStage.yBinChan.getVal() self.oldImageName='' self.oldFlatName='' self.oldThresh=[] self.oldMat='' self.searchRunning=0 self.flatLoadTime=-1 self.flatLifetime=180 self.dSize=(self.myStage.dimxChan.getVal(),self.myStage.dimyChan.getVal()) if opt.exptime>0: nExpTime=float(opt.exptime) self.myStage.snapExpTime.putVal(nExpTime) print 'Exposure Time Updated: '+str(nExpTime) self.topTol=opt.toptol/self.yBin self.botTol=opt.bottol/self.yBin self.centTol=opt.centtol/self.xBin self.topIter=opt.topiter self.botIter=opt.botiter self.centIter=opt.centiter self.topJump=opt.topjump/self.yBin self.botJump=opt.botjump/self.yBin self.thickSteps=opt.thicksteps self.minPctBone=opt.minpctbone self.baseImage='Snap' self.AlignKeys={} self.debugMode=opt.debug self.saveMode=opt.save self.kImageObj=kImage() self.kImageObj.threshold(useMat=self.cmbMaterial) self.kImageObj._impResults['minPCT']=0.005 # 1% should be enough if opt.server>0: self.Server()