Merge branch 'check-setting-validation' into 'v3'
Add limits to background detect and settling time settings Closes #421 See merge request openflexure/openflexure-microscope-server!518
This commit is contained in:
commit
e4c8f43c9c
4 changed files with 9 additions and 7 deletions
Binary file not shown.
|
|
@ -99,14 +99,14 @@ class ColourChannelDetectLUV(BackgroundDetectAlgorithm):
|
||||||
# provided there.
|
# provided there.
|
||||||
min_stds = [0.5, 0.3, 0.5]
|
min_stds = [0.5, 0.3, 0.5]
|
||||||
|
|
||||||
channel_tolerance: float = lt.setting(default=7.0)
|
channel_tolerance: float = lt.setting(default=7.0, ge=0)
|
||||||
"""Channel Tolerance
|
"""Channel Tolerance
|
||||||
|
|
||||||
The number of standard deviations a pixel value must be from the background mean
|
The number of standard deviations a pixel value must be from the background mean
|
||||||
to be considered sample.
|
to be considered sample.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
min_sample_coverage: float = lt.setting(default=25)
|
min_sample_coverage: float = lt.setting(default=25, ge=0, le=100)
|
||||||
"""Sample Coverage Required (%)
|
"""Sample Coverage Required (%)
|
||||||
|
|
||||||
The minimum percentage of the image that needs to be identified as sample for the
|
The minimum percentage of the image that needs to be identified as sample for the
|
||||||
|
|
@ -223,14 +223,14 @@ class ChannelDeviationLUV(BackgroundDetectAlgorithm):
|
||||||
# LUV colour space not converting to the CIELUV numbers)
|
# LUV colour space not converting to the CIELUV numbers)
|
||||||
min_stds = [0.5, 0.3, 0.5]
|
min_stds = [0.5, 0.3, 0.5]
|
||||||
|
|
||||||
channel_tolerance: float = lt.setting(default=7.0)
|
channel_tolerance: float = lt.setting(default=7.0, ge=0)
|
||||||
"""Channel Tolerance
|
"""Channel Tolerance
|
||||||
|
|
||||||
The number of standard deviations a pixel value must be from the background mean
|
The number of standard deviations a pixel value must be from the background mean
|
||||||
to be considered sample.
|
to be considered sample.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
min_sample_coverage: float = lt.setting(default=25)
|
min_sample_coverage: float = lt.setting(default=25, ge=0, le=100)
|
||||||
"""Sample Coverage Required (%)
|
"""Sample Coverage Required (%)
|
||||||
|
|
||||||
The minimum percentage of the image that needs to be identified as sample for the
|
The minimum percentage of the image that needs to be identified as sample for the
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ class BaseCamera(lt.Thing):
|
||||||
"CameraThings must define their own capture_array method"
|
"CameraThings must define their own capture_array method"
|
||||||
)
|
)
|
||||||
|
|
||||||
downsampled_array_factor: int = lt.property(default=2)
|
downsampled_array_factor: int = lt.property(default=2, ge=1)
|
||||||
"""The downsampling factor when calling capture_downsampled_array."""
|
"""The downsampling factor when calling capture_downsampled_array."""
|
||||||
|
|
||||||
@lt.action
|
@lt.action
|
||||||
|
|
@ -565,7 +565,7 @@ class BaseCamera(lt.Thing):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise IOError(f"An error occurred while saving {jpeg_path}") from e
|
raise IOError(f"An error occurred while saving {jpeg_path}") from e
|
||||||
|
|
||||||
settling_time: float = lt.setting(default=0.2)
|
settling_time: float = lt.setting(default=0.2, ge=0)
|
||||||
"""The settling time when calling the ``settle()`` method."""
|
"""The settling time when calling the ``settle()`` method."""
|
||||||
|
|
||||||
@lt.action
|
@lt.action
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,8 @@ class SimulatedCamera(BaseCamera):
|
||||||
|
|
||||||
@blob_density.setter
|
@blob_density.setter
|
||||||
def _set_blob_density(self, value: int) -> None:
|
def _set_blob_density(self, value: int) -> None:
|
||||||
|
if value < 0:
|
||||||
|
raise ValueError("Sample density must be >= 0")
|
||||||
self._blob_density = value
|
self._blob_density = value
|
||||||
if self._capture_enabled:
|
if self._capture_enabled:
|
||||||
self.generate_canvas()
|
self.generate_canvas()
|
||||||
|
|
@ -457,7 +459,7 @@ class SimulatedCamera(BaseCamera):
|
||||||
return self._capture_thread.is_alive()
|
return self._capture_thread.is_alive()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
noise_level: float = lt.property(default=2.0)
|
noise_level: float = lt.property(default=2.0, ge=0, le=50)
|
||||||
|
|
||||||
def _capture_frames(self) -> None:
|
def _capture_frames(self) -> None:
|
||||||
last_frame_t = time.time()
|
last_frame_t = time.time()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue