Merge branch 'bg_detect_in_camera' into 'v3'

Refactor background detect to allow switching algorithms

See merge request openflexure/openflexure-microscope-server!327
This commit is contained in:
Julian Stirling 2025-07-28 09:21:43 +00:00
commit 547704fdc0
14 changed files with 587 additions and 261 deletions

View file

@ -1,44 +1,17 @@
<template>
<div class="uk-padding-small">
<div v-show="!backendOK" class="uk-alert-danger">
The background detect Thing seems to be missing or incompatible.
</div>
<div v-show="backendOK">
<div>
<ul uk-accordion="multiple: true">
<li>
<a class="uk-accordion-title" href="#">Settings</a>
<div class="uk-accordion-content">
<div class="uk-margin">
<propertyControl
thing-name="background_detect"
property-name="tolerance"
label="Tolerance"
/>
</div>
<div class="uk-margin">
<propertyControl
thing-name="background_detect"
property-name="fraction"
label="Sample Coverage Required (%)"
/>
</div>
<div class="uk-margin">
<action-button
thing="background_detect"
action="background_fraction"
submit-label="Check Coverage"
:can-terminate="false"
:poll-interval="0.1"
@response="alertBackgroundFraction"
@error="backgroundDetectError"
/>
</div>
<p> TODO!</p>
</div>
</li>
</ul>
<div class="uk-margin">
<action-button
thing="background_detect"
thing="camera"
action="set_background"
submit-label="Set Background"
:can-terminate="false"
@ -47,8 +20,9 @@
/>
</div>
<div class="uk-margin">
<!--Once status is read this should be disabled id not ready..-->
<action-button
thing="background_detect"
thing="camera"
action="image_is_sample"
submit-label="Check Current Image"
:can-terminate="false"
@ -63,32 +37,19 @@
<script>
import ActionButton from "../../labThingsComponents/actionButton.vue";
import propertyControl from "../../labThingsComponents/propertyControl.vue";
export default {
components: {
ActionButton,
propertyControl
},
computed: {
backendOK() {
return this.thingAvailable("background_detect");
}
ActionButton
},
methods: {
alertBackgroundFraction(r) {
let fraction = r.output;
// let percentage = (fraction * 100).toFixed(0);
this.modalNotify(`Current image is ${fraction.toFixed(0)}% background.`);
},
alertBackgroundSet() {
this.modalNotify(`Background image has been updated`);
},
alertImageLabel(r) {
let label = r.output === true ? "sample" : "background";
this.modalNotify(`Current image is ${label}`);
let label = r.output[0] ? "sample" : "background";
this.modalNotify(`Current image is ${label} (${r.output[1]})`);
},
backgroundDetectError() {
this.modalError(