Add camera calibration steps into refactored calibration wizard.
This commit is contained in:
parent
8f1253ec02
commit
0ebc507eff
10 changed files with 186 additions and 32 deletions
|
|
@ -86,6 +86,11 @@ class SimulatedCamera(BaseCamera):
|
|||
self.generate_blobs()
|
||||
self.generate_canvas()
|
||||
|
||||
@lt.thing_property
|
||||
def calibration_required(self) -> bool:
|
||||
"""Whether the camera needs calibrating."""
|
||||
return not self.background_detector_status.ready
|
||||
|
||||
def validate_inputs(self) -> None:
|
||||
"""Validate the inputs passed to the simulation, and raises an error if invalid.
|
||||
|
||||
|
|
@ -367,6 +372,22 @@ class SimulatedCamera(BaseCamera):
|
|||
LOGGER.warning(f"Simulation camera camera doesn't respect {stream_name=}")
|
||||
return Image.fromarray(self.generate_frame())
|
||||
|
||||
@lt.thing_action
|
||||
def full_auto_calibrate(self, portal: lt.deps.BlockingPortal) -> None:
|
||||
"""Perform a full auto-calibration.
|
||||
|
||||
For the simulation microscope the process is:
|
||||
|
||||
* ``remove_sample``
|
||||
* ``set_background``
|
||||
* ``load_sample``
|
||||
"""
|
||||
self.remove_sample()
|
||||
time.sleep(0.2)
|
||||
self.set_background(portal)
|
||||
time.sleep(0.2)
|
||||
self.load_sample()
|
||||
|
||||
@lt.thing_action
|
||||
def remove_sample(self) -> None:
|
||||
"""Show the simulated background with no sample."""
|
||||
|
|
@ -381,6 +402,15 @@ class SimulatedCamera(BaseCamera):
|
|||
raise RuntimeError("Sample is already in place.")
|
||||
self._show_sample = True
|
||||
|
||||
@lt.thing_property
|
||||
def primary_calibration_actions(self) -> list[ActionButton]:
|
||||
"""The calibration actions for both calibration wizard and settings panel."""
|
||||
return [
|
||||
action_button_for(
|
||||
self.full_auto_calibrate, submit_label="Full Auto Calibrate"
|
||||
),
|
||||
]
|
||||
|
||||
@lt.thing_property
|
||||
def secondary_calibration_actions(self) -> list[ActionButton]:
|
||||
"""The calibration actions that appear only in settings panel."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue