diff --git a/openflexure_microscope/api/static/public/ListServices.imjoy.html b/openflexure_microscope/api/static/public/ListServices.imjoy.html new file mode 100644 index 00000000..e4492765 --- /dev/null +++ b/openflexure_microscope/api/static/public/ListServices.imjoy.html @@ -0,0 +1,43 @@ + +[TODO: write documentation for this plugin.] + + + +{ + "name": "List services", + "type": "web-worker", + "tags": [], + "ui": "", + "version": "0.1.0", + "cover": "", + "description": "List the available ImJoy services in the console", + "icon": "extension", + "inputs": null, + "outputs": null, + "api_version": "0.1.8", + "env": "", + "permissions": [], + "requirements": [], + "dependencies": [] +} + + + diff --git a/openflexure_microscope/api/static/public/OpenFlexureTestMoveStage.imjoy.html b/openflexure_microscope/api/static/public/OpenFlexureTestMoveStage.imjoy.html index 12289a4c..3d1cf4b9 100644 --- a/openflexure_microscope/api/static/public/OpenFlexureTestMoveStage.imjoy.html +++ b/openflexure_microscope/api/static/public/OpenFlexureTestMoveStage.imjoy.html @@ -41,6 +41,8 @@ class ImJoyPlugin { console.log(`Moved Z to ${await ofm.getPosition()}`); await ofm.setPosition(start[2]); console.log(`Moved Z to ${await ofm.getPosition()}`); + await ofm.fullFocus(); + console.log("Ran a full autofocus"); } } diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/imjoyContent.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/imjoyContent.vue index 981230d4..3c79c8d2 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/imjoyContent.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/imjoyContent.vue @@ -200,18 +200,16 @@ export default { }); this.setupMicroscopeAPI(); this.setupViewers(); - // load the script editor for openflexure - await this.loadPlugin( - `${window.location.origin}/OpenFlexureScriptEditor.imjoy.html` - ); - // Load the snap image template - await this.loadPlugin( - `${window.location.origin}/OpenFlexureSnapImageTemplate.imjoy.html` - ); - // Load the move stage template - await this.loadPlugin( - `${window.location.origin}/OpenFlexureTestMoveStage.imjoy.html` - ); + const origin = window.location.origin; + const localPlugins = [ + "OpenFlexureSnapImageTemplate", + "OpenFlexureScriptEditor", + "OpenFlexureTestMoveStage", + "ListServices" + ]; + for(let fname of localPlugins){ + await this.loadPlugin(`${origin}/${fname}.imjoy.html`); + } this.setupPluginEngine(); }); this.imjoy = imjoy; @@ -259,7 +257,7 @@ export default { } }); }, - setupMicroscopeAPI() { + async setupMicroscopeAPI() { // Here we register a set of API for controlling the microscope as a service // 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 @@ -275,7 +273,7 @@ export default { const service = { _rintf: true, // this will make sure the function can be called multiple times type: "#microscope-control", - name: "#openflexure", + name: "OpenFlexure", lastSnapResponse: null, snapPreviewImage() { // The "proper" capture method is more involved - this one pulls a frame out of the preview stream @@ -376,8 +374,12 @@ export default { return runAutofocus(); } }; - this.imjoy.pm.registerService({ name: "#openflexure" }, service); + const ref = await this.imjoy.pm.registerService( + {type: "#microscope-control", name: "OpenFlexure"}, + service + ); console.log("registered service"); + console.log(ref); }, closeWindow(w) { if (w) {