Commit graph

2711 commits

Author SHA1 Message Date
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
Joe Knapper
1464d7d553 Restored old log path 2024-01-10 18:33:08 +00:00
Joe Knapper
ddfce7dcff Success and warning alerts in webapp 2024-01-10 18:29:43 +00:00
jaknapper
6d622c1bf8 Avoid negative dx/dy and allow for float CSM image resolution 2024-01-10 15:38:34 +00:00
jaknpper
d219e32bc8 Option to run scan without background detect in webapp and Thing 2024-01-09 20:24:51 +00:00
Joe Knapper
89dae7ba80 Button for not-smart scan and better positioned navigate buttons 2024-01-09 16:46:13 +00:00
Joe Knapper
090f447d26 Thing properties for autofocus dz, overlap and range limit 2024-01-08 19:33:24 +00:00
Richard Bowman
9a3e870d21 Remove unused taskId data
taskSubmitter's "taskId"  data member was usually incorrect and
wasn't necessary - it is removed.
2024-01-08 17:35:06 +00:00
Richard Bowman
d615522712 Raw images and better cancellation
Cancelling a smart scan now resets position to the starting point.

a "raw images" folder now includes images without resampling.
2024-01-08 17:25:31 +00:00
Richard Bowman
26f5b1955e Reset position to starting point when CSM is cancelled
NB there's a confusing feature, where stage.move will
fail after the task has been cancelled, because it is cancellable.
For now, we can work around it by passing `block_cancellation` but
this may want to be solved more generally in LabThings
2024-01-08 17:24:18 +00:00
Richard Bowman
552fde45ed Improve logging commands
use logging.exception instead of setting exc_info.
2024-01-08 16:43:28 +00:00
Richard Bowman
7eeee89b23 Error messages if background detect fails. 2024-01-08 16:40:07 +00:00
Richard Bowman
ec61019d76 Improve modal progress dialog
I've tidied up the UI a bit here:
* The modal box stays open and must be explicitly closed.
  Pretty much everywhere we want to use this, it would be nice
  to see the final confirmation it's worked - so I have removed
  the line that closes it after the task completes.
* The progress bar no longer animates after the task has
  finished (logic previously didn't consider that state as the
  bar wasn't visible except while it was running).
* A helpful message is printed when the task completes or is
  cancelled.
2024-01-08 16:24:43 +00:00
Richard Bowman
c0d25b194c Format fixes/disable warnings
My v-html use is OK as the  HTML is sanitized.
2024-01-08 16:24:43 +00:00
jaknapper
4445990966 Check we have a background set before starting scan 2024-01-08 16:21:57 +00:00
Joe Knapper
125bae9c6d Merge branch 'spiral_path' into 'v3'
Pseudo spiral scan path and fixed dx-dy inversion

See merge request openflexure/openflexure-microscope-server!166
2024-01-08 16:10:17 +00:00
jaknapper
ae68a1b319 Pseudo spiral scan path and fixed dx-dy inversion 2024-01-08 16:01:54 +00:00
Richard Bowman
4f1035cbe6 Handle python "underlining" nicely
Python stack traces use spaces and carets to "underline" the
code causing the problem. I've now matched and processed
these lines to add <u> tags.

This necessitated escaping messages and displaying raw HTML
which is now done by `escapeText`.
2024-01-08 15:51:46 +00:00
Richard Bowman
4bf473fad7 Better handling of multiline logs
I fixed a logic error related to the reversing of the list, and
now display multi-line log messages as a single summary line with a "more info" link to expand them.

Expanded log messages show without text wrap - this makes
Python exception traces easier to read.

For extra points, we could even do something cunning, like
process the ^^^ markers into <u>
2024-01-08 15:30:51 +00:00
Richard Bowman
24060b6d2a Cope with multiline logs 2024-01-08 11:53:37 +00:00
jaknapper
a53062af83 Background detect fraction as a thing 2024-01-07 15:00:46 +00:00
Joe Knapper
cb916bb4a3 Image fraction and label as a thing property in webapp 2024-01-07 14:58:19 +00:00
jaknapper
9eb0b6a6b8 Log CSM result in a safe way 2024-01-05 18:41:57 +00:00
jaknapper
1ebf00ffb3 Fiji config file and low res capture to avoid exposure time drift 2024-01-05 17:23:44 +00:00
Richard Bowman
858e99a47f Add a viewer for scans with delete and download buttons 2024-01-05 00:44:05 +00:00
Richard Bowman
7959b34c44 Deleted unused code from slideScan 2024-01-05 00:43:46 +00:00
Richard Bowman
90a68ed4f1 Added endpoints to add and delete scans
This makes use of the new @fastapi_endpoint decorator
in labthings.
2024-01-05 00:42:24 +00:00
Richard Bowman
2ce143ff01 WIP: Exception handling and file management
It's now possible to see (via the HTTP API) scans and download
them as zip files. Zip files appear to be malformed at present.
2024-01-04 18:59:51 +00:00
Richard Bowman
1ca2c9ca0d Expand comments 2024-01-04 16:36:58 +00:00
Richard Bowman
a442709412 Linter fixes 2024-01-04 16:35:38 +00:00
Richard Bowman
bea9bdee02 Handle cancellation gracefully
Cancellation is now confirmed with a modal notification, and
won't result in an error in the console.
2024-01-04 16:35:13 +00:00
Richard Bowman
7d497fcf73 Tidy up modal error
It now works if it's passed a string, as well as an Error.
2024-01-04 16:32:43 +00:00
Richard Bowman
7dd4c1f4c6 Add modal progress box for stage recentering
I've also added a title to the modal box
2024-01-04 15:54:56 +00:00
Richard Bowman
a18ac90c24 Allow camera stage mapping calibration to be cancelled 2024-01-04 14:49:27 +00:00
Richard Bowman
bcc13475b6 Propagate logs from camera-stage-mapping 2024-01-04 13:19:00 +00:00
Richard Bowman
91cb514e08 Use blocking, non-cancellable moves in autofocus
Autofocus timing is pretty critical. I've introduced the ability
to abort moves, which introduces ~50ms timing jitter. This
commit reverts the tming-critical move in autofocus to the old behaviour.

I've only reverted the move that really matters - this means
that if you start a massive sweep by accident, you can still
abort it when it's moving down to the start of the sweep.
2024-01-04 10:46:27 +00:00