Skip to content

translate images through translate instead of grid#447

Merged
jo-mueller merged 3 commits intomainfrom
use-translate-to-distribute-bbbc07-images
Jul 6, 2025
Merged

translate images through translate instead of grid#447
jo-mueller merged 3 commits intomainfrom
use-translate-to-distribute-bbbc07-images

Conversation

@jo-mueller
Copy link
Collaborator

This PR uses thetranslate property to put images in a grid rather than the grid view. This makes the grid view nicer for napari>=0.6.2

cc #442

This pull request introduces enhancements to the bbbc_1_dataset function in the src/napari_clusters_plotter/_sample_data.py file, improving the organization of image data in a grid layout and adding new functionality for translating images and labels. Additionally, it includes a minor import update.

Enhancements to bbbc_1_dataset function:

  • Added logic to compute the number of rows (n_rows) and columns (n_cols) for arranging images in a grid layout. This improves the visual organization of the dataset.
  • Introduced translation calculations (translate_x and translate_y) to position images and labels within the grid, including a margin for spacing.
  • Updated the layer tuples (ldtuple_image and ldtuple_labels) to include the translate property, ensuring proper placement in the grid.
  • Removed viewer-specific grid settings (napari.current_viewer.grid.enabled and napari.current_viewer.grid.stride) to decouple the function from viewer-specific behavior.

Import update:

  • Added numpy (np) import to support mathematical operations such as ceil for grid layout calculations.

@jo-mueller jo-mueller added the bug Something isn't working label Jul 6, 2025
@jo-mueller jo-mueller merged commit d2c94fa into main Jul 6, 2025
17 checks passed
@jo-mueller jo-mueller deleted the use-translate-to-distribute-bbbc07-images branch July 6, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant