Merge branch 'smart-stack-controls' into 'master'

Added controls for smart stack

See merge request openflexure/openflexure-microscope-server!134
This commit is contained in:
Kaspar Emanuel 2021-08-17 09:43:32 +00:00
commit 6d25dcfa9e
2 changed files with 116 additions and 34 deletions

View file

@ -2971,12 +2971,6 @@
"unique-filename": "^1.1.1"
}
},
"caniuse-lite": {
"version": "1.0.30001165",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001165.tgz",
"integrity": "sha512-8cEsSMwXfx7lWSUMA2s08z9dIgsnR5NAqjXP23stdsU3AUWkCr/rr4s4OFtHXn5XXr6+7kam3QFVoYyXNPdJPA==",
"dev": true
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@ -3902,12 +3896,6 @@
"node-releases": "^1.1.67"
}
},
"caniuse-lite": {
"version": "1.0.30001165",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001165.tgz",
"integrity": "sha512-8cEsSMwXfx7lWSUMA2s08z9dIgsnR5NAqjXP23stdsU3AUWkCr/rr4s4OFtHXn5XXr6+7kam3QFVoYyXNPdJPA==",
"dev": true
},
"electron-to-chromium": {
"version": "1.3.615",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.615.tgz",
@ -4724,9 +4712,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30001020",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001020.tgz",
"integrity": "sha512-yWIvwA68wRHKanAVS1GjN8vajAv7MBFshullKCeq/eKpK7pJBVDgFFEqvgWTkcP2+wIDeQGYFRXECjKZnLkUjA==",
"version": "1.0.30001249",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001249.tgz",
"integrity": "sha512-vcX4U8lwVXPdqzPWi6cAJ3FnQaqXbBqy/GZseKNQzRj37J7qZdGcBtxq/QLFNLLlfsoXLUdHw8Iwenri86Tagw==",
"dev": true
},
"case-sensitive-paths-webpack-plugin": {

View file

@ -244,10 +244,70 @@
</div>
</div>
</li>
<!--Show stack and scan if scan plugin is enabled-->
<li v-if="scanUri" :class="{ 'uk-open': smartStack && scanCapture }">
<a class="uk-accordion-title" href="#">Smart Stack</a>
<div
class="uk-accordion-content"
:class="{ 'uk-disabled': !scanCapture }"
>
<div class="uk-margin">
<label
><input
v-model="smartStack"
class="uk-checkbox"
type="checkbox"
/>
Enable smart stacking</label
>
</div>
<p>
Smart stacking is an experimental closed-loop Z stack, that checks
the Z stack is centred on the focus. It requires Z stacking to be
enabled above (we recommend 9 images in Z) and you must select
"fast" autofocus.
</p>
<div :class="{ 'uk-disabled': !smartStack }">
<div class="uk-margin-small uk-margin-remove-bottom">
<label class="uk-form-label" for="form-stacked-text"
>Autofocus range (steps)</label
>
<input
v-model="smartStackAutofocusDz"
class="uk-input uk-form-small"
type="number"
min="1000"
/>
</div>
<div class="uk-margin-small uk-margin-remove-bottom">
<label class="uk-form-label" for="form-stacked-text"
>Alignment range (steps)</label
>
<input
v-model="smartStackAlignDist"
class="uk-input uk-form-small"
type="number"
min="100"
/>
</div>
</div>
</div>
</li>
</ul>
<div v-if="scanCapture" class="uk-margin uk-margin-remove-top">
<taskSubmitter
v-if="smartStack"
:submit-url="smartScanUri"
:submit-data="smartScanPayload"
:submit-label="'Start Smart Scan'"
:button-primary="true"
@response="onScanResponse"
@error="modalError"
>
</taskSubmitter>
<taskSubmitter
v-if="!smartStack"
:submit-url="scanUri"
:submit-data="scanPayload"
:submit-label="'Start Scan'"
@ -305,7 +365,14 @@ function defaultCaptureSettings() {
annotations: {
Client: "openflexure-microscope-jsclient:builtin"
},
scanUri: null
smartStack: false,
smartStackThreshold: 0.9,
smartStackPeakWidth: 200,
smartStackAlignDist: 900,
smartStackBacklash: 100,
smartStackFitStyle: "chevy",
smartStackMAndMIndex: 10,
smartStackAutofocusDz: 3000
};
}
@ -322,7 +389,9 @@ export default {
data: function() {
return {
...defaultCaptureSettings(),
scanCapture: false // Don't remember the "scan" tickbox in local storage.
scanCapture: false, // Don't remember the "scan" tickbox in local storage.
scanUri: null,
smartScanUri: null
};
},
@ -372,18 +441,6 @@ export default {
},
scanPayload: function() {
var payload = this.basePayload;
// Scan params
payload.grid = [this.scanSteps.x, this.scanSteps.y, this.scanSteps.z];
payload.stride_size = [
this.scanStepSize.x,
this.scanStepSize.y,
this.scanStepSize.z
];
payload.style = this.scanStyle.toLowerCase();
payload.namemode = this.namingStyle.toLowerCase();
// Convert AF selector to dz
var afDeltas = {
Off: 0,
@ -392,11 +449,32 @@ export default {
Fine: 10,
Fast: 2000
};
payload.autofocus_dz = afDeltas[this.scanDeltaZ];
payload.fast_autofocus = this.scanDeltaZ == "Fast";
return payload;
return {
...this.basePayload,
// Scan params
grid: [this.scanSteps.x, this.scanSteps.y, this.scanSteps.z],
stride_size: [
this.scanStepSize.x,
this.scanStepSize.y,
this.scanStepSize.z
],
style: this.scanStyle.toLowerCase(),
namemode: this.namingStyle.toLowerCase(),
autofocus_dz: afDeltas[this.scanDeltaZ],
fast_autofocus: this.scanDeltaZ == "Fast"
};
},
smartScanPayload: function() {
return {
...this.scanPayload,
threshold: this.smartStackThreshold,
width: this.smartStackPeakWidth,
align_dist: this.smartStackAlignDist,
backlash: this.smartStackBacklash,
fit_style: this.smartStackFitStyle,
m_and_m_index: this.smartStackMAndMIndex,
autofocus_dz: this.smartStackAutofocusDz
};
}
},
@ -446,6 +524,22 @@ export default {
.catch(error => {
this.modalError(error); // Let mixin handle error
});
axios
.get(this.pluginsUri) // Get a list of plugins
.then(response => {
var plugins = response.data;
var foundExtension = plugins.find(
e => e.title === "org.openflexure.smart-stack"
);
if (foundExtension) {
// Get plugin action link
this.smartScanUri = foundExtension.links.tile.href;
}
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
onScanResponse: function() {