-
Notifications
You must be signed in to change notification settings - Fork 50
Improve open image section #907
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@guiwitz this is BEAUTIFUL. Gorgeous, fantastic, amazing, well written, and inspiring. You clearly spent a ton of time on this and I'm absolutely LOVING this contribution. I don't have too many comments because I really like the organization and flow.
Also... Holy smokes @guiwitz I actually had a panic attack. 😱 Have you actually tried ndevio? It's certainly mature enough that I share it with folks, but to put it in here like this is both an honor and so intimidating. I am a big believer in it, so getting eyes on it would be great lol. I guess the main flaw with it is that it's pypi only at the moment. It looks like I'd be able to add it to conda-forge with bioio-ome-tiff and bioio-ome-zarr (and the option for bioio-lif) which would at least be a start! I will work on it this week (regardless!). Unfortunately, I don't know of another "catch-all" reader that works with modern napari, so that might be the one to go with.
Would be good to get feedback from others.
Also, this might be a good file to mention https://github.com/napari/napari-tiff . I havne't worked on this much, so hopefully others can describe its value better than I can.
I added dependencies to
pixi.toml, but being a complete beginner with it, someone should check if that's correct (especially given the multiple sections with dependencies). Also those dependencies might be missing when not using pixi?
For this, we have the unfortunate problem that we would need to add the dependencies to napari's pyproject -- the full build workflow on CI will fail right now (if we trigger it with the bot). https://github.com/napari/napari/blob/326d0144b22b7808cd16dfeb49c48590d94869d9/pyproject.toml#L276-L304
It's one of those complicated issues with how we have things organized, sadly.
But we can test with pixi though locally! i.e. pixi run docs-live. For some reason it seems like the code blocks aren't showing outputs, despite seeing C:\Users\timmo\Documents\GitHub\napari-docs\docs\getting_started/open_images.md: Executing notebook using local CWD [mystnb]... so I'll try to look into it
Good news too, the additional dependencies don't add too much, which is good and should be easily maintainable:
+ P aicspylibczi 3.3.1
+ P aiobotocore 3.1.0
+ P aioitertools 0.13.0
+ P bioio 3.2.0
+ P bioio-base 3.2.0
+ P bioio-czi 2.4.2
+ P bioio-imageio 1.3.0
+ P bioio-ome-tiff 1.4.0
+ P bioio-ome-zarr 3.2.1
+ P bioio-tifffile 1.3.0
+ P botocore 1.42.19
+ P cmake 4.2.1
+ P elementpath 5.1.0
+ P imagecodecs 2026.1.1
+ P jmespath 1.0.1
+ P kerchunk 0.2.9
+ P macro-kit 0.4.10
+ P magic-class 0.7.20
+ P napari-meshio 0.0.2
+ P napari-skimage 0.6.0
+ P nbatch 0.0.4
+ P ndev-settings 0.4.0
+ P ndevio 0.7.0
+ P ome-types 0.6.3
+ P pydantic-extra-types 2.11.0
+ P pylibczirw 5.1.1
~ P pyqt5-sip 12.17.2 -> 12.18.0
+ P s3fs 2026.1.0
+ P semver 3.0.4
+ P ujson 5.11.0
+ P validators 0.35.0
+ P xmlschema 4.3.0
+ P xmltodict 1.0.2
+ P xsdata 25.7
| nbscreenshot(viewer, alt_text="napari viewer showing a multi-channel CZI image opened via ndevio of Ostrinia nubilalis cells.") | ||
| ``` | ||
|
|
||
| On top of just allowing to open file formats, some plugins also provide additional tools, for example to explore metadata, offer import options, etc. The ndevio plugin for example provides widgets to export data and explore basic metadata via the `Plugins -> ndevio -> I/O utilities` menu. Here we see that valuable information about pixel size was recovered from the czi file metadata: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we release napari-metadata, I think this would be a good spot to also expose metadata (and would be my preference). At that point, I will likely reduce my I/O Utilities widget to be much slimmer and prioritize napari-metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can also remove that section. But I find it useful to show that some readers offer more than just opening images. It's the case also e.g. for the napari-czitools (but I didn't want to have that plugin as a dependency).
| nbscreenshot(viewer, alt_text="napari viewer showing a multi-channel TIFF image of E. coli cells opened via ndevio.") | ||
| ``` | ||
|
|
||
| In the case of badly interpreted dimensions, one can also reshape the data using certain plugins. For example the [napari-skimage](https://napari-hub.org/plugins/napari-skimage.html) plugin provides a tool to reshape layers via the `Plugins -> napari skimage -> Axis operations` menu. Here we use the `swap axes` function to exchange the X and Y axes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be another spot we can refer to napari-metadata
Co-authored-by: Tim Monko <timmonko@gmail.com>
Co-authored-by: Tim Monko <timmonko@gmail.com>
Co-authored-by: Tim Monko <timmonko@gmail.com>
|
|
||
| For demo purpose, we will use a sample image that comes with napari. | ||
| ```{code-cell} ipython3 | ||
| :execution: {"timeout": 300} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, maybe this needs to be a string? The docs aren't making it obvious to me, where it looks like it doesn't need to be a string... https://myst-nb.readthedocs.io/en/latest/computation/execute.html#execution-timeout
I'm confused, but making it a string seemed to fix it locally... 🤷 I don't know why its not something like :tags: [execution_timeout = 300] I'm confused lol
| :execution: {"timeout": 300} | |
| :execution: {"timeout": "300"} |
I currently get this error...
Exception occurred:
File "C:\Users\timmo\Documents\GitHub\napari-docs\.pixi\envs\default\Lib\site-packages\nbformat\validator.py", line 509, in validate
raise error
nbformat.validator.NotebookValidationError: 300 is not of type 'string'
Failed validating 'type' in notebook['properties']['metadata']['properties']['execution']['patternProperties']['^.*$']:
On instance['metadata']['execution']['timeout']:
300
The full traceback has been saved in C:\Users\timmo\AppData\Local\Temp\sphinx-err-bny55o5w.log, if you want to report the issue to the developers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe it should be in the config at the top of the notebook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noted the same issue when trying to transforming the md file to notebook with jupytext complaining about that timeout, but I haven't figured out a solution yet. Will investigate more...
|
Regarding dependencies: is there an explanation anywhere on the "machinery" used to build docs? It's not clear to me why the dependencies have to be added to napari. |
|
I don't think there's anything beyond https://napari.org/stable/tutorials/fundamentals/installation.html#using-constraints-files . Unfortunately since we're using the two repos it's a bit convoluted, but this allows us to do
and have the docs dependencies follow the general constraints required for reliably building napari itself. |
DragaDoncila
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome @guiwitz 🤩 ! I left a couple of comments, but I think once we figure out the CI issues this is ready to go in. I mentioned to Tim earlier today that it would be great to expand a bit on the different File -> Open options (File, File(s), File(s) as stack, Folder...), but that should come in a separate PR imo.
Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>
Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>
Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>
Co-authored-by: Draga Doncila Pop <17995243+DragaDoncila@users.noreply.github.com>

References and relevant issues
Improving the section about images was discussed at the napari hackaton and in a more general PR about docs reorganisation.
Description
The PR expands and modernizes the previous version. The main improvement is a more detailed section about using reader plugins to import formats not natively supported by napari. In more details, the section now:
All the examples use downloadable data (from openmicroscopy and the BioImage Archive) and are generated, not screenshots. As discussed in #working-group-documentation > Capturing images, this implies that plugins are required to build the documentation. I added dependencies to
pixi.toml, but being a complete beginner with it, someone should check if that's correct (especially given the multiple sections with dependencies). Also those dependencies might be missing when not using pixi?