-
Notifications
You must be signed in to change notification settings - Fork 43
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
Providing micro-sam as napari plugin widgets #167
Comments
So far I have experimented with a plugin widget for the micro-sam 2D annotator.
|
Also including an error Constantin ran into (I have not seen the same error, but will keep an eye out for it now)
|
Hi @GenevieveBuckley, 1. Computing Image Embeddings and "raw" image layerWe add a new widget for the embedding computation. The user can just select an image layer that is used to precompute the embeddings (and optionally specify a path where the embeddings are cached). This will also solve #161 (because we get a progress bar "for free") and #17 as the name "raw" is not hard-coded anymore. 2. Other hard-coded layersFor the other hard-coded layers ( 3. Type annotations and magicfactoryMy current opinion is: we solve this via wrapper functions. We have the "actual" function that corresponds to the plugin and is decorated with 4. DevelopmentI would suggest to start with a PR that creates the plugin for the 2d annotation tool. Let's create the PR onto https://github.com/computational-cell-analytics/micro-sam/tree/dev, so that we can work on all the updates there and only merge into master once the plugins are all there, and the current functionality is adapted to the changes. Let me know what you think about these points and plan @GenevieveBuckley! (And please let me know if you disagree with any of the technical points or have a better plan!!) |
Response:
|
It's not hard-coded in many cases:
I think we can get rid of this without too much effort.
The global state for each annotator is defined in the first few lines of the
From what I understand from https://napari.org/stable/plugins/guides.html something along these is possible in the function that initializes the plugin: @magicfactory
def my_plugin() -> List[LayerTypes]:
...
return [prompt_layeer, box_prompt_layer, ...] and the viewer will create the corresponding layers, so that we can add these specific layers during plugin creation.
👍
Sorry, I wasn't quite clear. What I meant: the PRs should be for merging into (And I am happy to give you write access if you want, but I would want to stick with specific PRs onto dev, so we wouldn't really need it). |
One other thing I notice is that we want to make sure the path through the code doesn't include |
Good point. I think we can avoid this with the wrapper design (exemplified for the 2d annotation tool). @magicfactory
def annotator_2d_plugin(...) -> ...:
"""This function implements the core logic and is used to provide the plugin"""
def annotator_2d(image_data, ...):
"""This function can be called in python (or from CLI) to start the annotation tool"""
v = napari.Viewer()
v.add_image(image_data)
layers = annotator_2d_plugin(...)
for layer_data in layers:
v.add_layer(layer_data)
napari.run() |
A quick summary on what @GenevieveBuckley , @paulhfu and me discussed in a meeting this morning.
|
This has been addressed by #304. I have opened several follow-up issues to improve the plugin. |
I think we need a thread to discuss implementing napari plugin widgets for micro-sam.
This is follow up work to #165
The text was updated successfully, but these errors were encountered: