Commit graph

2746 commits

Author SHA1 Message Date
Richard Bowman
b35db02f34 Improved error handling and zip download
I've swapped out various `logging.exception` calls for
`logging.error` with `exc_info` set to the exception.
My reading of the docs is that the two shoulld be equivalent,
but the former fails with an error related to
message formatting, as if there was an extra (or missing) '%'.

I've changed the format of the downloaded zip file, so that it
now puts the stitched images at the top level (if they exist).

I've also modified the time of the last stitched image so it
returns None if it doesn't exist - this avoids HTTP errors in
the client.
2024-01-17 13:14:43 +00:00
Richard Bowman
65ae6c1f76 Removed a couple of print statements 2024-01-17 12:25:17 +00:00
Richard Bowman
f627d6e2f2 Always generate the preview stitch
The preview stitch is useful even if stitch-as-you-go is not
desired. I've enabled it all the time, not just when the box
is ticked.
2024-01-17 11:59:30 +00:00
Richard Bowman
674704b0d6 Display the microscope's hostname in the interface 2024-01-17 11:55:03 +00:00
Richard Bowman
36a7ec3d2e Expose hostname in settings manager
I've added a `hostname` property to the settings manager.
2024-01-17 11:53:08 +00:00
Richard Bowman
6e18a91d1f Hide background detect settings in an accordion
Feedback from clinicians is that this tab was too busy. This commit hides all but the two essential buttons.
2024-01-17 11:28:36 +00:00
Richard Bowman
011dc2191c Add a control to set whether scans are automatically stitched. 2024-01-15 21:36:15 +00:00
Richard Bowman
9ac0a11ce1 Add a property to enable/disable auto-stitching 2024-01-15 21:35:27 +00:00
Richard Bowman
06bc5f65cb Merge branch 'save_thing_settings_on_demand' into 'v3'
Make it possible to manually save all settings to disk

See merge request openflexure/openflexure-microscope-server!171
2024-01-15 21:20:33 +00:00
Richard Bowman
7d63c9da44 Add a button to save settings to disk 2024-01-15 21:19:03 +00:00
Richard Bowman
b9f7e6f1e3 Make it possible to manually save all settings to disk
There's now an action that will save all settings to disk.
This copies code from `labthings_fastapi.thing_server` so
may want to be deduplicated in the fullness of time.
2024-01-15 21:17:43 +00:00
Richard Bowman
dd0a70c2b6 Merge branch 'scan_name' into 'v3'
custom scan name from gui

See merge request openflexure/openflexure-microscope-server!170
2024-01-15 20:44:49 +00:00
Richard Bowman
e7a3003c47 Add a closing ` to the logging statement
This was mistakenly not added to the previous commit.
2024-01-15 20:42:54 +00:00
Richard Bowman
dca2d1fabb Improve scan naming logic and type hints
Removed an unnecessary `Optional` and removed the `scan_` prefix from scans that have a non-empty name.

I also added a closing ` to a logging statement.
2024-01-15 20:27:35 +00:00
Joe Knapper
e483c3ddfb custom scan name from gui 2024-01-15 17:40:17 +00:00
Joe Knapper
c2f1b591b1 Fix to CSM scaling for Fiji config as images are now captured at double width 2024-01-13 14:29:34 +00:00
Joe Knapper
d1908eb29a Run stitching thing with appropriate overlap setting 2024-01-13 13:38:39 +00:00
jaknapper
d369105111 Fixed log link 2024-01-12 17:15:09 +02:00
jaknapper
c4e02d9087 Maximum lateral range and minimum autofocus range 2024-01-11 20:38:47 +00:00
Richard Bowman
e611840aca Save microscope id as a string
UUIDs don't serialise to JSON, so I'm now saving it as a plain
string and reconstructing a UUID object when it's returned.

Returning a UUID seems clearer than returning a string.
2024-01-11 19:53:08 +00:00
Richard Bowman
a279831c41 Reordered cleanup operations for robustness
I now define the variables needed in the finally: block at
the very start, so I can test if they are None.

I've reordered the final move so it can happen as we are awaiting the background processes. I've added exception handling so this won't cause problems with the lock.
2024-01-11 16:39:06 +00:00
Richard Bowman
606ee9bcc2 Return hostname using a v2 URL for Connect compatibility 2024-01-11 16:20:49 +00:00
Richard Bowman
074b9c67f8 Serialise microscope ID to string
UUID objects don't serialise with `json.dumps` and thus cause
errors when we try to embed `thing_state` into images.
2024-01-11 15:58:42 +00:00
Richard Bowman
f51d6ced71 Add hostname and microscope ID to metadata
It's often helpful to tell if images came from the same
microscope - this metadata should answer that question.
2024-01-11 14:48:08 +00:00
Richard Bowman
924cce649a Autofocus tweaks for smart scan
We've removed the initial double-autofocus (we just do a
single looping autofocus at the start), and now only do 3 retries rather than 5 if the focus is rejected.
2024-01-11 14:15:54 +00:00
Richard Bowman
20efaa2799 Appearance tweaks
actionLogDisplay had white-on-white text in dark mode: I've fixed color to be black now.

added a title for the mini stream display during scans
2024-01-11 14:08:32 +00:00
Richard Bowman
13f39d5303 Merge branch 'integrated-stitching' into 'v3'
Run `openflexure-stitch` on the server

See merge request openflexure/openflexure-microscope-server!169
2024-01-11 14:01:02 +00:00
Richard Bowman
a965d04047 Move raw images folder inside images folder
This ensures images.zip contains everything - a neater solution
for this is TBD.
2024-01-11 13:56:24 +00:00
Richard Bowman
f4c4206a53 Return an empty scans list if the folder is missing 2024-01-11 13:40:47 +00:00
Richard Bowman
6b6946ec60 Cope with an empty scan list 2024-01-11 13:37:57 +00:00
Richard Bowman
d96dbdd546 Only stringify boolean values when setting properties
My workaround to the axios bug that makes `false` values not work
2024-01-11 13:37:57 +00:00
Richard Bowman
ba86c37292 Swap background detection from argument to property
For consistency, I've made background detection a property.
2024-01-11 03:21:50 +00:00
Richard Bowman
f26230efb6 Swap background detect from argument to property
I've added boolean support to PropertyControl. This required
working around a bug in axios, that ignored `false` when sent
as the body of a request.
2024-01-11 03:01:33 +00:00
Richard Bowman
3de7aa2fb2 Don't invoke stitching from the front-end
Stitching is now done automatically in a sub process by the
server. This is much cleaner - and all we need to do is poll for
file updates.

I've also styled the log display slightly better.
2024-01-11 01:51:17 +00:00
Richard Bowman
9a2b830ff5 Fix completed event 2024-01-11 01:50:01 +00:00
Richard Bowman
6b466c80a9 Add polling for preview stitched images 2024-01-11 01:50:01 +00:00
Richard Bowman
717cf7657c Combine stitcher and smart scan Things
I'm now running stitching in subprocesses during the scan.
This seems to be working well - I'm using multiple CPU
cores and getting images out. However, the only way to
avoid circular dependencies was to combine the Things.

I'm still getting not-infrequent memory allocation errors from the camera, which may or may not be related.
2024-01-11 01:49:24 +00:00
Richard Bowman
b5fbcc85b5 Succeed immediately if the stitched image is up to date
To save some CPU cycles, we will return immediately if the
images don't look newer than the stitch. NB this does mean
that the stitched image will be repeatedly transferred, as its
URL will change each time it's re-requested.

Alternatively, we could fail with an error, which may be more efficient, at the expense of being uglier.
2024-01-10 23:17:16 +00:00
Richard Bowman
00a4b38a83 Prevent scans from filling the SD card 2024-01-10 21:07:25 +00:00
Richard Bowman
8fb70bf43a Make latest_scan_name a property 2024-01-10 20:51:50 +00:00
Richard Bowman
9ce52c2845 Added a Thing to run stitching as Actions 2024-01-10 20:51:49 +00:00
Richard Bowman
b6b1fd06bf Merge branch 'refactor-task-submitter' into 'v3'
Refactor task submitter

See merge request openflexure/openflexure-microscope-server!168
2024-01-10 20:49:10 +00:00
Richard Bowman
7c88704059 Only show scrollbar if needed 2024-01-10 20:48:22 +00:00
Richard Bowman
215bfb5121 Leave scan log open until closed
The log/progress view is now closed explicitly, rather than disappearing as soon as the scan is over.
2024-01-10 20:46:06 +00:00
Richard Bowman
f03e0188e4 Fix a typo when reacting to an existing invocation
checkExistingTasks was looking up the task's `self` link by
checking for `rel=self`, which failed. I have corrected this
to `rel="self"` - `self` would have evaluated to `undefined`.
2024-01-10 20:46:06 +00:00
Richard Bowman
81540ebc45 Linter fixes 2024-01-10 20:46:06 +00:00
Richard Bowman
29177d7214 Scroll to the bottom when status messages appear
The log viewer was scrolling to the bottom when new logs
appeared, but not when the status updated. This meant that the status update may have been invisible. I now scroll
when the status changes too, which should fix the problem.
2024-01-10 20:46:06 +00:00
Richard Bowman
46444770f3 Improved styling and synchronisation 2024-01-10 20:46:06 +00:00
Richard Bowman
53644a691b Refactored taskSubmitter to enable bits to be re-used 2024-01-10 20:46:06 +00:00
Richard Bowman
cf075c6261 Merge branch 'v3-log' into 'v3'
Restored old log path

See merge request openflexure/openflexure-microscope-server!167
2024-01-10 19:53:53 +00:00