Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Configure btrack run from napari #26

Merged
merged 50 commits into from
Jun 17, 2022
Merged

Conversation

alessandrofelder
Copy link
Contributor

@alessandrofelder alessandrofelder commented May 25, 2022

This PR adds

  • a functional napari-btrack widget with both cell and particle mode
  • tests for a roundtrip from config to widgets and back (for both cell and particle)
  • tests for each of the buttons

This PR represents the fallback option if we don't manage to address the related issues quantumjot/btrack#268 quantumjot/btrack#267 , so I'd suggest to merge this once we're happy the functionality is correct (although the code and the aesthetic are rough around the edges).

The code behind this could definitely do with some modularisation (~all in one file currently 😱 ) and other tidying.
I suggest we address the modularisation and tidying as part of quantumjot/btrack#266 (the next priority) as the tabifying should naturally enforce some modularisation.

@dpshelio dpshelio mentioned this pull request Jun 1, 2022
@quantumjot
Copy link
Collaborator

Looking good! I had a play with this and have a little bit of feedback while this is still in development:

@alessandrofelder alessandrofelder force-pushed the prog-make-widgets-from-pydantic branch from 7e5f532 to 6d51599 Compare June 15, 2022 14:38
@alessandrofelder
Copy link
Contributor Author

Thanks for some great review comments, @dstansby @paddyroddy @quantumjot !

@dstansby dstansby merged commit 1601210 into main Jun 17, 2022
@dstansby dstansby deleted the prog-make-widgets-from-pydantic branch June 17, 2022 09:36
p-j-smith added a commit that referenced this pull request Mar 22, 2023
…figs (#64)

Fixes #63 

- handle arbitrary user configs
- when the plugin starts, the example `cell_config` and
`particle_config` files are loaded, and users can load more of their own

This ended up being a bigger refactor than I planned - I need to
refactor quite a few of the functions because they assume there are two
modes ('cell' and 'particle'). And at the same time I moved toward a
more modular structure as has been suggested
#26.

**refactor `napari_btrack.track` into various sub-packages and modules**

- `napari_btrack.track`:
    - renamed to `napari_btrack.main`
- contains only code for launching the plugin, defining callback
functions, and running the analysis

- `napari_btrack.config`:
- a new module with classes to handle converting between scaled and
unscaled matrices in `MotionModel`s
- removed `Matrices` class (which hardcoded values for `cell` or
`particle`modes) and replaced with `UnscaledTrackerConfig` to handle
arbitrary user configs

- `napari_btrack.widgets`:
    - a new sub-package for creating the widgets for the plugin

- `napari_btrack.sync`:
- a new module to handle updating a config from widget values or vice
versa

**other changes**

- added per-file-ignores for some linting rules (allow `assert` in test
files, allow unused imports in `__init__.py` files)
- some classes / functions were being imported only for type checking -
move these imports in a check `if TYPE_CHECKING:` so that they're not
imported at runtime
- renamed the function that launches the plugin from
`napari_btrack.track.track` to `napari_btrack.main.create_btrack_widget`
- explicitly set the expected `widget_type` when using
`magicgui.widgets.create_widget` - knowing the widgets we're using
should make it easier to move to using `qt` directly at some point,
which would allow us to have separate tabs for each section
- add tooltips for every widget - they're based on the `btrack` api docs

---------

Co-authored-by: Patrick Roddy <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants