Added a pane for camera/stage calibration

This commit is contained in:
Richard Bowman 2020-03-25 05:24:10 +00:00
parent 4784257eb1
commit 2ba9c9493b
3 changed files with 119 additions and 1 deletions

View file

@ -13,6 +13,11 @@
<div class="uk-accordion-content"><cameraSettings /></div>
</li>
<li v-if="$store.getters.ready">
<a class="uk-accordion-title" href="#">Camera/stage mapping settings</a>
<div class="uk-accordion-content"><cameraStageMappingSettings /></div>
</li>
<li v-if="$store.getters.ready">
<a class="uk-accordion-title" href="#">Microscope settings</a>
<div class="uk-accordion-content"><microscopeSettings /></div>
@ -25,6 +30,7 @@
import streamSettings from "./settingsComponents/streamSettings.vue";
import microscopeSettings from "./settingsComponents/microscopeSettings.vue";
import cameraSettings from "./settingsComponents/cameraSettings.vue";
import cameraStageMappingSettings from "./settingsComponents/cameraStageMappingSettings.vue";
import appSettings from "./settingsComponents/appSettings.vue";
// Export main app
@ -34,6 +40,7 @@ export default {
components: {
streamSettings,
cameraSettings,
cameraStageMappingSettings,
microscopeSettings,
appSettings
}

View file

@ -103,7 +103,7 @@ export default {
data: function() {
return {
settings: null,
recalibrationLinks: null,
recalibrationLinks: {},
isCalibrating: false
};
},

View file

@ -0,0 +1,111 @@
<template>
<div id="cameraStageMappingSettings">
<form @submit.prevent="applyConfigRequest">
<!--Show auto calibrate if default plugin is enabled-->
<div v-if="'calibrate_xy' in recalibrationLinks" class="uk-margin-small">
<taskSubmitter
:can-terminate="false"
:requires-confirmation="true"
:confirmation-message="
'Start recalibration of the stage to the camera? This may take a while, and the microscope will be locked during this time.'
"
:submit-url="recalibrationLinks.calibrate_xy.href"
:submit-label="'Auto-Calibrate using camera'"
@response="onRecalibrateResponse"
@error="onRecalibrateError"
>
</taskSubmitter>
</div>
</form>
</div>
</template>
<script>
import axios from "axios";
import taskSubmitter from "../../genericComponents/taskSubmitter";
// Export main app
export default {
name: "CameraStageMappingSettings",
components: {
taskSubmitter
},
data: function() {
return {
settings: null,
recalibrationLinks: {},
isCalibrating: false
};
},
computed: {
settingsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/instrument/settings`;
},
pluginsUri: function() {
return `${this.$store.getters.baseUri}/api/v2/extensions`;
}
},
mounted() {
this.updateSettings();
this.updateRecalibrationLinks();
},
methods: {
updateSettings: function() {
axios
.get(this.settingsUri)
.then(response => {
this.settings = response.data.extensions['org.openflexure.camera_stage_mapping'];
})
.catch(error => {
this.modalError(error); // Let mixin handle error
this.settings = {};
});
},
updateRecalibrationLinks: function() {
axios
.get(this.pluginsUri) // Get a list of plugins
.then(response => {
var plugins = response.data;
var foundExtension = plugins.find(
e => e.title === "org.openflexure.camera_stage_mapping"
);
// if camera-stage mapping extension is enabled
if (foundExtension) {
// Get plugin action link
this.recalibrationLinks = foundExtension.links;
} else {
this.recalibrationLinks = {}
}
})
.catch(error => {
this.modalError(error); // Let mixin handle error
});
},
onRecalibrateResponse: function() {
this.modalNotify("Finished stage-to-camera calibration.");
// Update local settings
this.updateSettings();
},
onRecalibrateError: function(error) {
this.modalError(error); // Let mixin handle error
}
}
};
</script>
<style lang="less">
.center-spinner {
margin-left: auto;
margin-right: auto;
}
</style>