Loading docs/source/plugins/example/plugin.py +1 −3 Original line number Diff line number Diff line Loading @@ -61,9 +61,7 @@ class MyPluginClass(MicroscopePlugin): for _ in range(n_images): # Create a data stream to capture to output = self.microscope.camera.new_image( temporary=False ) output = self.microscope.camera.new_image(temporary=False) # Capture a still image from the Pi camera, into the data stream self.microscope.camera.capture(output.file, use_video_port=True) Loading openflexure_microscope/api/v1/blueprints/base.py +4 −5 Original line number Diff line number Diff line Loading @@ -39,10 +39,8 @@ class SnapshotAPI(MicroscopeView): # Restart stream worker thread self.microscope.camera.start_worker() return Response( self.microscope.camera.get_frame(), mimetype="image/jpeg", ) return Response(self.microscope.camera.get_frame(), mimetype="image/jpeg") class StateAPI(MicroscopeView): def get(self): Loading Loading @@ -240,7 +238,8 @@ def construct_blueprint(microscope_obj): ) blueprint.add_url_rule( "/snapshot", view_func=SnapshotAPI.as_view("snapshot", microscope=microscope_obj) "/snapshot", view_func=SnapshotAPI.as_view("snapshot", microscope=microscope_obj), ) blueprint.add_url_rule( Loading openflexure_microscope/api/v1/blueprints/task.py +2 −6 Original line number Diff line number Diff line Loading @@ -134,12 +134,8 @@ def construct_blueprint(microscope_obj): blueprint = Blueprint("task_blueprint", __name__) blueprint.add_url_rule( "/", view_func=TaskListAPI.as_view("task_list") ) blueprint.add_url_rule("/", view_func=TaskListAPI.as_view("task_list")) blueprint.add_url_rule( "/<task_id>/", view_func=TaskAPI.as_view("task") ) blueprint.add_url_rule("/<task_id>/", view_func=TaskAPI.as_view("task")) return blueprint openflexure_microscope/camera/base.py +4 −9 Original line number Diff line number Diff line Loading @@ -120,15 +120,10 @@ class BaseCamera(metaclass=ABCMeta): self.stream_timeout = 20 self.stream_timeout_enabled = False self.state = { "board": None } self.state = {"board": None} # TODO: Load/save these to config self.paths = { "default": BASE_CAPTURE_PATH, "temp": TEMP_CAPTURE_PATH } self.paths = {"default": BASE_CAPTURE_PATH, "temp": TEMP_CAPTURE_PATH} # Capture data self.images = [] Loading Loading @@ -296,7 +291,7 @@ class BaseCamera(metaclass=ABCMeta): output = CaptureObject(filepath=filepath) # Insert a temporary tag if temporary if temporary: output.put_tags(['temporary']) output.put_tags(["temporary"]) # Update capture list self.images.append(output) Loading Loading @@ -339,7 +334,7 @@ class BaseCamera(metaclass=ABCMeta): output = CaptureObject(filepath=filepath) # Insert a temporary tag if temporary if temporary: output.put_tags(['temporary']) output.put_tags(["temporary"]) # Update capture list self.videos.append(output) Loading openflexure_microscope/camera/capture.py +2 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ def pull_usercomment_dict(filepath): try: exif_dict = piexif.load(filepath) except InvalidImageDataError: logging.error("Invalid data at {}. Skipping.".format(filepath)) logging.warning("Invalid data at {}. Skipping.".format(filepath)) return None if "Exif" in exif_dict and 37510 in exif_dict["Exif"]: return yaml.load(exif_dict["Exif"][37510].decode()) Loading Loading
docs/source/plugins/example/plugin.py +1 −3 Original line number Diff line number Diff line Loading @@ -61,9 +61,7 @@ class MyPluginClass(MicroscopePlugin): for _ in range(n_images): # Create a data stream to capture to output = self.microscope.camera.new_image( temporary=False ) output = self.microscope.camera.new_image(temporary=False) # Capture a still image from the Pi camera, into the data stream self.microscope.camera.capture(output.file, use_video_port=True) Loading
openflexure_microscope/api/v1/blueprints/base.py +4 −5 Original line number Diff line number Diff line Loading @@ -39,10 +39,8 @@ class SnapshotAPI(MicroscopeView): # Restart stream worker thread self.microscope.camera.start_worker() return Response( self.microscope.camera.get_frame(), mimetype="image/jpeg", ) return Response(self.microscope.camera.get_frame(), mimetype="image/jpeg") class StateAPI(MicroscopeView): def get(self): Loading Loading @@ -240,7 +238,8 @@ def construct_blueprint(microscope_obj): ) blueprint.add_url_rule( "/snapshot", view_func=SnapshotAPI.as_view("snapshot", microscope=microscope_obj) "/snapshot", view_func=SnapshotAPI.as_view("snapshot", microscope=microscope_obj), ) blueprint.add_url_rule( Loading
openflexure_microscope/api/v1/blueprints/task.py +2 −6 Original line number Diff line number Diff line Loading @@ -134,12 +134,8 @@ def construct_blueprint(microscope_obj): blueprint = Blueprint("task_blueprint", __name__) blueprint.add_url_rule( "/", view_func=TaskListAPI.as_view("task_list") ) blueprint.add_url_rule("/", view_func=TaskListAPI.as_view("task_list")) blueprint.add_url_rule( "/<task_id>/", view_func=TaskAPI.as_view("task") ) blueprint.add_url_rule("/<task_id>/", view_func=TaskAPI.as_view("task")) return blueprint
openflexure_microscope/camera/base.py +4 −9 Original line number Diff line number Diff line Loading @@ -120,15 +120,10 @@ class BaseCamera(metaclass=ABCMeta): self.stream_timeout = 20 self.stream_timeout_enabled = False self.state = { "board": None } self.state = {"board": None} # TODO: Load/save these to config self.paths = { "default": BASE_CAPTURE_PATH, "temp": TEMP_CAPTURE_PATH } self.paths = {"default": BASE_CAPTURE_PATH, "temp": TEMP_CAPTURE_PATH} # Capture data self.images = [] Loading Loading @@ -296,7 +291,7 @@ class BaseCamera(metaclass=ABCMeta): output = CaptureObject(filepath=filepath) # Insert a temporary tag if temporary if temporary: output.put_tags(['temporary']) output.put_tags(["temporary"]) # Update capture list self.images.append(output) Loading Loading @@ -339,7 +334,7 @@ class BaseCamera(metaclass=ABCMeta): output = CaptureObject(filepath=filepath) # Insert a temporary tag if temporary if temporary: output.put_tags(['temporary']) output.put_tags(["temporary"]) # Update capture list self.videos.append(output) Loading
openflexure_microscope/camera/capture.py +2 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ def pull_usercomment_dict(filepath): try: exif_dict = piexif.load(filepath) except InvalidImageDataError: logging.error("Invalid data at {}. Skipping.".format(filepath)) logging.warning("Invalid data at {}. Skipping.".format(filepath)) return None if "Exif" in exif_dict and 37510 in exif_dict["Exif"]: return yaml.load(exif_dict["Exif"][37510].decode()) Loading