Loading openflexure_microscope/captures/capture.py +30 −36 Original line number Diff line number Diff line Loading @@ -60,9 +60,7 @@ def build_captures_from_exif(capture_path): for f in files: logging.debug("Reloading capture {}...".format(f)) exif = pull_usercomment_dict(f) if exif: capture = capture_from_exif(f, exif) capture = capture_from_path(f) if capture: captures[capture.id] = capture else: Loading @@ -73,17 +71,9 @@ def build_captures_from_exif(capture_path): return captures def capture_from_exif(path, exif_dict): """ Creates an instance of CaptureObject from a dictionary of capture information. This is used when reloading the API server, to restore captures created in the previous session. Args: path (str): Path to image file exif_dict (dict): Dictionary containing capture information """ def capture_from_path(path): exif_dict = pull_usercomment_dict(path) if exif_dict: # Create a placeholder capture capture = CaptureObject(filepath=path) Loading @@ -101,7 +91,9 @@ def capture_from_exif(path, exif_dict): # Populate capture parameters capture.id = image_metadata.get("id") capture.datetime = dateutil.parser.isoparse(image_metadata.get("acquisitionDate")) capture.datetime = dateutil.parser.isoparse( image_metadata.get("acquisitionDate") ) capture.format = image_metadata.get("format") capture.tags = image_metadata.get("tags") capture.annotations = image_metadata.get("annotations") Loading @@ -110,6 +102,8 @@ def capture_from_exif(path, exif_dict): capture.set_metadata(exif_dict) return capture else: return None class CaptureObject(object): Loading Loading
openflexure_microscope/captures/capture.py +30 −36 Original line number Diff line number Diff line Loading @@ -60,9 +60,7 @@ def build_captures_from_exif(capture_path): for f in files: logging.debug("Reloading capture {}...".format(f)) exif = pull_usercomment_dict(f) if exif: capture = capture_from_exif(f, exif) capture = capture_from_path(f) if capture: captures[capture.id] = capture else: Loading @@ -73,17 +71,9 @@ def build_captures_from_exif(capture_path): return captures def capture_from_exif(path, exif_dict): """ Creates an instance of CaptureObject from a dictionary of capture information. This is used when reloading the API server, to restore captures created in the previous session. Args: path (str): Path to image file exif_dict (dict): Dictionary containing capture information """ def capture_from_path(path): exif_dict = pull_usercomment_dict(path) if exif_dict: # Create a placeholder capture capture = CaptureObject(filepath=path) Loading @@ -101,7 +91,9 @@ def capture_from_exif(path, exif_dict): # Populate capture parameters capture.id = image_metadata.get("id") capture.datetime = dateutil.parser.isoparse(image_metadata.get("acquisitionDate")) capture.datetime = dateutil.parser.isoparse( image_metadata.get("acquisitionDate") ) capture.format = image_metadata.get("format") capture.tags = image_metadata.get("tags") capture.annotations = image_metadata.get("annotations") Loading @@ -110,6 +102,8 @@ def capture_from_exif(path, exif_dict): capture.set_metadata(exif_dict) return capture else: return None class CaptureObject(object): Loading