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

consider loading first scene by default in scene widget #34

Open
tlambert03 opened this issue Oct 3, 2021 · 12 comments
Open

consider loading first scene by default in scene widget #34

tlambert03 opened this issue Oct 3, 2021 · 12 comments

Comments

@tlambert03
Copy link
Contributor

I love the new scene widget... but the other day I found myself looking specifically for a file that didn't have scenes, so that I could at least have an image loaded. What you you think about loading the first scene by default, in addition to showing the widget to select additional scenes? This keeps the image-loading process to "one step" for the relatively common use case of starting with scene0.

cc @psobolewskiPhD @JacksonMaxfield

@psobolewskiPhD
Copy link
Collaborator

This should be still the case. The logic I added checked if (n_scenes >1). On my machine testing with some LIF, CZI and TIFF I only get the selection widget (and the extra option widget) when s>1.

@tlambert03
Copy link
Contributor Author

oh! it's possible i was using a stale branch. lemme check again

@psobolewskiPhD
Copy link
Collaborator

Here's the relevant code:

if len(img.scenes) > 1:
print(
f"AICSImageIO: Image contains {len(img.scenes)} scenes. "
f"Supporting more than the first scene is experimental. "
f"Select a scene from the list widget. There may be dragons!"
)
# Launch the list widget
_get_scenes(path=path, img=img, in_memory=in_memory)
# Return an empty LayerData list; ImgLayers will be handled via the widget.
# HT Jonas Windhager
return [(None,)]
else:
data = _get_full_image_data(img, in_memory=in_memory)
meta = _get_meta(data, img)
return [(data.data, meta, "image")]

@tlambert03
Copy link
Contributor Author

right, but after return [(None,)] ... where is the logic in _get_scenes that adds scene 0 to the viewer? I don't see it... and here's what I'm seeing locally (need to click on a scene to load it):

Untitled.mov

sample file: https://www.dropbox.com/s/w8bgza0g96swwza/dims_p4z5t3c2y32x32-tile2x3.nd2?dl=0

@tlambert03
Copy link
Contributor Author

tlambert03 commented Oct 3, 2021

oh, sorry, I reread your comment. I think you might have misunderstood my goal here. I'm proposing to load scene0 by default when n_scenes >1. not just to load the widget.

@psobolewskiPhD
Copy link
Collaborator

I'm ok with loading scene[0] automatically for multi-scene files, though for my use case I'd prefer this not to be the case (first few scenes are typically various staining controls I rarely want to analyze in napari). This could be an option perhaps? (Not sure the current checkbox approach is stored between sessions...)
For sure for single-scene files the single scene should be automatically loaded—can you confirm this works with your nd2?

@tlambert03
Copy link
Contributor Author

For sure for single-scene files the single scene should be automatically loaded

yeah, that's definitely the case, that's why I was saying in the first post "I found myself looking specifically for a file that didn't have scenes, so that I could at least have an image loaded".

it's ok if you'd rather not have it load. just a thought. perhaps an option someday... but low priority

@psobolewskiPhD
Copy link
Collaborator

Oh derp, I understood that that combined with the next sentence that the scene it didn't load. Sorry!
I would rather it not load, but I can understand it as a reasonable default 😄

@tlambert03
Copy link
Contributor Author

current behavior is like bioformats in Fiji, where one has to do an additional step if scenes are detected... so there's certainly precedent for your preference! let's leave it as default, and if I care enough someday I'll make it configurable :)

@psobolewskiPhD
Copy link
Collaborator

BTW: Is there some thought to napari providing/storing plugin preferences, so such behavior could be configured and stored between sessions?

@tlambert03
Copy link
Contributor Author

yep, will come with the new manifest as a "configuration" contribution here. Will roughly follow the vscode spec described here.

In the meantime, plugins would have to do their own persistence. (magicgui helps with that sort of thing using the persist parameter to @magicgui https://napari.org/magicgui/api/magicgui.html)

@evamaxfield
Copy link
Collaborator

I tend to agree that we should just default to scene 0 on load. It would be great to have all the parameters persist and I would argue that we split this issue up into two issues / PRs. (This also helps down the line because I want to add parameters for "load lazy vs load in-memory" and having that parameter persist would be amazing.)

  1. adds persistance to parameters
  2. adds toggle for scene 0 loading. ("Load Scene 0 on File Selection" or similar naming)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants