def OnNewPoint(x, y, z, position): global current_cube_index global aborted z_centre = z + focus_offsets[current_cube_index] dir = output[0] + 'Point' + str(position) if not os.path.exists(dir): os.mkdir(dir) for z_current_step in range(-z_images_below, z_images_above + 1): # +1 ensures the last point is aquired if aborted: break z_current = z_centre + z_step * z_current_step print "Capturing image at (z = ", str(z_current), ")" microscope.SetStagePosition(x, y, z_current) microscope.WaitForStage(0.0, 1.0) filename = microscope.ParseSequenceFilename(output[1], position) zpos = '%(#)02d' % {"#": (z_current_step + z_images_below)} filename = microscope.InsertTextIntoFilename(filename, "z" + zpos) filename = microscope.InsertCubeIntoFilename(filename, cubes[current_cube_index]) path = dir + os.sep + filename microscope.SnapAndSaveImage(path)
def OnNewPoint(x, y, z, position): microscope.SetStagePosition(x, y, z) # Wait for stage to finish moving (additional delay=0.1 seconds, time out = 1.0 seconds) microscope.WaitForStage(0.0, 1.0) filename = microscope.ParseSequenceFilename(output[1], position) path = output[0] + filename microscope.SnapAndSaveImage(path)
def OnNewPoint(x, y, z, position): global aborted, spc print "Point: ", position if aborted: break print "Set Fluorescence Mode" microscope.MicroscopeSetMode(0) for cube in cube_data: print "Selecting Cube ", cube['Position'], ": ", cube['Name'] microscope.MoveCubeToPosition(cube['Position']) options = microscope.GetCubeOptions( cube['Position']) # camera exposure, gain and focus offset print "Setting camera exposure to ", options[0] microscope.SetExposure(options[0]) print "Setting camera gain to ", options[1] microscope.SetGain(options[1]) # store the focus offset offset = options[2] if aborted: break print "Moving to (%0.1f, %0.1f, %0.1f)" % (x, y, z + offset) microscope.SetStagePosition(x, y, z + offset) # Wait for stage to finish moving (additional delay seconds, time out seconds) microscope.WaitForStage(0.0, 1.0) output_directory = output[0] filename = output[1] filename = microscope.ParseSequenceFilename(filename, position) filename = microscope.InsertCubeIntoFilename(filename, cube['Position']) path = output_directory + filename print "Acquire with FL cube: ", path microscope.SnapAndSaveImage(path) if aborted: pass print "Set Laser Scanning Mode" microscope.MicroscopeSetMode(2) # Laser Scanning spc.ClearBoardMemory() filename = microscope.ParseSequenceFilename(output[1], position) filename = microscope.InsertTextIntoFilename(filename, "spc") path = output[0] + filename print "Acquire with SPC: ", path spc.AcquireAndSaveToFileUsingUIValues(1, path)
def OnNewPoint(x, y, z, position): global current_cube_index microscope.SetStagePosition(x, y, z + focus_offsets[current_cube_index]) # Wait for stage to finish moving (additional delay=0.1 seconds, time out = 1.0 seconds) microscope.WaitForStage(0.0, 1.0) filename = microscope.ParseSequenceFilename(output[1], position) path = output[0] + filename microscope.SnapAndSaveImage(path)
def OnNewPoint(x, y, z, position): global spc microscope.SetStagePosition(x, y, z) # microscope.SetStagePosition(x, y, (z+11.50)) # wait for stage to finish moving (additional delay=0.1 seconds, time out = 1.0 seconds) microscope.WaitForStage(0.0, 1.0) filename = microscope.ParseSequenceFilename(output[1], position) path = output[0] + filename print "Performing SPC" microscope.MicroscopeSetMode(2) # Laser Scanning spc.ClearBoardMemory() spc.AcquireAndSaveToFileUsingUIValues(1, path) microscope.MicroscopeSetMode(0) # FLuorescence filename = microscope.ParseSequenceFilename(output[1], position) path = output[0] + filename microscope.SnapAndSaveImage(path)
def SnapAndSave(cube_index, rs_point_count): global core global output global cube_data output_directory = output[0] filename = output[1] filename_ext = output[2] cube_details = cube_data[cube_index] filepath = '%s\\%s_Core%d_Point%d_%s%s' % ( output_directory, filename, core, rs_point_count, cube_names[cube_index], filename_ext) print "Saving file: ", filepath microscope.SnapAndSaveImage(filepath)
def OnNewPoint(x, y, z, position): global current_cube_index, camera_acq microscope.SetStagePosition(x, y, z + focus_offsets[current_cube_index]) # Wait for stage to finish moving (additional delay=0.1 seconds, time out = 1.0 seconds) microscope.WaitForStage(0.0, 1.0) filename = microscope.ParseSequenceFilename(output[1], position) path = output[0] + filename if camera_acq == 1: print "Camera image: ", position microscope.SnapAndSaveImage(path) else: print "Performing SPC: ", position spc.ClearBoardMemory() spc.AcquireAndSaveToFileUsingUIValues(1, path)
def OnNewPoint(x, y, z, position): # print "Moving Stage ", (x, y, z) microscope.SetStagePosition(x, y, z) # wait for stage to finish moving (additional delay=0.1 seconds, time out = 1.0 seconds) microscope.WaitForStage(0.0, 1.0) filename = microscope.ParseSequenceFilename(output[1], position) path = output[0] + filename microscope.PerformSoftwareAutoFocus(path) microscope.SnapAndSaveImage(path) #mrowley - 081209 - recording the software auto focus determined focal point for the given well xf, yf, zf = microscope.GetStagePosition() filenameautopts = 'AutoFocusedPlane.pts' path = output[0] + filenameautopts fileautopts = open(path, 'a') fileautopts.write('%.2f' %xf + '\t' + '%.2f' %yf + '\t' + '%.2f' %zf + '\n') fileautopts.close()
def OnNewPoint(x, y, z, position): global core global output global cube_data output_directory = output[0] filename = output[1] filename_ext = output[2] # Move to first cube to perform autofocus. microscope.MoveCubeToPosition(1) # AutoFocus Once for each new point (centre point) print "Performing AutoFocus" microscope.PerformSoftwareAutoFocus() for cube in cubes: if aborted: return; print "Setting camera exposure to ", exposures[cube - 1] microscope.SetExposure(exposures[cube - 1]) print "Setting camera gain to ", gains[cube - 1] microscope.SetGain(gains[cube - 1]) cube_details = cube_data[cube - 1] print "Moving to cube position ", cube microscope.MoveCubeToPosition(cube) print "Moving to (%d,%d)" % (x, y) # Apply focus offset microscope.SetStagePosition(x, y, z + focus_offsets[cube - 1]) # Wait for stage to finish moving (additional delay=0.1 seconds, time out = 1.0 seconds) microscope.WaitForStage(0.0, 5.0) filepath = '%s\\%s_Core%d_%s%s' % (output_directory, filename, core, cube_details["Name"], filename_ext) print "Saving file: ", filepath microscope.SnapAndSaveImage(filepath) core = core + 1
def OnNewPoint(x, y, z, position): global aborted, cube, offset print "Point: ", position if aborted: pass print "Moving to (%0.1f, %0.1f, %0.1f)" % (x, y, z + offset) microscope.SetStagePosition(x, y, z + offset) # Wait for stage to finish moving (additional delay seconds, time out seconds) microscope.WaitForStage(0.0, 1.0) output_directory = output[0] filename = output[1] filename = microscope.ParseSequenceFilename(filename, position) filename = microscope.InsertCubeIntoFilename(filename, cube['Position']) path = output_directory + filename print "Acquire and save ", path microscope.SnapAndSaveImage(path)