Change all CameraDeps to CameraClients

This commit is contained in:
Joe Knapper 2025-08-15 10:16:36 +00:00
parent 473a09442a
commit bd115e0023
3 changed files with 13 additions and 13 deletions

View file

@ -20,8 +20,8 @@ from pydantic import BaseModel
import labthings_fastapi as lt import labthings_fastapi as lt
from labthings_fastapi.types.numpy import NDArray from labthings_fastapi.types.numpy import NDArray
from .camera import RawCameraDependency as Camera from .camera import RawCameraDependency as RawCamera
from .camera import CameraDependency as WrappedCamera from .camera import CameraDependency as CameraClient
from .stage import StageDependency as Stage from .stage import StageDependency as Stage
@ -210,7 +210,7 @@ class JPEGSharpnessMonitor:
SharpnessMonitorDep as an argument is called. SharpnessMonitorDep as an argument is called.
""" """
def __init__(self, stage: Stage, camera: Camera, portal: lt.deps.BlockingPortal): def __init__(self, stage: Stage, camera: RawCamera, portal: lt.deps.BlockingPortal):
"""Initialise a new JPEGSharpnessMonitor. The args are injected automatically. """Initialise a new JPEGSharpnessMonitor. The args are injected automatically.
:param stage: A direct_thing_client dependency for the the microscope stage. :param stage: A direct_thing_client dependency for the the microscope stage.
@ -470,7 +470,7 @@ class AutofocusThing(lt.Thing):
@lt.thing_action @lt.thing_action
def run_smart_stack( def run_smart_stack(
self, self,
cam: WrappedCamera, cam: CameraClient,
stage: Stage, stage: Stage,
sharpness_monitor: SharpnessMonitorDep, sharpness_monitor: SharpnessMonitorDep,
images_dir: str, images_dir: str,
@ -574,7 +574,7 @@ class AutofocusThing(lt.Thing):
sharpest_id: int, sharpest_id: int,
captures: list[list], captures: list[list],
stack_parameters: StackParams, stack_parameters: StackParams,
cam: WrappedCamera, cam: CameraClient,
) -> int: ) -> int:
"""Save the required captures to disk. """Save the required captures to disk.
@ -604,7 +604,7 @@ class AutofocusThing(lt.Thing):
def z_stack( def z_stack(
self, self,
stack_parameters: StackParams, stack_parameters: StackParams,
cam: WrappedCamera, cam: CameraClient,
stage: Stage, stage: Stage,
) -> tuple[bool, list[CaptureInfo], Optional[int]]: ) -> tuple[bool, list[CaptureInfo], Optional[int]]:
"""Capture a series of images checking that sharpest image central. """Capture a series of images checking that sharpest image central.
@ -669,7 +669,7 @@ class AutofocusThing(lt.Thing):
def capture_stack_image( def capture_stack_image(
self, self,
cam: WrappedCamera, cam: CameraClient,
stage: Stage, stage: Stage,
buffer_max: int, buffer_max: int,
) -> CaptureInfo: ) -> CaptureInfo:

View file

@ -32,7 +32,7 @@ import labthings_fastapi as lt
from labthings_fastapi.types.numpy import DenumpifyingDict from labthings_fastapi.types.numpy import DenumpifyingDict
from camera_stage_mapping.camera_stage_tracker import Tracker from camera_stage_mapping.camera_stage_tracker import Tracker
from .camera import CameraDependency as Camera from .camera import CameraDependency as CameraClient
from .stage import StageDependency as Stage from .stage import StageDependency as Stage
CoordinateType = Tuple[float, float, float] CoordinateType = Tuple[float, float, float]
@ -120,7 +120,7 @@ class CameraStageMapper(lt.Thing):
@lt.thing_action @lt.thing_action
def calibrate_1d( def calibrate_1d(
self, self,
camera: Camera, camera: CameraClient,
stage: Stage, stage: Stage,
logger: lt.deps.InvocationLogger, logger: lt.deps.InvocationLogger,
direction: Tuple[float, float, float], direction: Tuple[float, float, float],
@ -155,7 +155,7 @@ class CameraStageMapper(lt.Thing):
@lt.thing_action @lt.thing_action
def calibrate_xy( def calibrate_xy(
self, camera: Camera, stage: Stage, logger: lt.deps.InvocationLogger self, camera: CameraClient, stage: Stage, logger: lt.deps.InvocationLogger
) -> DenumpifyingDict: ) -> DenumpifyingDict:
"""Move the microscope's stage in X and Y, to calibrate its relationship to the camera. """Move the microscope's stage in X and Y, to calibrate its relationship to the camera.

View file

@ -28,7 +28,7 @@ from openflexure_microscope_server import stitching
# Things # Things
from .autofocus import AutofocusThing from .autofocus import AutofocusThing
from .camera_stage_mapping import CameraStageMapper from .camera_stage_mapping import CameraStageMapper
from .camera import CameraDependency as CamDep from .camera import CameraDependency as CameraClient
from .stage import StageDependency as StageDep from .stage import StageDependency as StageDep
CSMDep = lt.deps.direct_thing_client_dependency( CSMDep = lt.deps.direct_thing_client_dependency(
@ -95,7 +95,7 @@ class SmartScanThing(lt.Thing):
self._cancel: Optional[lt.deps.CancelHook] = None self._cancel: Optional[lt.deps.CancelHook] = None
self._autofocus: Optional[AutofocusDep] = None self._autofocus: Optional[AutofocusDep] = None
self._stage: Optional[StageDep] = None self._stage: Optional[StageDep] = None
self._cam: Optional[CamDep] = None self._cam: Optional[CameraClient] = None
self._csm: Optional[CSMDep] = None self._csm: Optional[CSMDep] = None
self._ongoing_scan: Optional[scan_directories.ScanDirectory] = None self._ongoing_scan: Optional[scan_directories.ScanDirectory] = None
@ -109,7 +109,7 @@ class SmartScanThing(lt.Thing):
logger: lt.deps.InvocationLogger, logger: lt.deps.InvocationLogger,
autofocus: AutofocusDep, autofocus: AutofocusDep,
stage: StageDep, stage: StageDep,
cam: CamDep, cam: CameraClient,
csm: CSMDep, csm: CSMDep,
scan_name: str = "", scan_name: str = "",
): ):