Update calibration modal to use cached TDs and new URLs
This commit is contained in:
parent
c2ec060df9
commit
ba76561065
1 changed files with 31 additions and 84 deletions
|
|
@ -146,8 +146,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
import cameraCalibrationSettings from "../tabContentComponents/settingsComponents/cameraSettingsComponents/cameraCalibrationSettings.vue";
|
import cameraCalibrationSettings from "../tabContentComponents/settingsComponents/cameraSettingsComponents/cameraCalibrationSettings.vue";
|
||||||
import CSMCalibrationSettings from "../tabContentComponents/settingsComponents/CSMSettingsComponents/CSMCalibrationSettings.vue";
|
import CSMCalibrationSettings from "../tabContentComponents/settingsComponents/CSMSettingsComponents/CSMCalibrationSettings.vue";
|
||||||
import miniStreamDisplay from "../genericComponents/miniStreamDisplay.vue";
|
import miniStreamDisplay from "../genericComponents/miniStreamDisplay.vue";
|
||||||
|
|
@ -172,57 +170,21 @@ export default {
|
||||||
return {
|
return {
|
||||||
ready: false,
|
ready: false,
|
||||||
stepValue: 0,
|
stepValue: 0,
|
||||||
settings: {},
|
isCSMCalibrated: undefined,
|
||||||
config: {}
|
isLSTCalibrated: undefined
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
settingsUri: function() {
|
|
||||||
return `${this.$store.getters.baseUri}/api/v2/instrument/settings`;
|
|
||||||
},
|
|
||||||
configUri: function() {
|
|
||||||
return `${this.$store.getters.baseUri}/api/v2/instrument/configuration`;
|
|
||||||
},
|
|
||||||
availablePluginTitles: function() {
|
|
||||||
return this.availablePlugins.map(a => a.title);
|
|
||||||
},
|
|
||||||
isCSMCalibrated: function() {
|
|
||||||
if (this.settings.extensions["org.openflexure.camera_stage_mapping"]) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isLSTCalibrated: function() {
|
|
||||||
if (
|
|
||||||
this.settings.camera.picamera &&
|
|
||||||
this.settings.camera.picamera.lens_shading_table
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
canCSMCalibrated: function() {
|
canCSMCalibrated: function() {
|
||||||
// Assert CSM extension is enabled
|
// Assert CSM extension is enabled
|
||||||
var extensionEnabled = this.availablePluginTitles.includes(
|
return this.thingAvailable("camera_stage_mapping");
|
||||||
"org.openflexure.camera_stage_mapping"
|
|
||||||
);
|
|
||||||
// Assert real stage is connected
|
|
||||||
var stageConnected = this.config.stage.type !== "MissingStage";
|
|
||||||
// Combine
|
|
||||||
return stageConnected && extensionEnabled;
|
|
||||||
},
|
},
|
||||||
canLSTCalibrated: function() {
|
canLSTCalibrated: function() {
|
||||||
// Assert LST extension is enabled
|
// Assert LST extension is enabled
|
||||||
var extensionEnabled = this.availablePluginTitles.includes(
|
return (
|
||||||
"org.openflexure.calibration.picamera"
|
"calibrate_lens_shading" in this.thingDescription("camera").actions
|
||||||
);
|
);
|
||||||
// Assert real camera is connected
|
|
||||||
var cameraConnected = this.config.camera.type !== "MissingCamera";
|
|
||||||
// Combine
|
|
||||||
return cameraConnected && extensionEnabled;
|
|
||||||
},
|
},
|
||||||
isUseful: function() {
|
isUseful: function() {
|
||||||
var CSMUseful = this.canCSMCalibrated && !this.isCSMCalibrated;
|
var CSMUseful = this.canCSMCalibrated && !this.isCSMCalibrated;
|
||||||
|
|
@ -236,25 +198,32 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
show: function() {
|
show: async function() {
|
||||||
// Get current settings
|
// Check if the camera and stage are calibrated, if they can be
|
||||||
this.getSettings()
|
if (this.canCSMCalibrated) {
|
||||||
.then(() => {
|
let csm = this.readThingProperty(
|
||||||
return this.getConfig();
|
"camera_stage_mapping",
|
||||||
})
|
"image_to_stage_displacement_matrix"
|
||||||
.then(() => {
|
);
|
||||||
// Check if this calibration wizard can actually do anything useful
|
this.isCSMCalibrated = Boolean(csm);
|
||||||
if (this.isUseful) {
|
}
|
||||||
this.ready = true;
|
if (this.canLSTCalibrated) {
|
||||||
this.stepValue = 0;
|
this.isLSTCalibrated = this.readThingProperty(
|
||||||
// Show the modal
|
"picamera",
|
||||||
var el = this.$refs["calibrationModalEl"];
|
"lens_shading_is_static"
|
||||||
this.showModalElement(el); // Calls the mixin
|
);
|
||||||
} else {
|
}
|
||||||
// If not useful, we just return the onClose event immediately
|
// Check if this calibration wizard can actually do anything useful
|
||||||
this.onHide();
|
if (this.isUseful) {
|
||||||
}
|
this.ready = true;
|
||||||
});
|
this.stepValue = 0;
|
||||||
|
// Show the modal
|
||||||
|
var el = this.$refs["calibrationModalEl"];
|
||||||
|
this.showModalElement(el); // Calls the mixin
|
||||||
|
} else {
|
||||||
|
// If not useful, we just return the onClose event immediately
|
||||||
|
this.onHide();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
|
|
@ -268,28 +237,6 @@ export default {
|
||||||
this.$emit("onClose");
|
this.$emit("onClose");
|
||||||
},
|
},
|
||||||
|
|
||||||
getSettings: function() {
|
|
||||||
return axios
|
|
||||||
.get(this.settingsUri)
|
|
||||||
.then(response => {
|
|
||||||
this.settings = response.data;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
this.modalError(error); // Let mixin handle error
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getConfig: function() {
|
|
||||||
return axios
|
|
||||||
.get(this.configUri)
|
|
||||||
.then(response => {
|
|
||||||
this.config = response.data;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
this.modalError(error); // Let mixin handle error
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
decrement: function() {
|
decrement: function() {
|
||||||
if (this.stepValue > 0) {
|
if (this.stepValue > 0) {
|
||||||
this.stepValue = this.stepValue - 1;
|
this.stepValue = this.stepValue - 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue