Added an implementation of snapImage() to API
Co-authored-by: Kaspar Emanuel <kaspar@monostable.co.uk>
This commit is contained in:
parent
e6bfc9342b
commit
9b52865f95
1 changed files with 25 additions and 3 deletions
|
|
@ -95,6 +95,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as imjoyCore from "imjoy-core";
|
import * as imjoyCore from "imjoy-core";
|
||||||
|
import axios from "axios";
|
||||||
import UIkit from "uikit";
|
import UIkit from "uikit";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -110,6 +111,14 @@ export default {
|
||||||
viewers: {}
|
viewers: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
captureActionUri: function() {
|
||||||
|
return `${this.$store.getters.baseUri}/api/v2/actions/camera/capture`;
|
||||||
|
},
|
||||||
|
snapshotStreamUri: function() {
|
||||||
|
return `${this.$store.getters.baseUri}/api/v2/streams/snapshot`;
|
||||||
|
},
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const imjoy = new imjoyCore.ImJoy({
|
const imjoy = new imjoyCore.ImJoy({
|
||||||
|
|
@ -209,19 +218,32 @@ export default {
|
||||||
// Here we register a set of API for controlling the microscope as an service
|
// Here we register a set of API for controlling the microscope as an service
|
||||||
// For interoperatability, it might be good to reuse a subset of the function names defined in MicroManager
|
// For interoperatability, it might be good to reuse a subset of the function names defined in MicroManager
|
||||||
// See here: https://valelab4.ucsf.edu/~MM/doc/MMCore/html/class_c_m_m_core.html
|
// See here: https://valelab4.ucsf.edu/~MM/doc/MMCore/html/class_c_m_m_core.html
|
||||||
|
const snapshotUri = this.snapshotStreamUri
|
||||||
|
const modalError = this.modalError
|
||||||
const service = {
|
const service = {
|
||||||
type: "_microscope-control",
|
type: "_microscope-control",
|
||||||
name: "OpenFlexure",
|
name: "OpenFlexure",
|
||||||
snapImage() {
|
snapImage() {
|
||||||
alert("Not implemented");
|
// The "proper" capture method is more involved - this one pulls a frame out of the preview stream
|
||||||
|
// TODO: allow the full capture API to be used - via temporary or "ram" capture
|
||||||
|
// TODO: split into snapImage and getImage (so snapImage is a POST request to capture and
|
||||||
|
// getImage returns the latest capture)
|
||||||
|
// Problem: the above split might return images you didn't capture, as there's no link from
|
||||||
|
// one to the other. We could use internal state in this component to manage that.
|
||||||
|
return axios
|
||||||
|
.get(snapshotUri)
|
||||||
|
.then(response => {
|
||||||
|
return response.data;
|
||||||
|
})
|
||||||
|
.catch(modalError);
|
||||||
},
|
},
|
||||||
getImage() {
|
getImage() {
|
||||||
alert("Not implemented");
|
alert("Not implemented");
|
||||||
},
|
},
|
||||||
setPoisition() {
|
setPosition() {
|
||||||
alert("Not implemented");
|
alert("Not implemented");
|
||||||
},
|
},
|
||||||
getPoisition() {
|
getPosition() {
|
||||||
alert("Not implemented");
|
alert("Not implemented");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue