Skip to content

allow mixed selections #422

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

Merged
merged 13 commits into from
Jun 7, 2025
Merged

allow mixed selections #422

merged 13 commits into from
Jun 7, 2025

Conversation

jo-mueller
Copy link
Collaborator

@jo-mueller jo-mueller commented Jun 4, 2025

Fixes #331

This PR makes some changes to how unsupported layers are treated upon selection. In essence, this PR changes this so that unsupported layers (e.g., Image) are simply ignored. Previously, if an unsupported layer type is encountered in the selectionn/drawing process, the functions return and aborts so that nothing can be drawn. With this PR, a the clusters-plotter functionality is simply executed on the layers that are supported while the others are ignored.

This can be especially helpful if layers arent't organized as stringently as in the bbbc1 example dataset, where all the labels are on top and all the images are on the bottom. I just learned, that the napari grid view provides the stride argument, which groups n layers together in a single grid tile, depending on the setting of the stride parameter. This saves ourselves the trouoble of setting translate values for the individual images in the bbbc1 dataset.

disregards unsupported layer types
@jo-mueller jo-mueller added the enhancement New feature or request label Jun 4, 2025
@jo-mueller jo-mueller requested review from zoccoler and Copilot June 5, 2025 14:16
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issue #331 by modifying the handling of unsupported layer selections so that only supported layers are used in the cluster plotter, while unsupported ones are simply ignored. Key changes include:

  • Removing individual coordinate calculations from the sample data and enabling the napari grid view.
  • Adjusting layer selection and filtering logic in the plotter widget to work with the new behavior.
  • Refactoring loops to iterate over the filtered self.layers instead of the complete layer selection.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/napari_clusters_plotter/_sample_data.py Removed translation calculations and enabled grid view setup
src/napari_clusters_plotter/_new_plotter_widget.py Updated layer selection filtering and iterated over supported layers
Comments suppressed due to low confidence (1)

src/napari_clusters_plotter/_new_plotter_widget.py:695

  • [nitpick] The condition double-checks layer support even though earlier filtering already restricts self.layers. Consider refactoring to minimize redundant type checking, which could simplify maintenance.
if (layer in self.viewer.layers and type(layer) in self.input_layer_types):

@zoccoler
Copy link
Collaborator

zoccoler commented Jun 6, 2025

This works for the plotter, but not when opening the other widgets, only after re-selecting layers:

06 06 2025_17 20 49_REC

@jo-mueller
Copy link
Collaborator Author

Probably a missing feature update command in the widget init 🤔

@jo-mueller
Copy link
Collaborator Author

Fixed in 4b293d9

@jo-mueller jo-mueller merged commit cb2269b into main Jun 7, 2025
16 checks passed
@jo-mueller jo-mueller deleted the allow-mixed-selections branch June 7, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Meta layer navigation widget?
2 participants