def transformTargets(self,im1,im2,targets): newtargets = [] shape = {} shape['im1'] = im1['image'].shape shape['im2'] = im2['image'].shape im1scope = im1['scope'] im1camera = im1['camera'] im1trans = caltransformer.getTransformer(im1scope['tem'], im1camera['ccdcamera'], im1scope['high tension'], im1scope['magnification'], im1.timestamp) im2scope = im2['scope'] im2camera = im2['camera'] im2trans = caltransformer.getTransformer(im2scope['tem'], im2camera['ccdcamera'], im2scope['high tension'], im2scope['magnification'], im2.timestamp) c_lastnumber = self.lastTargetNumber(image=im1, session=self.session) c_number = c_lastnumber + 1 a_lastnumber = self.lastTargetNumber(image=im2, session=self.session) a_number = a_lastnumber + 1 for type in self.childtargetnames: for targetdata in targets: if targetdata['type'] == type: drow = targetdata['delta row'] dcol = targetdata['delta column'] transformed_targetdata = self.newTargetForImage(im1, drow, dcol, type='transformed', list=self.childtargetlist, number=c_number) self.publish(transformed_targetdata, database=True) pixvect = {'row':drow,'col':dcol} ## get stage position of target on first image bin = im1camera['binning'] stage0 = im1scope['stage position'] stage = im1trans.transform(pixvect, stage0, bin) ## get pixel position of stage position on second image bin = im2camera['binning'] stage0 = im2scope['stage position'] pix = im2trans.itransform(stage, stage0, bin) drow = pix['row'] dcol = pix['col'] if type == 'c_focus': a_type = 'focus' if type == 'c_acquisition': a_type = 'acquisition' a_targetdata = self.newTargetForImage(im2, drow, dcol, type=a_type, list=self.targetlist, number=a_number, fromtarget=transformed_targetdata) self.publish(a_targetdata, database=True) newtargets.append(a_targetdata) c_number += 1 a_number += 1 return newtargets
def __init__(self, scope, camera, timestamp, fileref=None, rotation=0.0): self.scope = leginondata.ScopeEMData(initializer=scope) self.camera = leginondata.CameraEMData(initializer=camera) self.shape = self.camera['dimension']['y'], self.camera['dimension']['x'] self.fileref = fileref self.timestamp = timestamp self.trans = caltransformer.getTransformer(scope['tem'], camera['ccdcamera'], scope['high tension'], scope['magnification'], timestamp, rotation) self.newStage(scope['stage position'])
def __init__(self, scope, camera, timestamp, fileref=None, rotation=0.0): self.scope = leginondata.ScopeEMData(initializer=scope) self.camera = leginondata.CameraEMData(initializer=camera) self.shape = self.camera['dimension']['y'], self.camera['dimension'][ 'x'] self.fileref = fileref self.timestamp = timestamp self.trans = caltransformer.getTransformer(scope['tem'], camera['ccdcamera'], scope['high tension'], scope['magnification'], timestamp, rotation) self.newStage(scope['stage position'])
def transformTargets(self, im1, im2, targets): newtargets = [] shape = {} shape['im1'] = im1['image'].shape shape['im2'] = im2['image'].shape im1scope = im1['scope'] im1camera = im1['camera'] im1trans = caltransformer.getTransformer(im1scope['tem'], im1camera['ccdcamera'], im1scope['high tension'], im1scope['magnification'], im1.timestamp) im2scope = im2['scope'] im2camera = im2['camera'] im2trans = caltransformer.getTransformer(im2scope['tem'], im2camera['ccdcamera'], im2scope['high tension'], im2scope['magnification'], im2.timestamp) c_lastnumber = self.lastTargetNumber(image=im1, session=self.session) c_number = c_lastnumber + 1 a_lastnumber = self.lastTargetNumber(image=im2, session=self.session) a_number = a_lastnumber + 1 for type in self.childtargetnames: for targetdata in targets: if targetdata['type'] == type: drow = targetdata['delta row'] dcol = targetdata['delta column'] transformed_targetdata = self.newTargetForImage( im1, drow, dcol, type='transformed', list=self.childtargetlist, number=c_number) self.publish(transformed_targetdata, database=True) pixvect = {'row': drow, 'col': dcol} ## get stage position of target on first image bin = im1camera['binning'] stage0 = im1scope['stage position'] stage = im1trans.transform(pixvect, stage0, bin) ## get pixel position of stage position on second image bin = im2camera['binning'] stage0 = im2scope['stage position'] pix = im2trans.itransform(stage, stage0, bin) drow = pix['row'] dcol = pix['col'] if type == 'c_focus': a_type = 'focus' if type == 'c_acquisition': a_type = 'acquisition' a_targetdata = self.newTargetForImage( im2, drow, dcol, type=a_type, list=self.targetlist, number=a_number, fromtarget=transformed_targetdata) self.publish(a_targetdata, database=True) newtargets.append(a_targetdata) c_number += 1 a_number += 1 return newtargets
def transformTargets(self, im1, im2, targets): newtargets = [] shape = {} shape["im1"] = im1["image"].shape shape["im2"] = im2["image"].shape im1scope = im1["scope"] im1camera = im1["camera"] im1trans = caltransformer.getTransformer( im1scope["tem"], im1camera["ccdcamera"], im1scope["high tension"], im1scope["magnification"], im1.timestamp ) im2scope = im2["scope"] im2camera = im2["camera"] im2trans = caltransformer.getTransformer( im2scope["tem"], im2camera["ccdcamera"], im2scope["high tension"], im2scope["magnification"], im2.timestamp ) c_lastnumber = self.lastTargetNumber(image=im1, session=self.session) c_number = c_lastnumber + 1 a_lastnumber = self.lastTargetNumber(image=im2, session=self.session) a_number = a_lastnumber + 1 for type in self.childtargetnames: for targetdata in targets: if targetdata["type"] == type: drow = targetdata["delta row"] dcol = targetdata["delta column"] transformed_targetdata = self.newTargetForImage( im1, drow, dcol, type="transformed", list=self.childtargetlist, number=c_number ) self.publish(transformed_targetdata, database=True) pixvect = {"row": drow, "col": dcol} ## get stage position of target on first image bin = im1camera["binning"] stage0 = im1scope["stage position"] stage = im1trans.transform(pixvect, stage0, bin) ## get pixel position of stage position on second image bin = im2camera["binning"] stage0 = im2scope["stage position"] pix = im2trans.itransform(stage, stage0, bin) drow = pix["row"] dcol = pix["col"] if type == "c_focus": a_type = "focus" if type == "c_acquisition": a_type = "acquisition" a_targetdata = self.newTargetForImage( im2, drow, dcol, type=a_type, list=self.targetlist, number=a_number, fromtarget=transformed_targetdata, ) self.publish(a_targetdata, database=True) newtargets.append(a_targetdata) c_number += 1 a_number += 1 return newtargets