Commit graph

2770 commits

Author SHA1 Message Date
jaknapper
e6eb4d419d Live logging (requires unbuffered program output from stitching) 2024-02-20 10:51:32 +00:00
jaknapper
aed5a22983 Autofocus verify based on sharpness range, removed repetitive logging 2024-02-15 11:02:44 +00:00
Joe Knapper
f1c315783c Test the success of refocusing 2024-02-13 15:24:42 +00:00
Joe Knapper
f2d85cb891 sleep before capturing 2024-02-09 19:06:58 +00:00
Joe Knapper
61d7712c27 tiff as an option 2024-02-09 19:05:20 +00:00
Joe Knapper
6aa712e515 Rescaling stitch preview to avoid scrolling in y 2024-02-09 16:08:21 +00:00
Richard Bowman
a61ffbf75a WIP: use code from labthings-picamera2 for EXIF writing
I've now switched to using piexif to write the EXIF tag, which
is slower - but still does not seem to work in openflexure-
stitching.
2024-02-05 17:14:56 +00:00
Richard Bowman
bc8db396bf Acquire raw images rather than processed ones
I've swapped `capture_jpeg` for `capture_array`. This will acquire a raw image and process it manually. Currently I've included LST correction, colour balance, but **not** the colour unmixing matrix. In the future we could add this to implement proper correction for saturation.

Currently EXIF data does not seem to be working properly.
2024-02-01 21:55:15 +00:00
Richard Bowman
24a1d9d020 WIP: try just waiting 0.5s rather than using an Event 2024-02-01 17:37:44 +00:00
Richard Bowman
4a18ef729a Parallelise capture of images and the next move 2024-02-01 17:36:05 +00:00
Richard Bowman
6e4e79f2d2 Factor out moving to the next scan point into a method 2024-02-01 16:49:18 +00:00
Richard Bowman
f60e6f2a0b Merge branch 'autofocus_efficiency' into 'v3'
Autofocus efficiency

See merge request openflexure/openflexure-microscope-server!173
2024-02-01 16:17:53 +00:00
jaknapper
db51cd8067 Make overlap value consistent 2024-02-01 15:31:14 +00:00
jaknapper
e6e809cea4 Zip files as we scan, saving the regenerated ones to the end
Removed maximum scan size of 750 images

Save json of scan inputs and use it for future stitching (ensures consistent parameters)

Moved looping autofocus to autofocus thing from recentering thing

Rewrote looping autofocus to skip unneeded moves, as if peak is out of range, no need to nicely focus
2024-01-30 18:46:34 +00:00
jaknapper
a0b98a1adc Fixed autofocus to not combine logs 2024-01-29 19:56:24 +00:00
Joe Knapper
528406137f Start autofocus from base of range for speed 2024-01-29 18:10:11 +00:00
Joe Knapper
53eb51e964 Improved default scan values 2024-01-23 15:22:30 +00:00
Joe Knapper
81d6514eb0 Always show scan name during scan 2024-01-23 11:42:03 +00:00
Richard Bowman
f44fb02006 Merge branch 'rwanda-feedback' into 'v3'
Hide background detect settings in an accordion

See merge request openflexure/openflexure-microscope-server!172
2024-01-17 14:22:51 +00:00
Richard Bowman
6a47835ea1 Re-label check coverage button 2024-01-17 14:13:12 +00:00
Richard Bowman
1b39f9d5c0 Add a button to stitch scans 2024-01-17 13:46:29 +00:00
Richard Bowman
0b45a5dc76 Allow action URIs to be retrieved without errors if they are missing
thingActionUrl may now be told to return `undefined` insstead of throwing an error if the action is missing.
2024-01-17 13:43:22 +00:00
Richard Bowman
653e1a4159 Added a button to flash the LED 2024-01-17 13:36:26 +00:00
Richard Bowman
50cf8e6f78 Generate zip files before download
Previously, zip files were only downloaded if they already
existed. Now, they are created with  an action, then
downloaded from the result.

Chrome now insists on downloading the files as `output.zip`, I can't see why this has changed, but perhaps it's related
to the security warning. This seems to be specific to zip files.
2024-01-17 13:16:41 +00:00
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