-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update to napari-yaml plugin definition #45
Comments
This message was generated by git-bob (version: 0.14.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. To address the issue of updating the repository to use napari's YAML plugin definition instead of the Here's an example conversion of a function in Given function: @register_function(menu="Segmentation post-processing > Split touching objects (nsbatwm)")
def split_touching_objects(binary: "napari.types.LabelsData", sigma: float = 3.5) -> "napari.types.LabelsData":
... Converted to YAML: contributions:
commands:
- id: nsbatwm.split_touching_objects
title: Split touching objects
python_name: napari_segment_blobs_and_things_with_membranes.split_touching_objects
menus:
napari/layers/context:
- command: nsbatwm.split_touching_objects This conversion needs to be done for each function registered with The conversion involves:
Would you like a detailed list of all function registrations into the YAML format, or are there specific functions you need help with? |
git-bob answer with the complete list of all functions in the yaml format. |
This message was generated by git-bob (version: 0.14.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. To address the request from @haesleinhuepf, here is a complete list of all functions in the specified contributions:
commands:
- id: nsbatwm.split_touching_objects
title: Split touching objects
python_name: napari_segment_blobs_and_things_with_membranes.split_touching_objects
- id: nsbatwm.threshold_otsu
title: Threshold (Otsu et al 1979)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_otsu
- id: nsbatwm.threshold_yen
title: Threshold (Yen et al 1995)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_yen
- id: nsbatwm.threshold_isodata
title: Threshold (Isodata)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_isodata
- id: nsbatwm.threshold_li
title: Threshold (Li et al 1993)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_li
- id: nsbatwm.threshold_mean
title: Threshold (Mean)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_mean
- id: nsbatwm.threshold_minimum
title: Threshold (Minimum)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_minimum
- id: nsbatwm.threshold_triangle
title: Threshold (Triangle method)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_triangle
- id: nsbatwm.gaussian_blur
title: Gaussian Blur
python_name: napari_segment_blobs_and_things_with_membranes.gaussian_blur
- id: nsbatwm.subtract_background
title: Subtract Background (Rolling Ball)
python_name: napari_segment_blobs_and_things_with_membranes.subtract_background
- id: nsbatwm.connected_component_labeling
title: Connected Component Labeling
python_name: napari_segment_blobs_and_things_with_membranes.connected_component_labeling
- id: nsbatwm.seeded_watershed
title: Seeded Watershed
python_name: napari_segment_blobs_and_things_with_membranes.seeded_watershed
- id: nsbatwm.voronoi_otsu_labeling
title: Voronoi-Otsu Labeling
python_name: napari_segment_blobs_and_things_with_membranes.voronoi_otsu_labeling
- id: nsbatwm.median_filter
title: Median Filter
python_name: napari_segment_blobs_and_things_with_membranes.median_filter
- id: nsbatwm.mode_filter
title: Mode Filter
python_name: napari_segment_blobs_and_things_with_membranes.mode_filter
- id: nsbatwm.percentile_filter
title: Percentile Filter
python_name: napari_segment_blobs_and_things_with_membranes.percentile_filter
- id: nsbatwm.white_tophat
title: White Top-hat Filter
python_name: napari_segment_blobs_and_things_with_membranes.white_tophat
- id: nsbatwm.minimum_filter
title: Minimum Filter
python_name: napari_segment_blobs_and_things_with_membranes.minimum_filter
- id: nsbatwm.skeletonize
title: Skeletonize
python_name: napari_segment_blobs_and_things_with_membranes.skeletonize
- id: nsbatwm.remove_labels_on_edges
title: Remove Labels on Edges
python_name: napari_segment_blobs_and_things_with_membranes.remove_labels_on_edges
- id: nsbatwm.expand_labels
title: Expand Labels
python_name: napari_segment_blobs_and_things_with_membranes.expand_labels
- id: nsbatwm.local_minima_seeded_watershed
title: Local Minima Seeded Watershed
python_name: napari_segment_blobs_and_things_with_membranes.local_minima_seeded_watershed
menus:
napari/layers/context:
- command: nsbatwm.split_touching_objects
- command: nsbatwm.threshold_otsu
- command: nsbatwm.threshold_yen
- command: nsbatwm.threshold_isodata
- command: nsbatwm.threshold_li
- command: nsbatwm.threshold_mean
- command: nsbatwm.threshold_minimum
- command: nsbatwm.threshold_triangle
- command: nsbatwm.gaussian_blur
- command: nsbatwm.subtract_background
- command: nsbatwm.connected_component_labeling
- command: nsbatwm.seeded_watershed
- command: nsbatwm.voronoi_otsu_labeling
- command: nsbatwm.median_filter
- command: nsbatwm.mode_filter
- command: nsbatwm.percentile_filter
- command: nsbatwm.white_tophat
- command: nsbatwm.minimum_filter
- command: nsbatwm.skeletonize
- command: nsbatwm.remove_labels_on_edges
- command: nsbatwm.expand_labels
- command: nsbatwm.local_minima_seeded_watershed This YAML follows the napari syntax for defining plugin contributions. You can proceed to create and integrate this |
Ok, currently the menu items are all in the same menu |
They are listed in the NAP here: Actually the context menu itself is not yet contributable, sorry about that 😅 The correct syntax is
for each of the listed contributable menus:
So, two examples:
If your item doesn't fit in any of the boxes, see: |
git-bob think about how to revise the napari.yaml content you proposed above. Put every menu entry into a menu of the list @jni gave us. |
This message was generated by git-bob (version: 0.14.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. To revise the contributions:
commands:
- id: nsbatwm.split_touching_objects
title: Split touching objects
python_name: napari_segment_blobs_and_things_with_membranes.split_touching_objects
- id: nsbatwm.threshold_otsu
title: Threshold (Otsu et al 1979)
python_name: napari_segment_blobs_and_things_with_membranes.threshold_otsu
# Add commands for all functions...
menus:
napari/layers/segment:
- command: nsbatwm.split_touching_objects
- command: nsbatwm.threshold_otsu
# Add further segmentation-related menu items here...
napari/layers/filter:
- command: nsbatwm.gaussian_blur
# Include filtering-related menu items here...
napari/layers/annotate:
- command: nsbatwm.mode_filter
# Include annotation-related menu items here...
napari/layers/background_removal:
- command: nsbatwm.subtract_background
# Include background removal-related items here...
napari/layers/transform:
- command: nsbatwm.rescale
# Include transform-related items here...
napari/layers/utilities:
- command: nsbatwm.extract_slice
# Include utility functions here...
# Add other menus and corresponding commands as necessary. This categorization aligns with the defined structure from the provided list, ensuring the menu items are semantically organized and intuitive for users. Each function from your |
Ok cool. git-bob implement this and make sure all |
Ok, let's try this again. Do not modify git-bob implement this |
Note that |
# References and relevant issues haesleinhuepf/napari-segment-blobs-and-things-with-membranes#45 (comment) While working on a PR with a plugin developer to update their plugin to use NAP-6, it became clear that starting with the non-contributable layer context menu at the very top of the NAP is very user-unfriendly. 😅 # Description In this PR, I remove mentions of the layer context menu and instead replace the first example in the NAP with one that works. --------- Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
git-bob think about how to update the code in this repository to make use of napari's yml plugin definition. You find the documentation for this file format under the headline "npe2 contributions" here: https://github.com/napari/docs/blob/main/docs/plugins/advanced_topics/npe2_migration_guide.md and here: https://github.com/napari/docs/blob/142ac9a29857a5db5fcc5c3960c3d4b2c1c83073/docs/naps/6-contributable-menus.md
We basically need to convert all
@register_function(menu="My menu")
decorations in init.py into the mentioned yaml format, e.g.:The text was updated successfully, but these errors were encountered: