def start(self): ### some of this should go in preloop functions ###do queries sessiondata = apDatabase.getSessionDataFromSessionName(self.params['sessionname']) self.sessiondata = sessiondata tiltseriesdata = apDatabase.getTiltSeriesDataFromTiltNumAndSessionId(self.params['tiltseries'],sessiondata) tiltdata=apTomo.getImageList([tiltseriesdata]) description = self.params['description'] apDisplay.printMsg("getting imagelist") 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) ###create tilt file #get image size from the first image imagesizex=tiltdata[0]['image'].shape[0] imagesizey=tiltdata[0]['image'].shape[1] #shift half tilt series relative to eachother #SS I'm arbitrarily making the bin parameter here 1 because it's not necessary to sample at this point shifts = apTomo.getGlobalShift(ordered_imagelist, 1, refimg) #OPTION: refinement might be more robust by doing one round of IMOD aligment to prealign images before doing protomo refine origins=apProTomo2Prep.convertShiftsToOrigin(shifts, imagesizex, imagesizey) #determine azimuth azimuth=apTomo.getAverageAzimuthFromSeries(ordered_imagelist) apProTomo2Prep.writeTileFile2(tiltfilename, seriesname, newfilenames, origins, tilts, azimuth, refimg)
======= imagesizex = tiltdata[0]['image'].shape[0] imagesizey = tiltdata[0]['image'].shape[1] >>>>>>> .r18846 #shift half tilt series relative to eachother #SS I'm arbitrarily making the bin parameter here 1 because it's not necessary to sample at this point shifts = apTomo.getGlobalShift(ordered_imagelist, 1, refimg) #OPTION: refinement might be more robust by doing one round of IMOD aligment to prealign images before doing protomo refine origins = apProTomo2Prep.convertShiftsToOrigin(shifts, imagesizex, imagesizey) #determine azimuth <<<<<<< .mine azimuth = apTomo.getAverageAzimuthFromSeries(ordered_imagelist) apProTomo2Prep.writeTiltFile2(tiltfilename, seriesname, newfilenames, origins, tilts, azimuth, refimg) ======= azimuth = apTomo.getAverageAzimuthFromSeries(ordered_imagelist) if self.params['azimuth'] is not None: azimuth = self.params['azimuth'] apProTomo2Prep.writeTileFile2(tiltfilename, seriesname, newfilenames, origins, tilts, azimuth, refimg) >>>>>>> .r18846 #===================== if __name__ == '__main__': protomo2prep = ProTomo2Prep() protomo2prep.start() protomo2prep.close()