-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document napari plugin #393
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dafaa6f
started user guide about napari plugin
niksirbi 25a36eb
added optional dependencies for napari-video and pyvideoreader
niksirbi dc6fd2d
WIP expanding on the napari plugin user guide
niksirbi 75d418a
add section on loading poses datasets
niksirbi 5800cf9
set maximum card columns to 2 in the user guide page
niksirbi d21cbe8
corrected grammar and spelling mistakes in the plugin guide
niksirbi cb3d14d
removed automatic setting of playback fps to tracking fps
niksirbi 28a5dfa
update to v3 of pyvista/setup-headless-display-action
niksirbi 99aeb22
Apply suggestions from Sofia's code review
niksirbi ec7ee4d
renamed napari guide and added clarifications
niksirbi 5df617b
fps spinbox: make float, default 1, add tooltip
niksirbi 41cde1d
made image annotations more prominent
niksirbi 6256be5
Apply suggestions from CH's code review
niksirbi 59085ac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e2a2dcb
applied more suggestions from CH's review
niksirbi c0f761c
documented known issues
niksirbi ad14632
renamed napari_plugin.md to gui.md
niksirbi 9efeb8e
add link to github issues tagged with GUI + bug
niksirbi cdb3fcc
Use movement-github link from myst-url-scheme
niksirbi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
(target-gui)= | ||
# Graphical User Interface | ||
|
||
The `movement` graphical user interface (GUI), powered by our custom plugin for | ||
[napari](napari:), makes it easy to view and explore `movement` | ||
motion tracks. Currently, you can use it to | ||
visualise 2D [poses datasets](target-poses-and-bboxes-dataset) | ||
as points overlaid on video frames. | ||
|
||
:::{warning} | ||
The GUI is still in early stages of development but we are working on ironing | ||
out the [kinks](movement-github:issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+label%3AGUI+label%3Abug). | ||
Please [get in touch](target-get-in-touch) | ||
if you find any bugs or have suggestions for improvements! | ||
::: | ||
|
||
The `napari` plugin is shipped with the `movement` package starting from | ||
version `0.1.0`. To use it, you need to | ||
[install the package](target-installation) via a method that | ||
includes the `napari` dependency. | ||
|
||
|
||
## Launch the GUI | ||
|
||
To launch the `movement` GUI, type the following command in your terminal: | ||
|
||
```sh | ||
movement launch | ||
``` | ||
|
||
This is equivalent to running `napari -w movement` and will open the `napari` | ||
window with the `movement` widget docked on the | ||
right-hand side, as in the [screenshot](target-widget-screenshot) below. | ||
|
||
In `napari`, data is typically loaded into [layers](napari:guides/layers.html), | ||
which can be reordered and toggled for visibility in the layers list panel. | ||
For example, keypoint data can be added as a | ||
[points layer](napari:howtos/layers/points.html), | ||
while image stacks (including videos) can be added as | ||
[image layers](napari:howtos/layers/image.html). | ||
Below, we'll explain how to do this. | ||
|
||
## Load a background layer | ||
|
||
Though this is not strictly necessary, it is usually informative to | ||
view the keypoints overlaid on a background that provides | ||
some spatial context. You can either [load the video](target-load-video) | ||
corresponding to the poses dataset, or a [single image](target-load-frame), | ||
e.g., a still frame derived from that video. | ||
You can do this by dragging and dropping the corresponding file onto the | ||
`napari` window or by using the `File > Open File(s)` menu option. | ||
Please read the following sections for detailed information | ||
and some important considerations. | ||
|
||
(target-load-video)= | ||
### Load a video | ||
|
||
When trying to load a video file into `napari`, you will be prompted | ||
via a pop-up dialog to select the reader. | ||
Choose the `video` reader—corresponding to the | ||
[`napari-video`](https://github.com/janclemenslab/napari-video) | ||
plugin—and click `OK`. You can optionally select to remember this reader | ||
for all files with the same extension. | ||
|
||
`napari-video` will load the video as an image stack with a slider | ||
at the bottom that you can use to navigate through frames. | ||
You may also use the left and right arrow keys to navigate | ||
frame-by-frame. | ||
|
||
Clicking on the play button will start the video playback at a default | ||
rate of 10 frames per second. You can adjust that by right-clicking on the | ||
play button or by opening the `napari > Preferences` menu | ||
(`File > Preferences` on Windows) and changing | ||
the `Playback frames per second` setting. | ||
|
||
(target-video-playback-limitations)= | ||
:::{admonition} Video playback limitations | ||
:class: warning | ||
|
||
- The video playback may freeze or stutter if you click on the slider to jump | ||
to a specific frame. We recommended pausing the playback before such jumps. | ||
- `napari-video` may struggle to play videos at a high frame rate, depending | ||
on your hardware, the video resolution and codec. If you experience | ||
performance issues, such as the video freezing or skipping frames, | ||
try reducing the playback frames per second or fall back to | ||
using a [single image](target-load-frame) as a background. | ||
::: | ||
|
||
|
||
(target-load-frame)= | ||
### Load an image | ||
|
||
This usually means using a still frame extracted from the video, but in theory | ||
you could use any image that's in the same coordinate system as the | ||
tracking data. For example, you could use a schematic diagram of the arena, | ||
as long as it has the same width and height as the video and is | ||
properly aligned with the tracking data. | ||
|
||
::: {dropdown} Extracting a still frame from a video | ||
:color: info | ||
:icon: info | ||
|
||
You can use the command line tool [`ffmpeg`](https://www.ffmpeg.org/) | ||
to extract a still frame from a video. | ||
|
||
To extract the first frame of a video: | ||
|
||
```sh | ||
ffmpeg -i video.mp4 -frames:v 1 first-frame.png | ||
``` | ||
|
||
To extract a frame at a specific time stamp (e.g. at 2 seconds): | ||
|
||
```sh | ||
ffmpeg -i video.mp4 -ss 00:00:02 -frames:v 1 frame-2sec.png | ||
``` | ||
::: | ||
|
||
Dragging and dropping the image file onto the `napari` window | ||
(or opening it via the `File` menu) will load the image | ||
as a single 2D frame without a slider. | ||
|
||
## Load the poses dataset | ||
|
||
Now you are ready to load some pose tracks over your chosen background layer. | ||
|
||
On the right-hand side of the window you should see | ||
an expanded `Load poses` menu. To load pose data in napari: | ||
1. Select the `source software` from the dropdown menu. | ||
2. Set the `fps` (frames per second) of the video the pose data refers to. Note this will only affect the units of the time variable shown when hovering over a keypoint. If the `fps` is not known, you can set it to 1, which will effectively make the time variable equal to the frame number. | ||
3. Select the file containing the predicted poses. The path can be directly pasted or you can use the file browser button. | ||
4. Click `Load`. | ||
|
||
The data should be loaded into the viewer as a | ||
[points layer](napari:howtos/layers/points.html). | ||
By default, it is added at the top of the layer list. | ||
|
||
::: {note} | ||
See [supported formats](target-supported-formats) for more information on | ||
the expected software and file formats. | ||
::: | ||
|
||
|
||
You will see a view similar to the one below: | ||
|
||
(target-widget-screenshot)= | ||
|
||
 | ||
|
||
The keypoints are represented as points, colour-coded by | ||
keypoint ID for single-individual datasets, or by individual ID for | ||
multi-individual datasets. These IDs can be also displayed as text | ||
next to the points by enabling the `display text` option from the | ||
layer controls panel. | ||
|
||
Hovering with your mouse over a point | ||
(with the points layer selected) will | ||
bring up a tooltip containing the names of the individual and keypoint, | ||
the point-wise confidence score (provided by the source software), | ||
and the time in seconds (calculated based on the frame number and | ||
the `fps` value you provided). | ||
|
||
Using the slider at the bottom of the window, you can move through | ||
the frames of the dataset, and the points and video will update | ||
in sync. | ||
|
||
::: {admonition} Stay tuned | ||
Though the display style of the points layer is currently fixed, we are | ||
working on adding more customisation options in future releases, such as | ||
enabling you to change the point size, colour, or shape. | ||
|
||
We are also working on enabling the visualisation of | ||
[bounding boxes datasets](target-poses-and-bboxes-dataset) in the plugin. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wdyt about adding a link to issues tagged with the GUI and BUG labels here so that we can merge this docs PR and investigate the issues in another? @sfmig @niksirbi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. This would also avoid the branching-on-branches mess we are in right now.
I propose the following course of action:
brainglobe-utils
withqt-niu
#441 intonapari-dev
(@lochhh will do this)napari-dev
branch to make sure it's in-sync with main (I will do this)napari-dev
napari-dev
to main.What do y'all think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah excellent idea, thanks for suggesting @lochhh and for planning @niksirbi 🚀
I can continue to inspect this further and report any findings in issue #446
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, although I'd prefer merging napari-dev to main sooner rather than waiting for all bugs to be fixed - we'll always discover more 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also go for merging
napari-dev
tomain
before fixing the bug, which would be the bolder choice (meaning that we risk including a buggy plugin in the next release), but would make our dev processes easier.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote my last message before reading your replies, sounds like we all agree, I will start the untangling now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bold it is!