Skip to content
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

Grid Tiling #32

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Grid Tiling #32

wants to merge 1 commit into from

Conversation

gselzer
Copy link
Owner

@gselzer gselzer commented Sep 11, 2024

This PR enables a MDA containing a grid plan to present a tiled view within the viewer.

GridLayoutExample.mp4

It is a draft because it:

  1. Currently is only implemented for row/column grid plans.
  2. It subclasses TensorStoreHandler from pymmcore-plus, and overrides a private method TensorStoreHandler._event_index_to_store_index, which could be unstable long-term.
  3. Could be better suited as a contribution upstream (to where, I do not know), and could even share functionality with feat: 2 and 3d async chunked loading pyapp-kit/ndv#22 - opinions @marktsuchida @tlambert03?

@gselzer gselzer added the enhancement New feature or request label Sep 11, 2024
@gselzer gselzer self-assigned this Sep 11, 2024
@tlambert03
Copy link

this is a great feature, and something I agree needs to be implemented somewhere.

Am I correct in understanding that this requires grid members (individual images in a grid) to be shifted exactly a pixel size multiple? and creates a single "virtual" dataset containing all the images?
A an alternative, more general solution, would be to create a new texture for each item in the grid, and let opengl translate it on the canvas as needed based on the exact stage coordinates. (this would allow for subpixel relationships)

class GridPlanTensorStoreHandler(TensorStoreHandler):
def __init__(
self,
sequence: MDASequence,

Choose a reason for hiding this comment

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

i made a point of resisting passing a sequence to the handler constructor, with the idea being that handler should be able to deal with multiple sequences (we don't necessarily imply a 1-to-1 mapping of sequence-handler). You can access the currently running sequence via the public TensorStoreHandler.current_sequence (however, I'm realizing now that it's poorly implemented since it will be an attribute error prior to sequenceStarted being called).

@gselzer
Copy link
Owner Author

gselzer commented Sep 11, 2024

Am I correct in understanding that this requires grid members (individual images in a grid) to be shifted exactly a pixel size multiple? and creates a single "virtual" dataset containing all the images? A an alternative, more general solution, would be to create a new texture for each item in the grid, and let opengl translate it on the canvas as needed based on the exact stage coordinates. (this would allow for subpixel relationships)

Ideally, yes, however we'd need to make some API changes to NDViewer to enable the display of an arbitrary number of datasets, no?

@tlambert03
Copy link

correct, that would be a change to ndv

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.

2 participants