From 6a1ad573d9aeeede9597b678f225d66b793fb263 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Tue, 13 Jan 2026 17:29:51 +0000 Subject: [PATCH 1/8] Start turning background detectors back into things --- .../{ => things}/background_detect.py | 236 +++++------------- 1 file changed, 65 insertions(+), 171 deletions(-) rename src/openflexure_microscope_server/{ => things}/background_detect.py (57%) diff --git a/src/openflexure_microscope_server/background_detect.py b/src/openflexure_microscope_server/things/background_detect.py similarity index 57% rename from src/openflexure_microscope_server/background_detect.py rename to src/openflexure_microscope_server/things/background_detect.py index 37c08aa4..b96e13fd 100644 --- a/src/openflexure_microscope_server/background_detect.py +++ b/src/openflexure_microscope_server/things/background_detect.py @@ -5,13 +5,13 @@ for analysis. Information from these images is used to detect whether an image f current camera field of view contains sample. """ -from typing import Any, Generic, Optional, TypeVar +from typing import Optional, TypeVar import cv2 import numpy as np -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel -from labthings_fastapi.thing_description import type_to_dataschema +import labthings_fastapi as lt SettingsType = TypeVar("SettingsType", bound=BaseModel) BackgroundType = TypeVar("BackgroundType", bound=BaseModel) @@ -29,110 +29,16 @@ class ChannelBlankError(RuntimeError): """ -class BackgroundDetectorStatus(BaseModel): - """The status information about a background detector instance needed for the GUI. - - Each BackgroundDetectAlgorithm must be able to return one of these models when - ``status`` is called. - """ - - ready: bool - """True if ready to be used, if False this detector isn't initialised for use. - - This could be called ``has_background_data`` or similar, but the more generic - ``ready`` is used in case more complex methods are added in the future, which - need different initialisation. - """ - settings: dict[str, Any] - """The settings for the current background detect Algorithm. These are a dictionary - dumped from the base model.""" - - # Setting schema is a dict until LabThings FastAPI issue #154 is fixed and - # DataSchema can be used directly. For now `model_dump()` must be used to dump schema - # to a dict. - settings_schema: dict[str, Any] - """The schema for the settings for the current background detect Algorithm. - - This is reported so that the UI can dynamically create a UI for any background detector - algorithm. - """ - - -class BackgroundDetectAlgorithm(Generic[SettingsType, BackgroundType]): +class BackgroundDetectAlgorithm(lt.Thing): """The base class for defining background detect algorithms.""" - background_data_model: type[BackgroundType] - """The data model of the background data. This must be set by child classes""" - settings_data_model: type[SettingsType] - """The data model of algorithm settings. This must be set by child classes""" - - def __init__(self) -> None: - """Initialise the algorithm settings.""" - if not hasattr(self, "background_data_model") or not hasattr( - self, "settings_data_model" - ): - raise NotImplementedError( - "All BackgroundDetectAlgorithm subclesses must set their own settings " - "and background data models." - ) - self._settings: SettingsType = self.settings_data_model() - - @property - def status(self) -> BackgroundDetectorStatus: - """The status information needed for the GUI. Read only.""" - return BackgroundDetectorStatus( - ready=self.background_data is not None, - settings=self.settings.model_dump(), - # Dump model with `model_dump()` for reason explained when defining - # BackgroundDetectorStatus - settings_schema=type_to_dataschema(self.settings_data_model).model_dump(), + @lt.property + def ready(self) -> bool: + """Whether the background detector is ready.""" + raise NotImplementedError( + "Each background detect algorithm must implement a ready property." ) - # Requires a getter and a setter to support being a BaseModel but being - # saved to file as a dict - _background_data: Optional[BackgroundType] = None - - @property - def background_data(self) -> Optional[BackgroundType]: - """The statistics of the background image.""" - bd = self._background_data - if bd is None: - return None - return bd - - @background_data.setter - def background_data(self, value: Optional[BackgroundType | dict]) -> None: - """Set the statistics for the background image. - - This should be None, of no data is available. It can be set from either - a dictionary or a base model of the type specified in - ``self.background_data_model``. - """ - if value is None: - self._background_data = None - elif isinstance(value, self.background_data_model): - self._background_data = value - elif isinstance(value, dict): - self._background_data = self.background_data_model(**value) - else: - raise TypeError( - f"Cannot set background_data with an object of type {type(value)}" - ) - - @property - def settings(self) -> SettingsType: - """The statistics of the background image.""" - return self._settings - - @settings.setter - def settings(self, value: SettingsType | dict) -> None: - if isinstance(value, self.settings_data_model): - self._settings = value - elif isinstance(value, dict): - self._settings = self.settings_data_model(**value) - else: - raise TypeError(f"Cannot set settings with an object of type {type(value)}") - def image_is_sample(self, image: np.ndarray) -> tuple[bool, str]: """Label the current image as either background or sample. @@ -154,43 +60,7 @@ class BackgroundDetectAlgorithm(Generic[SettingsType, BackgroundType]): ) -class ChannelDistributions(BaseModel): - """A BaseModel for storing the channel distribution of a background image.""" - - means: list[float] - """The mean of each channel in the colourspace.""" - standard_deviations: list[float] - """The standard deviation of each channel in the colourspace.""" - - -class ColourChannelDetectSettings(BaseModel): - """A BaseModel for storing the settings for colour channel detectors.""" - - model_config = ConfigDict(extra="forbid") - - channel_tolerance: float = 7.0 - """Channel Tolerance - - The number of standard deviations a pixel value must be from the background mean - to be considered sample. - """ - - # Use Field to set Title reported to UI. By default Pydantic will convert the name - # from snake_case to Title Case. - min_sample_coverage: float = Field(25, title="Sample Coverage Required (%)") - """Sample Coverage Required (%) - - The minimum percentage of the image that needs to be identified as sample for the - image to be labeled as containing sample. - """ - - -class ColourChannelDetectLUV( - BackgroundDetectAlgorithm[ - ColourChannelDetectSettings, - ChannelDistributions, - ] -): +class ColourChannelDetectLUV(BackgroundDetectAlgorithm): """Compare images with a known background in LUV colourspace. This uses an LUV colour space checking only the mean and standard deviation of the @@ -198,13 +68,34 @@ class ColourChannelDetectLUV( intuitive way. """ - background_data_model: type[ChannelDistributions] = ChannelDistributions - settings_data_model: type[ColourChannelDetectSettings] = ColourChannelDetectSettings + background_means: Optional[list[float]] = lt.setting(default=None, readonly=True) + """The mean of each channel in the colourspace.""" + background_stds: Optional[list[float]] = lt.setting(default=None, readonly=True) + """The standard deviation of each channel in the colourspace.""" # These are the same as those used for ChannelDeviationLUV. More detail is # provided there. min_stds = [0.5, 0.3, 0.5] + channel_tolerance: float = lt.setting(default=7.0) + """Channel Tolerance + + The number of standard deviations a pixel value must be from the background mean + to be considered sample. + """ + + min_sample_coverage: float = lt.setting(default=25) + """Sample Coverage Required (%) + + The minimum percentage of the image that needs to be identified as sample for the + image to be labeled as containing sample. + """ + + @lt.property + def ready(self) -> bool: + """Whether the background detector is ready.""" + return not (self.background_means is None or self.background_stds is None) + def background_mask(self, image: np.ndarray) -> np.ndarray: """Calculate a binary image, showing whether each pixel is background. @@ -213,7 +104,7 @@ class ColourChannelDetectLUV( The image should be in LUV format, the output will be binary with the same shape in the first two dimensions. """ - if self.background_data is None: + if self.background_means is None or self.background_stds is None: raise RuntimeError( "Cannot calculated background mask if no background is set." ) @@ -222,13 +113,13 @@ class ColourChannelDetectLUV( # the height of the sample changes. # Wrapping in ``[[ ]]`` forces the colour channels to the numpy axis 2 # (3rd axis) so they are compared to the colour channel of each pixel. - means = np.array([[self.background_data.means[1:]]]) - stds = np.array([[self.background_data.standard_deviations[1:]]]) + means = np.array([[self.background_means[1:]]]) + stds = np.array([[self.background_stds[1:]]]) # Compare each image in the pixel with the mean and standard deviation along # axis to (the colour channels). return np.all( - np.abs(image[:, :, 1:] - means) < stds * self.settings.channel_tolerance, + np.abs(image[:, :, 1:] - means) < stds * self.channel_tolerance, axis=2, ) @@ -241,7 +132,7 @@ class ColourChannelDetectLUV( :returns: A value (between 0 and 100) is the percentage of the image that is sample. """ - if not self.background_data: + if self.background_means is None or self.background_stds is None: raise MissingBackgroundDataError( "Background is not set: you need to calibrate background detection." ) @@ -260,7 +151,7 @@ class ColourChannelDetectLUV( sample_coverage = self.get_sample_coverage(image) # Use bool otherwise get numpy variants of True and False. - is_sample = bool(sample_coverage > self.settings.min_sample_coverage) + is_sample = bool(sample_coverage > self.min_sample_coverage) message = f"{sample_coverage:0.1f}% sample" if not is_sample: message = "only " + message @@ -277,17 +168,11 @@ class ColourChannelDetectLUV( raise ChannelBlankError("Some LUV channels have no standard deviation.") std = np.maximum(std, self.min_stds) - self.background_data = ChannelDistributions( - means=mu.tolist(), standard_deviations=std.tolist() - ) + self.background_means = mu.tolist() + self.background_stds = std.tolist() -class ChannelDeviationLUV( - BackgroundDetectAlgorithm[ - ColourChannelDetectSettings, - ChannelDistributions, - ] -): +class ChannelDeviationLUV(BackgroundDetectAlgorithm): """Compare the standard deviations of the LUV channels in a grid to background data. Using an LUV colour space, each image is divided into an 8x8 grid of images. @@ -295,10 +180,8 @@ class ChannelDeviationLUV( to the median standard deviation for a grid of background images. """ - # Note we don't use the means in this algorithm but we use the same channel - # distributions model - background_data_model: type[ChannelDistributions] = ChannelDistributions - settings_data_model: type[ColourChannelDetectSettings] = ColourChannelDetectSettings + background_stds: Optional[list[float]] = lt.setting(default=None, readonly=True) + """The standard deviation of each channel in the colourspace.""" # Empirically, 0.5 seems to be approximate the standard deviation for a good image # in L and V. U appears to be about 60% of this value. U is about 65% of V when @@ -306,6 +189,20 @@ class ChannelDeviationLUV( # LUV colour space not converting to the CIELUV numbers) min_stds = [0.5, 0.3, 0.5] + channel_tolerance: float = lt.setting(default=7.0) + """Channel Tolerance + + The number of standard deviations a pixel value must be from the background mean + to be considered sample. + """ + + min_sample_coverage: float = lt.setting(default=25) + """Sample Coverage Required (%) + + The minimum percentage of the image that needs to be identified as sample for the + image to be labeled as containing sample. + """ + def get_sample_coverage(self, image: np.ndarray) -> float: """Return the percentage of the input image that is background. @@ -316,17 +213,17 @@ class ChannelDeviationLUV( :returns: A value (between 0 and 100) that is the percentage of the image that is sample. """ - if not self.background_data: + if self.background_stds is None: raise MissingBackgroundDataError( "Background is not set: you need to calibrate background detection." ) image_luv = cv2.cvtColor(image, cv2.COLOR_RGB2LUV) stds = _chunked_stds(image_luv, 8, 8) - bg_stds = self.background_data.standard_deviations - l_cut = bg_stds[0] * self.settings.channel_tolerance - u_cut = bg_stds[1] * self.settings.channel_tolerance - v_cut = bg_stds[2] * self.settings.channel_tolerance + bg_stds = self.background_stds + l_cut = bg_stds[0] * self.channel_tolerance + u_cut = bg_stds[1] * self.channel_tolerance + v_cut = bg_stds[2] * self.channel_tolerance populated_regions = ( (stds[:, :, 0] > l_cut) | (stds[:, :, 1] > u_cut) | (stds[:, :, 2] > v_cut) @@ -344,7 +241,7 @@ class ChannelDeviationLUV( sample_coverage = self.get_sample_coverage(image) # Use bool otherwise get numpy variants of True and False. - is_sample = bool(sample_coverage > self.settings.min_sample_coverage) + is_sample = bool(sample_coverage > self.min_sample_coverage) message = f"{sample_coverage:0.1f}% sample" if not is_sample: message = "only " + message @@ -353,7 +250,6 @@ class ChannelDeviationLUV( def set_background(self, image: np.ndarray) -> None: """Use the input image to update the background distributions.""" image_luv = cv2.cvtColor(image, cv2.COLOR_RGB2LUV) - mu = np.zeros(3) c_stds = _chunked_stds(image_luv, 8, 8) channel_blank = np.all(c_stds == 0, axis=(0, 1)) if np.any(channel_blank): @@ -361,9 +257,7 @@ class ChannelDeviationLUV( std = np.median(c_stds, axis=(0, 1)) std = np.maximum(std, self.min_stds) - self.background_data = ChannelDistributions( - means=mu.tolist(), standard_deviations=std.tolist() - ) + self.background_stds = std.tolist() def _chunked_stds(img: np.ndarray, n_rows: int = 8, n_cols: int = 8) -> np.ndarray: From 44860bf777fd9db11aa68683b107d6ea4481e715 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Tue, 13 Jan 2026 18:01:45 +0000 Subject: [PATCH 2/8] Continue turning background detectors back into Things --- ofm_config_full.json | 4 +- ofm_config_simulation.json | 4 +- .../things/camera/__init__.py | 69 ++----------------- 3 files changed, 10 insertions(+), 67 deletions(-) diff --git a/ofm_config_full.json b/ofm_config_full.json index 5b4d5f0f..6d4686ec 100644 --- a/ofm_config_full.json +++ b/ofm_config_full.json @@ -16,7 +16,9 @@ "scans_folder": "/var/openflexure/scans/" } }, - "stage_measure":"openflexure_microscope_server.things.stage_measure:RangeofMotionThing" + "stage_measure": "openflexure_microscope_server.things.stage_measure:RangeofMotionThing", + "bg_color_channels_luv": "openflexure_microscope_server.things.background_detect:ColourChannelDetectLUV", + "bg_channel_deviations_luv": "openflexure_microscope_server.things.background_detect:ChannelDeviationLUV" }, "settings_folder": "/var/openflexure/settings/", "log_folder": "/var/openflexure/logs/" diff --git a/ofm_config_simulation.json b/ofm_config_simulation.json index a28e71c9..ef886fb4 100644 --- a/ofm_config_simulation.json +++ b/ofm_config_simulation.json @@ -10,7 +10,9 @@ "kwargs": { "scans_folder": "./openflexure/scans/" } - } + }, + "bg_color_channels_luv": "openflexure_microscope_server.things.background_detect:ColourChannelDetectLUV", + "bg_channel_deviations_luv": "openflexure_microscope_server.things.background_detect:ChannelDeviationLUV" }, "settings_folder": "./openflexure/settings/", "log_folder": "./openflexure/logs/" diff --git a/src/openflexure_microscope_server/things/camera/__init__.py b/src/openflexure_microscope_server/things/camera/__init__.py index 43869872..32d4b1b8 100644 --- a/src/openflexure_microscope_server/things/camera/__init__.py +++ b/src/openflexure_microscope_server/things/camera/__init__.py @@ -24,11 +24,8 @@ from PIL import Image import labthings_fastapi as lt from labthings_fastapi.types.numpy import NDArray -from openflexure_microscope_server.background_detect import ( +from openflexure_microscope_server.things.background_detect import ( BackgroundDetectAlgorithm, - BackgroundDetectorStatus, - ChannelDeviationLUV, - ColourChannelDetectLUV, ) from openflexure_microscope_server.ui import ActionButton, PropertyControl @@ -161,6 +158,8 @@ class BaseCamera(lt.Thing): ``__init__`` method of the subclass. """ + background_detectors: Mapping[str, BackgroundDetectAlgorithm] = lt.thing_slot() + mjpeg_stream = lt.outputs.MJPEGStreamDescriptor() lores_mjpeg_stream = lt.outputs.MJPEGStreamDescriptor() _memory_buffer = CameraMemoryBuffer() @@ -174,11 +173,7 @@ class BaseCamera(lt.Thing): dictionary in this function. Configuration will be added at a later date. """ super().__init__(thing_server_interface) - self.background_detectors = { - "Colour Channels (LUV)": ColourChannelDetectLUV(), - "Channel Deviations (LUV)": ChannelDeviationLUV(), - } - self._detector_name = "Channel Deviations (LUV)" + self._detector_name = "bg_channel_deviations_luv" def __enter__(self) -> Self: """Open hardware connection when the Thing context manager is opened.""" @@ -598,60 +593,6 @@ class BaseCamera(lt.Thing): """The active background detector instance.""" return self.background_detectors[self.detector_name] - @lt.property - def background_detector_status(self) -> BackgroundDetectorStatus: - """The status of the active detector for the UI.""" - return self.active_detector.status - - @lt.action - def update_detector_settings(self, data: dict[str, Any]) -> None: - """Update the settings of the current detector. - - This is an action not a setting/property as the data model depends on the - selected detector. As such, it cannot be specified with the necessary precision - to be included in a ThingDescription as a setting/property, while retaining - enough useful information to communicate to the UI how it is set and read. - - The information on how to read the settings is exposed in - ``background_detector_status``. - """ - self.active_detector.settings = data - # Manually save settings as the setter is not called. - self.save_settings() - - @lt.setting - def background_detector_data(self) -> dict: - """The data for each background detector, used to save to disk.""" - data = {} - for name, obj in self.background_detectors.items(): - bg_data = ( - None - if obj.background_data is None - else obj.background_data.model_dump() - ) - data[name] = { - "settings": obj.settings.model_dump(), - "background_data": bg_data, - } - return data - - @background_detector_data.setter - def _set_background_detector_data(self, data: dict) -> None: - """Set the data for each detector. Only to be used as settings are loaded from disk. - - Do not call over HTTP. This needs to be updated once LbaThings Settings can be - read-only over HTTP (#484). - """ - for name, instance_data in data.items(): - if name in self.background_detectors: - obj = self.background_detectors[name] - obj.settings = instance_data["settings"] - obj.background_data = instance_data["background_data"] - else: - self.logger.warning( - f"No background detector named {name}, settings will be discarded." - ) - @lt.action def image_is_sample(self) -> tuple[bool, str]: """Label the current image as either background or sample.""" @@ -670,8 +611,6 @@ class BaseCamera(lt.Thing): """ background = self.grab_as_array(stream_name="lores") self.active_detector.set_background(background) - # Manually save settings as the setter is not called. - self.save_settings() @property def thing_state(self) -> Mapping[str, Any]: From 3e8874188e577a26b30e558b92d55b056a339877 Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Tue, 13 Jan 2026 19:05:24 +0000 Subject: [PATCH 3/8] Get UI working for background detector things --- .../things/background_detect.py | 42 +++++++++++++- .../things/camera/__init__.py | 7 +++ .../things/camera/simulation.py | 2 +- .../things/smart_scan.py | 2 +- .../paneBackgroundDetect.vue | 55 +++++++------------ 5 files changed, 70 insertions(+), 38 deletions(-) diff --git a/src/openflexure_microscope_server/things/background_detect.py b/src/openflexure_microscope_server/things/background_detect.py index b96e13fd..ad113db4 100644 --- a/src/openflexure_microscope_server/things/background_detect.py +++ b/src/openflexure_microscope_server/things/background_detect.py @@ -13,6 +13,8 @@ from pydantic import BaseModel import labthings_fastapi as lt +from openflexure_microscope_server.ui import PropertyControl, property_control_for + SettingsType = TypeVar("SettingsType", bound=BaseModel) BackgroundType = TypeVar("BackgroundType", bound=BaseModel) @@ -32,6 +34,8 @@ class ChannelBlankError(RuntimeError): class BackgroundDetectAlgorithm(lt.Thing): """The base class for defining background detect algorithms.""" + display_name: str = lt.property(default="Base Detector", readonly=True) + @lt.property def ready(self) -> bool: """Whether the background detector is ready.""" @@ -59,6 +63,13 @@ class BackgroundDetectAlgorithm(lt.Thing): "Each background detect algorithm must implement an set_background method." ) + @lt.property + def settings_ui(self) -> list[PropertyControl]: + """A list of PropertyControl objects to create the settings in the UI.""" + raise NotImplementedError( + "Each background detect algorithm must implement an settings_ui method." + ) + class ColourChannelDetectLUV(BackgroundDetectAlgorithm): """Compare images with a known background in LUV colourspace. @@ -68,6 +79,8 @@ class ColourChannelDetectLUV(BackgroundDetectAlgorithm): intuitive way. """ + display_name: str = lt.property(default="Colour Channel (LUV)", readonly=True) + background_means: Optional[list[float]] = lt.setting(default=None, readonly=True) """The mean of each channel in the colourspace.""" background_stds: Optional[list[float]] = lt.setting(default=None, readonly=True) @@ -91,10 +104,20 @@ class ColourChannelDetectLUV(BackgroundDetectAlgorithm): image to be labeled as containing sample. """ + @lt.property + def settings_ui(self) -> list[PropertyControl]: + """A list of PropertyControl objects to create the settings in the UI.""" + return [ + property_control_for(self, "channel_tolerance", label="Channel Tolerance"), + property_control_for( + self, "min_sample_coverage", label="Sample Coverage Required (%)" + ), + ] + @lt.property def ready(self) -> bool: """Whether the background detector is ready.""" - return not (self.background_means is None or self.background_stds is None) + return self.background_means is not None and self.background_stds is not None def background_mask(self, image: np.ndarray) -> np.ndarray: """Calculate a binary image, showing whether each pixel is background. @@ -180,6 +203,8 @@ class ChannelDeviationLUV(BackgroundDetectAlgorithm): to the median standard deviation for a grid of background images. """ + display_name: str = lt.property(default="Channel Deviation (LUV)", readonly=True) + background_stds: Optional[list[float]] = lt.setting(default=None, readonly=True) """The standard deviation of each channel in the colourspace.""" @@ -203,6 +228,21 @@ class ChannelDeviationLUV(BackgroundDetectAlgorithm): image to be labeled as containing sample. """ + @lt.property + def settings_ui(self) -> list[PropertyControl]: + """A list of PropertyControl objects to create the settings in the UI.""" + return [ + property_control_for(self, "channel_tolerance", label="Channel Tolerance"), + property_control_for( + self, "min_sample_coverage", label="Sample Coverage Required (%)" + ), + ] + + @lt.property + def ready(self) -> bool: + """Whether the background detector is ready.""" + return self.background_stds is not None + def get_sample_coverage(self, image: np.ndarray) -> float: """Return the percentage of the input image that is background. diff --git a/src/openflexure_microscope_server/things/camera/__init__.py b/src/openflexure_microscope_server/things/camera/__init__.py index 32d4b1b8..238a7078 100644 --- a/src/openflexure_microscope_server/things/camera/__init__.py +++ b/src/openflexure_microscope_server/things/camera/__init__.py @@ -173,6 +173,10 @@ class BaseCamera(lt.Thing): dictionary in this function. Configuration will be added at a later date. """ super().__init__(thing_server_interface) + # Default is never updated but is used if the value set from settings is + # incorrect. In the future a better way to set defaults for thing slot mappings + # would be ideal. + self._default_detector = "bg_channel_deviations_luv" self._detector_name = "bg_channel_deviations_luv" def __enter__(self) -> Self: @@ -591,6 +595,9 @@ class BaseCamera(lt.Thing): @property def active_detector(self) -> BackgroundDetectAlgorithm: """The active background detector instance.""" + if self.detector_name not in self.background_detectors: + self.logger.warning(f"No detector named {self.detector_name}") + self.detector_name = self._default_detector return self.background_detectors[self.detector_name] @lt.action diff --git a/src/openflexure_microscope_server/things/camera/simulation.py b/src/openflexure_microscope_server/things/camera/simulation.py index 9678b18c..42058aa4 100644 --- a/src/openflexure_microscope_server/things/camera/simulation.py +++ b/src/openflexure_microscope_server/things/camera/simulation.py @@ -181,7 +181,7 @@ class SimulatedCamera(BaseCamera): @lt.property def calibration_required(self) -> bool: """Whether the camera needs calibrating.""" - return not self.background_detector_status.ready + return not self.active_detector.ready def generate_sprites(self) -> None: """Generate sprites to populate the image.""" diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 47298a82..5add6866 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -234,7 +234,7 @@ class SmartScanThing(lt.Thing): self._csm.assert_calibration() if self.skip_background: - if not self._cam.background_detector_status.ready: + if not self._cam.active_detector.ready: raise RuntimeError( "Background is not set: you need to calibrate background detection." ) diff --git a/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue b/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue index 9de2ec45..4b91f504 100644 --- a/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue +++ b/webapp/src/components/tabContentComponents/backgroundDetectComponents/paneBackgroundDetect.vue @@ -5,18 +5,13 @@
  • Configure
    -

    - {{ backgroundDetectorName }} +

    + {{ backgroundDetectorDisplayName }}

    -
  • @@ -51,33 +46,26 @@