def createTransformFile(self): # Get alignment from database specimen_euler, tiltaz, origins, rotations = apTomo.getAlignmentFromDB(self.alignerdata,self.imgcenter) centertuple = (self.imgcenter['x'],self.imgcenter['y']) imodaffines = apProTomo.convertProtomoToImod(specimen_euler, tiltaz, origins, rotations,centertuple) processdir = self.params['rundir'] apImod.writeTransformFile(processdir, self.seriesname,imodaffines,ext='xf') imodlocalaffines = apTomo.convertGlobalToLocalAffines(imodaffines) apImod.writeTransformFile(processdir, self.seriesname,imodlocalaffines,ext='prexf')
def start(self): ###do queries sessiondata = apDatabase.getSessionDataFromSessionName( self.params['sessionname']) self.sessiondata = sessiondata tiltseriesdata = apDatabase.getTiltSeriesDataFromTiltNumAndSessionId( self.params['tiltseries'], sessiondata) tiltseriessettings = apTomo.getTomographySettings( sessiondata, tiltseriesdata) tiltdata = apTomo.getImageList([tiltseriesdata]) description = self.params['description'] apDisplay.printMsg("getting imagelist") print "ordering list" tilts, ordered_imagelist, ordered_mrc_files, refimg = apTomo.orderImageList( tiltdata) #tilts are tilt angles, ordered_imagelist are imagedata, ordered_mrc_files are paths to files, refimg is an int ###set up files seriesname = 'series' + str(self.params['tiltseries']) tiltfilename = seriesname + '.tlt' param_out = seriesname + '.param' maxtilt = max([abs(tilts[0]), abs(tilts[-1])]) apDisplay.printMsg("highest tilt angle is %f" % maxtilt) self.params['cos_alpha'] = math.cos(maxtilt * math.pi / 180) self.params['raw_path'] = os.path.join(self.params['rundir'], 'raw') rawexists = apParam.createDirectory(self.params['raw_path']) apDisplay.printMsg("copying raw images") newfilenames = apProTomo.getImageFiles(ordered_imagelist, self.params['raw_path'], link=False) #get alignment data alignerdata = apTomo.getAlignerdata(self.params['alignerid']) imgshape = apTomo.getTomoImageShape(ordered_imagelist[0]) imgcenter = {'x': self.imgshape[1] / 2, 'y': self.imgshape[0] / 2} specimen_euler, azimuth, origins, rotations = apTomo.getAlignmentFromDB( alignerdata, imgcenter) #write protomo2 tilt file outtltfile = 'series.tlt' seriesname = 'series' apProTomo.writeTiltFile2(outfilename, seriesname, specimen_eulers, azimuth, referenceimage)
def createTransformFile(self): # Get alignment from database specimen_euler, tiltaz, origins, rotations = apTomo.getAlignmentFromDB( self.alignerdata, self.imgcenter) centertuple = (self.imgcenter['x'], self.imgcenter['y']) imodaffines = apProTomo.convertProtomoToImod(specimen_euler, tiltaz, origins, rotations, centertuple) processdir = self.params['rundir'] apImod.writeTransformFile(processdir, self.seriesname, imodaffines, ext='xf') imodlocalaffines = apTomo.convertGlobalToLocalAffines(imodaffines) apImod.writeTransformFile(processdir, self.seriesname, imodlocalaffines, ext='prexf')
def start(self): ###do queries sessiondata = apDatabase.getSessionDataFromSessionName(self.params['sessionname']) self.sessiondata = sessiondata tiltseriesdata = apDatabase.getTiltSeriesDataFromTiltNumAndSessionId(self.params['tiltseries'],sessiondata) tiltseriessettings= apTomo.getTomographySettings(sessiondata,tiltseriesdata) tiltdata=apTomo.getImageList([tiltseriesdata]) description = self.params['description'] apDisplay.printMsg("getting imagelist") print "ordering list" tilts,ordered_imagelist,ordered_mrc_files,refimg = apTomo.orderImageList(tiltdata) #tilts are tilt angles, ordered_imagelist are imagedata, ordered_mrc_files are paths to files, refimg is an int ###set up files seriesname='series'+str(self.params['tiltseries']) tiltfilename=seriesname+'.tlt' param_out=seriesname+'.param' maxtilt=max([abs(tilts[0]),abs(tilts[-1])]) apDisplay.printMsg("highest tilt angle is %f" % maxtilt) self.params['cos_alpha']=math.cos(maxtilt*math.pi/180) self.params['raw_path']=os.path.join(self.params['rundir'],'raw') rawexists=apParam.createDirectory(self.params['raw_path']) apDisplay.printMsg("copying raw images") newfilenames=apProTomo.getImageFiles(ordered_imagelist,self.params['raw_path'], link=False) #get alignment data alignerdata = apTomo.getAlignerdata(self.params['alignerid']) imgshape = apTomo.getTomoImageShape(ordered_imagelist[0]) imgcenter = {'x':self.imgshape[1]/2,'y':self.imgshape[0]/2} specimen_euler, azimuth, origins, rotations = apTomo.getAlignmentFromDB(alignerdata,imgcenter) #write protomo2 tilt file outtltfile='series.tlt' seriesname='series' apProTomo.writeTiltFile2(outfilename, seriesname, specimen_eulers, azimuth, referenceimage )