if x == 0: pix_x = 0 else: pix_x += step_pix_x image_file = "frame" + "-" + str(y) + "-" + str(x) + ".tif" image_path = os.path.join(base_path, timestr, image_file) pX, pY = (x * dx_x_move + y * dx_y_move, y * dy_y_move + x * dy_x_move) print y, x, pY, pX move = (x, y, sx + pX, sy + pY, pix_x, pix_y, image_path, image_file) moves.append(move) move0 = moves[0] if sx != move0[2] or sy != move0[3]: stage.set_pos(move0[2], move0[3]) for i, move in enumerate(moves): if temcaGraph.aborting: break x, y, pX, pY, pix_x, pix_y, image_path, image_file = move temcaGraph.wait_start_of_frame() temcaGraph.grab_frame(image_path, x, y) meta_file.write(image_file + "\t" + str(pix_x) + "\t" + str(pix_y) + "\t0\n") sys.stdout.write(".") temcaGraph.wait_graph_event(temcaGraph.eventCaptureCompleted) # move the stage here # stage.set_pos(cx, cy)
angle = 120 #temcaGraph.optimize_exposure() #temcaGraph.set_mode('preview') #for mode in ['temca', 'preview', 'raw']: temcaGraph.set_mode('temca') while True: # get the template temcaGraph.wait_start_of_frame() temcaGraph.grab_frame('j:/junk/junk.tif', 0,0) # filename doesn't matter in preview temcaGraph.wait_graph_event(temcaGraph.eventAsyncProcessingCompleted) if msvcrt.kbhit() and (msvcrt.getch() == ' '): break stage.set_pos(sx+dx, sy) while True: # measure the offset temcaGraph.wait_start_of_frame() temcaGraph.grab_frame('j:/junk/junk.tif', 0,0) # filename doesn't matter in preview temcaGraph.wait_graph_event(temcaGraph.eventAsyncProcessingCompleted) if msvcrt.kbhit() and (msvcrt.getch() == ' '): break stage.set_pos(sx, sy) temcaGraph.close() temcaGraph.wait_graph_event(temcaGraph.eventFiniCompleted)