From de7f4f6dfe655fabd4ff4229dae57c8c91d14b8a Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 9 Sep 2020 12:16:06 +0100 Subject: [PATCH 1/5] Drafted integrated slide scan --- .../api/static/package.json | 2 +- .../api/static/src/components/appContent.vue | 17 + .../controlComponents/paneSlideScan.vue | 312 ++++++++++++++++++ .../tabContentComponents/slideScanContent.vue | 25 ++ poetry.lock | 14 +- 5 files changed, 362 insertions(+), 8 deletions(-) create mode 100644 openflexure_microscope/api/static/src/components/controlComponents/paneSlideScan.vue create mode 100644 openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue diff --git a/openflexure_microscope/api/static/package.json b/openflexure_microscope/api/static/package.json index af5be7b0..b2cc386c 100644 --- a/openflexure_microscope/api/static/package.json +++ b/openflexure_microscope/api/static/package.json @@ -10,7 +10,7 @@ "license": "GNU General Public License v3.0 ", "scripts": { "build": "vue-cli-service build --mode production", - "serve": "vue-cli-service serve --mode development" + "serve": "vue-cli-service serve --mode development" }, "dependencies": { "material-design-icons": "^3.0.1", diff --git a/openflexure_microscope/api/static/src/components/appContent.vue b/openflexure_microscope/api/static/src/components/appContent.vue index 24439529..54b89b73 100644 --- a/openflexure_microscope/api/static/src/components/appContent.vue +++ b/openflexure_microscope/api/static/src/components/appContent.vue @@ -55,6 +55,15 @@ > camera_alt + + camera_alt + + + + +
+
No scan extension found
+
+

Sample Scan Wizard

+ +
+
+

User information (1/4)

+ + + +
+ + +
+ +
+

Patient information (2/4)

+ + + +
+
+ +
+

Sample information (3/4)

+ + +
+ + +
+ + +
+
+ +
+

Start scan (4/4)

+ + +

+ Your name: + {{ username }} +

+

+ Patient ID: + {{ patientID }} +

+

+ Sample type: + {{ sampleType }} +

+
+
+ +
+

{{ message }}

+ +
+ +
+ + +
+

+ +

+
+
+
+ + + + + \ No newline at end of file diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue new file mode 100644 index 00000000..cf17e76d --- /dev/null +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue @@ -0,0 +1,25 @@ + + + diff --git a/poetry.lock b/poetry.lock index 2d480366..a3f4ebfb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -302,7 +302,7 @@ webargs = "^6.0.0" zeroconf = ">=0.24.5,<0.29.0" [package.source] -reference = "c79e6f28d5ffbd61dcfe7fc94130db604cdb4e2d" +reference = "bf41b5009e8e0e465222399f38c0cd2104dbd0b7" type = "git" url = "https://github.com/labthings/python-labthings.git" [[package]] @@ -718,16 +718,16 @@ description = "Declarative parsing and validation of HTTP request objects, with name = "webargs" optional = false python-versions = ">=3.5" -version = "6.1.0" +version = "6.1.1" [package.dependencies] marshmallow = ">=2.15.2" [package.extras] -dev = ["pytest", "webtest (2.0.35)", "webtest-aiohttp (2.0.0)", "pytest-aiohttp (>=0.3.0)", "Flask (>=0.12.2)", "Django (>=1.11.16)", "bottle (>=0.12.13)", "tornado (>=4.5.2)", "pyramid (>=1.9.1)", "webapp2 (>=3.0.0b1)", "falcon (>=2.0.0)", "aiohttp (>=3.0.0)", "mypy (0.770)", "flake8 (3.7.9)", "flake8-bugbear (20.1.4)", "pre-commit (>=1.20,<3.0)", "tox", "mock"] -docs = ["Sphinx (3.0.3)", "sphinx-issues (1.2.0)", "sphinx-typlog-theme (0.8.0)", "Flask (>=0.12.2)", "Django (>=1.11.16)", "bottle (>=0.12.13)", "tornado (>=4.5.2)", "pyramid (>=1.9.1)", "webapp2 (>=3.0.0b1)", "falcon (>=2.0.0)", "aiohttp (>=3.0.0)"] +dev = ["pytest", "webtest (2.0.35)", "webtest-aiohttp (2.0.0)", "pytest-aiohttp (>=0.3.0)", "Flask (>=0.12.2)", "Django (>=1.11.16)", "bottle (>=0.12.13)", "tornado (>=4.5.2)", "pyramid (>=1.9.1)", "webapp2 (>=3.0.0b1)", "falcon (>=2.0.0)", "aiohttp (>=3.0.0)", "mypy (0.782)", "flake8 (3.8.3)", "flake8-bugbear (20.1.4)", "pre-commit (>=2.4,<3.0)", "tox", "mock"] +docs = ["Sphinx (3.2.1)", "sphinx-issues (1.2.0)", "sphinx-typlog-theme (0.8.0)", "Flask (>=0.12.2)", "Django (>=1.11.16)", "bottle (>=0.12.13)", "tornado (>=4.5.2)", "pyramid (>=1.9.1)", "webapp2 (>=3.0.0b1)", "falcon (>=2.0.0)", "aiohttp (>=3.0.0)"] frameworks = ["Flask (>=0.12.2)", "Django (>=1.11.16)", "bottle (>=0.12.13)", "tornado (>=4.5.2)", "pyramid (>=1.9.1)", "webapp2 (>=3.0.0b1)", "falcon (>=2.0.0)", "aiohttp (>=3.0.0)"] -lint = ["mypy (0.770)", "flake8 (3.7.9)", "flake8-bugbear (20.1.4)", "pre-commit (>=1.20,<3.0)"] +lint = ["mypy (0.782)", "flake8 (3.8.3)", "flake8-bugbear (20.1.4)", "pre-commit (>=2.4,<3.0)"] tests = ["pytest", "webtest (2.0.35)", "webtest-aiohttp (2.0.0)", "pytest-aiohttp (>=0.3.0)", "Flask (>=0.12.2)", "Django (>=1.11.16)", "bottle (>=0.12.13)", "tornado (>=4.5.2)", "pyramid (>=1.9.1)", "webapp2 (>=3.0.0b1)", "falcon (>=2.0.0)", "aiohttp (>=3.0.0)", "mock"] [[package]] @@ -1220,8 +1220,8 @@ urllib3 = [ {file = "urllib3-1.25.10.tar.gz", hash = "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"}, ] webargs = [ - {file = "webargs-6.1.0-py2.py3-none-any.whl", hash = "sha256:cf0b5e2fdfb81f28b9332fce15621069d3fbc910a01c7ca8a5e166371699927b"}, - {file = "webargs-6.1.0.tar.gz", hash = "sha256:ebb47fb35c3c4fc764213a17d1686e82fec54759ebed2b0715907d566668bb3f"}, + {file = "webargs-6.1.1-py2.py3-none-any.whl", hash = "sha256:2ead6ce38559152043ab4ada4d389aef6c804b0c169482e7c92b3f498f690b2c"}, + {file = "webargs-6.1.1.tar.gz", hash = "sha256:412ecadd977afdea0ed6fa5f5b65ddd13a099269e622ec537f9c74c443ce4d0b"}, ] werkzeug = [ {file = "Werkzeug-1.0.1-py2.py3-none-any.whl", hash = "sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43"}, From f0ce85fc3f59f433434839c4d9e760c48a14acbe Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 9 Sep 2020 12:54:44 +0100 Subject: [PATCH 2/5] Added app setting to enable/disable IHI slidescan --- .../api/static/src/components/appContent.vue | 45 ++-- .../controlComponents/paneSlideScan.vue | 198 +++++++++--------- .../tabContentComponents/slideScanContent.vue | 2 +- .../settingsComponents/featuresSettings.vue | 55 +++++ .../viewComponents/settingsDisplay.vue | 28 ++- .../api/static/src/store.js | 1 + 6 files changed, 209 insertions(+), 120 deletions(-) create mode 100644 openflexure_microscope/api/static/src/components/viewComponents/settingsComponents/featuresSettings.vue diff --git a/openflexure_microscope/api/static/src/components/appContent.vue b/openflexure_microscope/api/static/src/components/appContent.vue index 54b89b73..b4a76edf 100644 --- a/openflexure_microscope/api/static/src/components/appContent.vue +++ b/openflexure_microscope/api/static/src/components/appContent.vue @@ -55,24 +55,20 @@ > camera_alt
- - camera_alt - - - settings - + +
@@ -90,8 +86,18 @@ + settings + + +

Sample Scan Wizard

-
-
+ +

User information (1/4)

- +
-
+

Patient information (2/4)

- +
-
+

Sample information (3/4)


- +
- +
-
+

Start scan (4/4)

@@ -62,38 +79,44 @@

{{ message }}

- +
+ @click="decrement()" + > + Previous + + @click="increment()" + > + Next +

+ @click="restart()" + > + Restart +

@@ -124,14 +147,60 @@ export default { }; }, + computed: { + pluginsUri: function() { + return `${this.$store.getters.baseUri}/api/v2/extensions`; + }, + currentTimeForm: { + get() { + // Chop the timezone information from the end + return this.currentTime.substr(0, 19); + }, + set(val) { + console.log(val); + // Get timezone + var dt = new Date(); + var tzo = -dt.getTimezoneOffset(), + dif = tzo >= 0 ? "+" : "-", + pad = function(num) { + var norm = Math.floor(Math.abs(num)); + return (norm < 10 ? "0" : "") + norm; + }; + // Stick to the end of the new timestring from the form + this.currentTime = val + dif + pad(tzo / 60) + ":" + pad(tzo % 60); + } + }, + + payload: { + get() { + return { + filename: `${this.patientID}_${this.sampleType}`, + temporary: false, + bayer: false, + grid: [10, 10, 9], + stride_size: [800, 600, 10], + fast_autofocus: true, + autofocus_dz: 2000, + use_video_port: false, + annotations: { + patientID: this.patientID, + username: this.username, + clientDatetime: this.currentTime + }, + tags: ["medscan"] + }; + } + } + }, + watch: { - baseURL: function (val) { + baseURL: function(val) { if (this.baseURL) { this.updateScanUri(); } else { this.message = "No baseURL given"; } - }, + } }, mounted: function() { @@ -147,7 +216,6 @@ export default { axios .get(this.pluginsUri) // Get a list of plugins .then(response => { - console.log(response); var plugins = response.data; var foundExtension = plugins.find( e => e.title === "org.openflexure.scan" @@ -159,7 +227,7 @@ export default { } }) .catch(error => { - console.log(error); // Let mixin handle error + this.modalError(error); // Let mixin handle error }); }, @@ -223,53 +291,6 @@ export default { pad(tzo % 60) ); } - }, - - computed: { - pluginsUri: function() { - return `${this.baseURL}/extensions`; - }, - - currentTimeForm: { - get() { - // Chop the timezone information from the end - return this.currentTime.substr(0, 19); - }, - set(val) { - console.log(val); - // Get timezone - var dt = new Date(); - var tzo = -dt.getTimezoneOffset(), - dif = tzo >= 0 ? "+" : "-", - pad = function(num) { - var norm = Math.floor(Math.abs(num)); - return (norm < 10 ? "0" : "") + norm; - }; - // Stick to the end of the new timestring from the form - this.currentTime = val + dif + pad(tzo / 60) + ":" + pad(tzo % 60); - } - }, - - payload: { - get() { - return { - filename: `${this.patientID}_${this.sampleType}`, - temporary: false, - bayer: false, - grid: [10, 10, 9], - stride_size: [800, 600, 10], - fast_autofocus: true, - autofocus_dz: 2000, - use_video_port: false, - annotations: { - patientID: this.patientID, - username: this.username, - clientDatetime: this.currentTime - }, - tags: ["medscan"] - }; - } - } } }; @@ -281,23 +302,6 @@ export default { text-align: left; } -input[type="text"], -input[type="datetime-local"] { - display: block; - margin: 0 10px 0 0; - width: 100%; - height: 25px; -} - -button { - display: inline-block; - box-sizing: border-box; - margin: 0 10px 0 0; - width: 100%; - height: 25px; - min-width: 100px; -} - .grid-container { display: grid; grid-template-columns: auto auto; @@ -309,4 +313,4 @@ button { font-weight: bold; text-align: center; } - \ No newline at end of file + diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue index cf17e76d..c04a6ce7 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/slideScanContent.vue @@ -15,7 +15,7 @@ import paneSlideScan from "../controlComponents/paneSlideScan"; import streamDisplay from "../viewComponents/streamDisplay.vue"; export default { - name: "NavigateContent", + name: "SlideScanContent", components: { paneSlideScan, diff --git a/openflexure_microscope/api/static/src/components/viewComponents/settingsComponents/featuresSettings.vue b/openflexure_microscope/api/static/src/components/viewComponents/settingsComponents/featuresSettings.vue new file mode 100644 index 00000000..97e033e7 --- /dev/null +++ b/openflexure_microscope/api/static/src/components/viewComponents/settingsComponents/featuresSettings.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/openflexure_microscope/api/static/src/components/viewComponents/settingsDisplay.vue b/openflexure_microscope/api/static/src/components/viewComponents/settingsDisplay.vue index 9d3266dd..60cd1e0a 100644 --- a/openflexure_microscope/api/static/src/components/viewComponents/settingsDisplay.vue +++ b/openflexure_microscope/api/static/src/components/viewComponents/settingsDisplay.vue @@ -17,6 +17,19 @@ Display +
  • + + Features + +
  • Microscope settings
  • + +
    + +
    +
    + Date: Wed, 9 Sep 2020 13:21:21 +0100 Subject: [PATCH 3/5] Updated scan tab icon --- .../api/static/src/components/appContent.vue | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/openflexure_microscope/api/static/src/components/appContent.vue b/openflexure_microscope/api/static/src/components/appContent.vue index b4a76edf..122adca7 100644 --- a/openflexure_microscope/api/static/src/components/appContent.vue +++ b/openflexure_microscope/api/static/src/components/appContent.vue @@ -66,7 +66,7 @@ :current-tab="currentTab" @set-tab="setTab" > - camera_alt + settings_overscan
    @@ -140,13 +140,17 @@ > - - - + + + Date: Wed, 9 Sep 2020 13:21:40 +0100 Subject: [PATCH 4/5] Updated Action status strings --- .../genericComponents/taskSubmitter.vue | 69 +++++++++---------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue b/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue index 0d521b1b..88c1fb29 100644 --- a/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue +++ b/openflexure_microscope/api/static/src/components/genericComponents/taskSubmitter.vue @@ -16,7 +16,7 @@ class="uk-button uk-button-danger uk-margin-remove uk-float-right uk-width-1-1" @click="terminateTask()" > - Terminate + Cancel
  • @@ -193,32 +193,29 @@ export default { var checkCondition = (resolve, reject) => { // If the condition is met, we're done! - axios - .get(this.taskUrl) - .then(response => { - console.log(response.data.status); - var result = response.data.status; - // If the task ends with success - if (result == "completed") { - resolve(response.data); - } - // If task ends with an error - else if (result == "error") { - // Pass the error string back with reject - reject(new Error(response.data.return)); - } - // If task ends with termination - else if (result == "cancelled") { - // Pass a generic termination error back with reject - reject(new Error("Task cancelled")); - } - else { - // Since the task is still running, we can update the progress bar - this.progress = response.data.progress; - // Check again after timeout - setTimeout(checkCondition, interval, resolve, reject); - } - }); + axios.get(this.taskUrl).then(response => { + console.log(response.data.status); + var result = response.data.status; + // If the task ends with success + if (result == "completed") { + resolve(response.data); + } + // If task ends with an error + else if (result == "error") { + // Pass the error string back with reject + reject(new Error(response.data.return)); + } + // If task ends with termination + else if (result == "cancelled") { + // Pass a generic termination error back with reject + reject(new Error("Task cancelled")); + } else { + // Since the task is still running, we can update the progress bar + this.progress = response.data.progress; + // Check again after timeout + setTimeout(checkCondition, interval, resolve, reject); + } + }); }; return new Promise(checkCondition); @@ -227,20 +224,16 @@ export default { pollProgress: function() { console.log("Starting progress polling"); - axios - .get(this.taskUrl) - .then(response => { - console.log("PROGRESS RESPONSE: ", response.data.progress); - this.progress = response.data.progress; - }); + axios.get(this.taskUrl).then(response => { + console.log("PROGRESS RESPONSE: ", response.data.progress); + this.progress = response.data.progress; + }); }, terminateTask: function() { - axios - .delete(this.taskUrl) - .then(response => { - console.log("TERMINATION RESPONSE: ", response.data); - }); + axios.delete(this.taskUrl).then(response => { + console.log("TERMINATION RESPONSE: ", response.data); + }); } } }; From 9a3ba335c159908609b3e13bbcedf0f238ce7687 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 9 Sep 2020 13:21:58 +0100 Subject: [PATCH 5/5] Made scan parameters editable (dev only for now) --- .../controlComponents/paneSlideScan.vue | 81 +++++++++---------- 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/openflexure_microscope/api/static/src/components/controlComponents/paneSlideScan.vue b/openflexure_microscope/api/static/src/components/controlComponents/paneSlideScan.vue index 17add11e..78738a6d 100644 --- a/openflexure_microscope/api/static/src/components/controlComponents/paneSlideScan.vue +++ b/openflexure_microscope/api/static/src/components/controlComponents/paneSlideScan.vue @@ -1,17 +1,16 @@