Formal Protocol for camera interface
I've now split the base camera code into a runtime-checkable Protocol and a concrete base class (which is optional). This removes the requirement for cameras to subclass `openflexure_microscope.things.camera.Camera` and instead uses duck typing that should work both statically and dynamically. As part of this, I've moved the commonly-used dependencies on the camera inside `openflexure_microscope.things.camera` for consistency, and to make it easy to update them if it changes in the future.
This commit is contained in:
parent
42b4c1246e
commit
adbb805556
7 changed files with 76 additions and 68 deletions
|
|
@ -19,14 +19,13 @@ from labthings_fastapi.dependencies.thing import direct_thing_client_dependency
|
|||
from labthings_fastapi.dependencies.blocking_portal import BlockingPortal
|
||||
from labthings_fastapi.decorators import thing_action
|
||||
from labthings_fastapi.types.numpy import NDArray
|
||||
from .camera import Camera as CameraThing
|
||||
from .camera import RawCameraDependency as Camera
|
||||
from .camera import CameraDependency as WrappedCamera
|
||||
from .stage import Stage as StageThing
|
||||
import numpy as np
|
||||
from pydantic import BaseModel
|
||||
|
||||
Stage = direct_thing_client_dependency(StageThing, "/stage/")
|
||||
Camera = raw_thing_dependency(CameraThing)
|
||||
WrappedCamera = direct_thing_client_dependency(CameraThing, "/camera/")
|
||||
|
||||
### Autofocus utilities
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue