Exemplo n.º 1
0
 def find_loop(self):
     """
     Description:
     """
     image_array = self.camera_hwobj.get_snapshot(return_as_array=True)
     (info, x, y) = lucid.find_loop(image_array)
     surface_score = 10
     return x, y, surface_score
Exemplo n.º 2
0
 def detect_shape_coord(self):
     snapshot = self.camera_hwobj.get_frame(bw=True, return_as_array=False)
     snapshot_filename = os.path.join(tempfile.gettempdir(), "mxcube_sample_snapshot.png")
     snapshot.save(snapshot_filename)
     info, x, y = lucid.find_loop(snapshot_filename)
     surface_info = self.get_surface_info(self.camera_hwobj.get_frame(\
           bw=True, return_as_array=True))
     return ((50, 50), (400, 400))
 def find_loop(self):
     """
     Description:
     """
     image_array = self.camera_hwobj.get_snapshot(return_as_array=True)
     (info, x, y) = lucid.find_loop(image_array)
     surface_score = 10
     return x, y, surface_score
Exemplo n.º 4
0
 def find_loop(self):
     """
     Description:
     """
     image_array = HWR.beamline.sample_view.get_snapshot(return_as_array=True)
     (info, x, y) = lucid.find_loop(image_array)
     surface_score = 10
     return x, y, surface_score
Exemplo n.º 5
0
 def find_loop(self):
     """
     Description:
     """
     imgStr=self.camera.get_snapshot_img_str()
     image = Image.open(io.BytesIO(imgStr))
     try:
         img = np.array(image)
         img_rot = np.rot90(img,1)
         info, y, x = lucid.find_loop(np.array(img_rot,order='C'),IterationClosing=6)
         x = self.camera.getWidth() - x
     except:
         return -1,-1, 0
     if info == "Coord":
         surface_score = 10
         return x, y, surface_score
     else:
         return  -1,-1, 0
def find_loop(camera, pixelsPerMm_Hor, chi_angle, msg_cb, new_point_cb):
  snapshot_filename = os.path.join(tempfile.gettempdir(), "mxcube_sample_snapshot.png")
  camera.takeSnapshot(snapshot_filename, bw=True)
  
  info, x, y = lucid.find_loop(snapshot_filename,IterationClosing=6)
  
  try:
    x = float(x)
    y = float(y)
  except Exception:
    return -1, -1
 
  if isinstance(msg_cb, collections.Callable):
    msg_cb("Loop found: %s (%d, %d)" % (info, x, y))
  if isinstance(new_point_cb, collections.Callable):
    new_point_cb((x,y))
        
  return x, y
Exemplo n.º 7
0
def find_loop(camera, pixelsPerMm_Hor, chi_angle, msg_cb, new_point_cb):
  snapshot_filename = os.path.join(tempfile.gettempdir(), "mxcube_sample_snapshot.png")
  camera.takeSnapshot(snapshot_filename, bw=True)
  
  info, x, y = lucid.find_loop(snapshot_filename, debug=False,pixels_per_mm_horizontal=pixelsPerMm_Hor, chi_angle=chi_angle)
  
  try:
    x = float(x)
    y = float(y)
  except Exception:
    return -1, -1
 
  if callable(msg_cb):
    msg_cb("Loop found: %s (%d, %d)" % (info, x, y))
  if callable(new_point_cb):
    new_point_cb((x,y))
        
  return x, y
Exemplo n.º 8
0
 def find_loop(self):
     """
     Description:
     """
     imgStr=self.camera.get_snapshot_img_str()
     image = Image.open(io.BytesIO(imgStr))
     try:
         img = np.array(image)
         img_rot = np.rot90(img,1)
         info, y, x = lucid.find_loop(np.array(img_rot,order='C'),IterationClosing=6)
         x = self.camera.getWidth() - x
     except:
         return -1,-1, 0
     if info == "Coord":
         surface_score = 10
         return x, y, surface_score
     else:
         return  -1,-1, 0
Exemplo n.º 9
0
def find_loop(camera, pixelsPerMm_Hor, chi_angle, msg_cb, new_point_cb):
    snapshot_filename = os.path.join(tempfile.gettempdir(),
                                     "mxcube_sample_snapshot.png")
    camera.takeSnapshot(snapshot_filename, bw=True)

    info, x, y = lucid.find_loop(snapshot_filename, IterationClosing=6)

    try:
        x = float(x)
        y = float(y)
    except Exception:
        return -1, -1

    if isinstance(msg_cb, collections.Callable):
        msg_cb("Loop found: %s (%d, %d)" % (info, x, y))
    if isinstance(new_point_cb, collections.Callable):
        new_point_cb((x, y))

    return x, y
Exemplo n.º 10
0
def find_loop(camera, pixelsPerMm_Hor, chi_angle, msg_cb, new_point_cb):
  logging.info(">>>>>>>>>>>>>>>>>>>>>>>...................... I find_loop")
  logging.info(">>>>>>>>>>>>>>>>>>>>>>>...................... camera is %s" % str(camera))
  snapshot_filename = os.path.join(tempfile.gettempdir(), "mxcube_sample_snapshot.png")
  logging.info(">>>>>>>>>>>>>>>>>>>>>>>...................... II find_loop snapshot_filename is %s" % str(snapshot_filename))
  camera.save_snapshot(snapshot_filename)
  logging.info(">>>>>>>>>>>>>>>>>>>>>>>...................... III find_loop snapshot_filename done")
  #camera.takeSnapshot(snapshot_filename, bw=True)
  
  #info, x, y = lucid.find_loop(snapshot_filename,IterationClosing=6)
  info, x, y = lucid.find_loop(snapshot_filename)
  
  try:
    x = float(x)
    y = float(y)
  except Exception:
    return -1, -1
 
  if callable(msg_cb):
    msg_cb("Loop found: %s (%d, %d)" % (info, x, y))
  if callable(new_point_cb):
    new_point_cb((x,y))
        
  return x, y