def OnStart():

    global output
    
    print "Stage Position, ", microscope.GetStagePosition()
    print microscope.GetTimeLapsePoints()
    
    data_dir = microscope.GetUserDataDirectory()
    output = microscope.ShowFileSequenceSaveDialog(data_dir)
        
    print "Saving to directory ", output[0]
    print "Filename Format ", output[1]
Пример #2
0
def OnNewPoint(x, y, z, position):
    global aborted, point_list

    print "Point: ", position
    print("input: x %f, y %f, z %f" % (x, y, z))
    print "list:  ", point_list[position - 1][2]

    # Adjust z to last autofocus position, first time round these two will be the same
    z = point_list[position - 1][2]
    print "Adjust z to last autofocus position: z=", z

    if aborted:
        pass

    microscope.SetStagePosition(x, y, z)
    # 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_ext = output[2]

    #filename = microscope.ParseSequenceFilename(filename, position)
    #filename = microscope.InsertCubeIntoFilename(filename, current_cube_index+1)

    #subdir = '%s\\Cube%d\\Region%d\\' % (output_directory, cubes[current_cube_index], position)
    #subdir = '%s\\Region%d\\' % (output_directory, position)
    subdir = '%s\\Region%d_%s\\' % (output_directory, position,
                                    time.strftime("%d%b%Y_%Hh%Mm%Ss",
                                                  time.localtime(time.time())))

    try:
        os.makedirs(subdir)
    except (OSError):
        print 'os.makedirs(' + subdir + ') FAILED'

    print "Autofocus"
    microscope.PerformSoftwareAutoFocus()
    autoFocusedZPosition = microscope.GetStagePosition()[2]
    point_list[position - 1][2] = autoFocusedZPosition
    print "Auto focused position stored:", point_list[position - 1][2]

    # get the focal plane options for this region and transfer to the region scan module, correct for the autofocus
    rs.SetFocalPlaneOptions(microscope.GetFocalPlaneOptions())
    rs.SetFocalPlaneOffsetFromXYZ(x, y, autoFocusedZPosition)

    # Set region scan with the region width and height
    rs.SetRelativeRoiFromTimelapse(microscope.GetTimeLapseRegion())
    rs.Start(action, subdir, filename, filename_ext)
    rs.Hide()
Пример #3
0
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 OnStart():
    global cubes

    print "Stage Position, ", microscope.GetStagePosition()
    print microscope.GetTimeLapsePoints()

    try:
        # Try to autoexpose within the range of 1 and 60 milli seconds
        # Performing AutoExposure
        print "Performing autoexposure"
        microscope.PerformAutoExposure(1, 60)
    except:
        print "Could not calculate autoexposure. Is there enough light ?"

    try:
        print "Retrieving Cubes"
        cubes = microscope.GetCubes()
    except:
        print "Could not get cubes"
Пример #5
0
def OnStart():
    print "Stage Position, ", microscope.GetStagePosition()
    print microscope.GetTimeLapsePoints()
 def SetRelativeRoiFromTimelapse(self, r):
     """Set the region of interest in microns relative from the current stage position from a width, heigth tuple"""
     x, y, z = microscope.GetStagePosition()
     half_width = r[0] / 2
     half_height = r[1] / 2
     self.SetRoi(x - half_width, y - half_height, r[0], r[1])
 def SetRelativeRoi(self, width, height):
     """Set the region of interest in microns relative from the current stage position"""
     x, y, z = microscope.GetStagePosition()
     half_width = width / 2
     half_height = height / 2
     self.SetRoi(x - half_width, y - half_height, width, height)