Adding automatic range of motion measurements

Adding the ability to measure the range of motion of the stage. The algorithm was developed in !209 (closed).

Not that no UI is added in this MR! This will come at a later date.

This MR contains the following

  • A new file called stage_measure which contains all the functionality needed to measure the range of motion.
  • Addition of the stage_measure thing to the config file(not including the simulation).

Note: Issue #501 (closed) will reduce number of arguments in functions in the future.

Things to do before merging:

  • Move quadratic function to utilities file.
  • Make function names more clear.
  • Improve the structure of the file to make it more readable.

Final Algorithm for each direction (+x, -x, +y, -y)

(Formats a bit funny, but is markdown so we can update it)

graph TD
s([Start])
er([Error])
Ti[/Take image/]
Mi[/Move 50% of FOV.\nAutofocus and\ntake another image/]
CC{Cross correlate\nlast two images}
Bm[/Move 200% of FOV with z correction/]
Ti2[/Take image/]
Si[/Move 20% of FOV and take another image/]
CC2{Cross correlate\nlast two images\nAutofocus up to 3 times\nIf movement not as\nexpected}
Ed[Edge is found]
Mb[/Move backward until motion detected/]
Rf[Record final position]
e([End])
  s --> Ti
  subgraph Medium Moves
    Ti --> Mi --> CC 
  end
  CC -->| Too much parasitic motion | er
  CC -.->| < 5 correlations| Mi
  CC --> | 5 correlations | Bm
  subgraph Big Moves
    Bm --> Ti2
    subgraph Small moves
      Ti2 --> Si --> CC2
    end
  end
  CC2 -->| Moved strangely | Ed
  CC2 -->| < 3 correlations | Si
  CC2 -->| 3 correlations | Bm
  Ed --> Mb --> Rf --> e

Merge checklist:

  • All new/changed functions have up to date typehints and docstrings
  • Any UI updates have a before and after screenshot in the MR description
  • Unit testing of new functionality has similar or better coverage that similar existing code
  • This code has been tested on a microscope
    • With webapp has been recompiled (if changed)
    • With updated settings JSON (if changed)
    • SmartScan and live stitching work
Edited by Julian Stirling

Merge request reports

Loading