Move CaptureParams into camera from autofocus

This commit is contained in:
Joe Knapper 2026-02-19 12:19:31 +00:00 committed by Julian Stirling
parent 67e43c90df
commit 37e3450670
3 changed files with 10 additions and 10 deletions

View file

@ -20,7 +20,7 @@ from pydantic import BaseModel, computed_field, field_validator, model_validator
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 BaseCamera from .camera import BaseCamera, CaptureParams
from .stage import BaseStage from .stage import BaseStage
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
@ -40,13 +40,6 @@ class AutofocusParams(BaseModel):
sharpness_method: str = "jpeg" sharpness_method: str = "jpeg"
class CaptureParams(BaseModel):
"""A class for capturing at least a single image."""
images_dir: str
save_resolution: tuple[int, int]
class StackParams(BaseModel): class StackParams(BaseModel):
"""A class for holding stack parameters, and returning computed ones.""" """A class for holding stack parameters, and returning computed ones."""

View file

@ -20,6 +20,7 @@ from typing import Any, Literal, Mapping, Optional, Self, Tuple
import numpy as np import numpy as np
import piexif import piexif
from PIL import Image from PIL import Image
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
@ -47,6 +48,13 @@ class CaptureError(RuntimeError):
"""An error trying to capture from a CameraThing.""" """An error trying to capture from a CameraThing."""
class CaptureParams(BaseModel):
"""A class for capturing at least a single image."""
images_dir: str
save_resolution: tuple[int, int]
class NoImageInMemoryError(RuntimeError): class NoImageInMemoryError(RuntimeError):
"""An error called if no image is in memory when accessed.""" """An error called if no image is in memory when accessed."""

View file

@ -33,13 +33,12 @@ from openflexure_microscope_server.things.autofocus import (
MIN_TEST_IMAGE_COUNT, MIN_TEST_IMAGE_COUNT,
AutofocusParams, AutofocusParams,
AutofocusThing, AutofocusThing,
CaptureParams,
SmartStackParams, SmartStackParams,
) )
from openflexure_microscope_server.things.background_detect import ( from openflexure_microscope_server.things.background_detect import (
ChannelDeviationLUV, ChannelDeviationLUV,
) )
from openflexure_microscope_server.things.camera import BaseCamera from openflexure_microscope_server.things.camera import BaseCamera, CaptureParams
from openflexure_microscope_server.things.camera_stage_mapping import CameraStageMapper from openflexure_microscope_server.things.camera_stage_mapping import CameraStageMapper
from openflexure_microscope_server.things.stage import BaseStage from openflexure_microscope_server.things.stage import BaseStage
from openflexure_microscope_server.ui import PropertyControl, property_control_for from openflexure_microscope_server.ui import PropertyControl, property_control_for