Coverage for /opt/conda/envs/apienv/lib/python3.11/site-packages/daiquiri/implementors/imageviewer/upload_canvas.py: 0%
14 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-03-29 02:12 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-03-29 02:12 +0000
1import logging
2import base64
4from bliss import current_session
5from daiquiri.core.components import ComponentActor
7logger = logging.getLogger(__name__)
10class Upload_CanvasActor(ComponentActor):
11 name = "upload_canvas"
13 def method(self, *, image, sample):
14 """This actor will allow external processing of the current canvas
15 view in the client
17 Kwargs:
18 sample(dict): The current sample dictionary
19 image(str): Base64 encoded image
21 """
22 logger.info(f"Saving canvas for {sample['name']}")
24 blob = image[image.find("base64") + 7 :]
25 blob = base64.b64decode(blob)
27 elogbook = current_session.scan_saving.elogbook
28 elogbook.send_binary_data(blob, mimetype="image/png")
29 elogbook.send_message(
30 f"Saved current acquisition image for sample {sample['name']}"
31 )