-
Notifications
You must be signed in to change notification settings - Fork 73
Use markdown and Jupyter notebooks in doc pages #548
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
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
87b8694
docs: Use jupyter notebooks and mystmd in doc pages
jo-mueller b37ffa0
docs: reorganize doc pages into separate jupyter notebook tutorials
jo-mueller 491ef9a
docs: Improve docstrings for API reference display
jo-mueller 3bc81a5
docs: ome-ngff -> ome-zarr
jo-mueller 21e6dcb
chore: rename folders
jo-mueller 7dc43b6
docs: add demo on how to open images
jo-mueller 9a7d26c
docs: fix reference
jo-mueller ad006cc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 857f4a7
chore: fix typo
jo-mueller 719147c
docs: move viewing up in TOC
jo-mueller a121117
docs: fix links and descriptions
jo-mueller 03d9edd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 02a124a
docs: fix cross-reference
jo-mueller 5b88bc0
Merge branch 'glow-up-docs' of https://github.com/jo-mueller/ome-zarr…
jo-mueller 2d9423b
docs: fix link target
jo-mueller b39a0c1
chore: typos and other minor fixes
jo-mueller 0b4bd60
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8c49daf
chore: fix broken link
jo-mueller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| format: jb-book | ||
| root: index | ||
|
|
||
| options: | ||
| numbered: False | ||
|
|
||
| parts: | ||
| - caption: Basic | ||
| chapters: | ||
| - file: basic/write_image | ||
| - file: basic/read_image | ||
| - file: basic/view_images | ||
| - file: basic/write_labels | ||
| - file: basic/cli_basics | ||
|
|
||
|
|
||
| - caption: Advanced | ||
| chapters: | ||
| - file: advanced/build_custom_pyramid | ||
| - file: advanced/write_hcs_plate | ||
|
|
||
| - caption: Explanation | ||
| chapters: | ||
| - file: explanation/ome_ngff_overview | ||
| - file: explanation/multiscale_pyramids | ||
| - file: explanation/zarr_concepts | ||
| - file: explanation/related_tools | ||
|
|
||
| - caption: API Reference | ||
| chapters: | ||
| - file: api | ||
| sections: | ||
| - file: api/writer | ||
| - file: api/reader | ||
| - file: api/io | ||
| - file: api/scale | ||
| - file: api/format | ||
| - file: api/cli | ||
| - file: api/utils | ||
| - file: api/csv | ||
| - file: api/data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "95d84769", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Customizing the pyramid\n", | ||
| "(howtos:pyramid)=\n", | ||
| "\n", | ||
| "\n", | ||
| "Multi-resolution pyramids are an integral part of ome-zarr image data\n", | ||
| "and enable fast rendering of large images.\n", | ||
| "The entrypoints to writing ome-zarr images in ome-zarr-py ({py:func}`ome_zarr.writer.write_image` and {py:func}`ome_zarr.writer.write_labels`)\n", | ||
| "build these pyramids under the hood as delayed dask arrays based on the settings for the scaling functions and scale factors.\n", | ||
| "\n", | ||
| "In this example, the downsampling will be applied in all spatial dimensions *except the z dimension*, which will be left at a scale factor of 1.\n", | ||
| "To apply equal or custom downsampling factors along all spatial dimensions, pass the scale factors as a list of dicts (see [below](#custom-downsampling-values))." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 16, | ||
| "id": "642955b1", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "[]" | ||
| ] | ||
| }, | ||
| "execution_count": 16, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "import numpy as np\n", | ||
| "\n", | ||
| "from ome_zarr.writer import write_image\n", | ||
| "\n", | ||
| "scale_factors = [2, 4, 8]\n", | ||
| "rng = np.random.default_rng(0)\n", | ||
| "data = rng.poisson(lam=10, size=(64, 64, 64)).astype(np.uint8)\n", | ||
| "\n", | ||
| "write_image(\n", | ||
| " data,\n", | ||
| " \"test_ngff_image.ome.zarr\",\n", | ||
| " axes=\"zyx\",\n", | ||
| " scale_factors=scale_factors,\n", | ||
| " )" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "cec0fc73", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Custom downsampling values\n", | ||
| "\n", | ||
| "To specify custom downsampling values, pass a list of dictionaries with the keys being the names of the axes to the writer function like in the following example.\n", | ||
| "This will apply equal downsampling factors along all present axes (`zyx` in this case):" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 17, | ||
| "id": "60dcd278", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "[]" | ||
| ] | ||
| }, | ||
| "execution_count": 17, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "scale_factors = [\n", | ||
| " {\"z\": 2,\"x\": 2, \"y\": 2},\n", | ||
| " {\"z\": 4,\"x\": 4, \"y\": 4},\n", | ||
| " {\"z\": 8,\"x\": 8, \"y\": 8},\n", | ||
| "]\n", | ||
| "\n", | ||
| "write_image(\n", | ||
| " data,\n", | ||
| " \"test_ngff_image_custom_scale.ome.zarr\",\n", | ||
| " axes=\"zyx\",\n", | ||
| " scale_factors=scale_factors,\n", | ||
| " )" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "6b276be7", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## Custom downsampling functions\n", | ||
| "\n", | ||
| "ome-zarr-py provides multiple methods for downsampling, which can be found in the {py:class}`ome_zarr.scale.Methods` class:" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 18, | ||
| "id": "877ab60d", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "name": "stdout", | ||
| "output_type": "stream", | ||
| "text": [ | ||
| "['resize', 'nearest', 'local_mean', 'zoom']\n" | ||
| ] | ||
| } | ||
| ], | ||
| "source": [ | ||
| "from ome_zarr.scale import Methods\n", | ||
| "\n", | ||
| "print([m.value for m in Methods])" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "9a086164", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "You can use one of these functions for downsampling by passing the method name as a string to the writer function, e.g. `method=\"mean\"` or `method=\"resize\"`, i.e.:" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 19, | ||
| "id": "859ca482", | ||
| "metadata": {}, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "[]" | ||
| ] | ||
| }, | ||
| "execution_count": 19, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "write_image(\n", | ||
| " data,\n", | ||
| " \"test_ngff_image_custom_method.ome.zarr\",\n", | ||
| " axes=\"zyx\",\n", | ||
| " scale_factors=scale_factors,\n", | ||
| " method=\"nearest\"\n", | ||
| ")\n" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "893a1b3b", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "```{warning}\n", | ||
| "\n", | ||
| "The choice of the correct downsampling function is typically of secondary importance,\n", | ||
| "*unless* your data spoeciufically requires a certain method.\n", | ||
|
jo-mueller marked this conversation as resolved.
Outdated
|
||
| "\n", | ||
| "For instance, when writing categorical data (i.e., segmentations or generally labels),\n", | ||
| "you will want to use a method that preserves the label values, such as {py:func}`ome_zarr.scale.Methods.NEAREST`.\n", | ||
| "\n", | ||
| "See also section on [writing labels](quickstart:labels)\n", | ||
| "\n", | ||
| "```" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "fbbeecf3", | ||
| "metadata": {}, | ||
| "source": [] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "ngff-spec", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.12.12" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.