ngio 0.1.5__tar.gz → 0.2.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. {ngio-0.1.5 → ngio-0.2.0a1}/.github/workflows/build_docs.yml +1 -12
  2. {ngio-0.1.5 → ngio-0.2.0a1}/.github/workflows/ci.yml +6 -27
  3. {ngio-0.1.5 → ngio-0.2.0a1}/.gitignore +10 -2
  4. {ngio-0.1.5 → ngio-0.2.0a1}/.pre-commit-config.yaml +1 -1
  5. {ngio-0.1.5 → ngio-0.2.0a1}/PKG-INFO +19 -39
  6. {ngio-0.1.5 → ngio-0.2.0a1}/docs/notebooks/basic_usage.ipynb +52 -57
  7. {ngio-0.1.5 → ngio-0.2.0a1}/docs/notebooks/image.ipynb +38 -18
  8. {ngio-0.1.5 → ngio-0.2.0a1}/docs/notebooks/processing.ipynb +21 -16
  9. {ngio-0.1.5 → ngio-0.2.0a1}/pyproject.toml +61 -52
  10. ngio-0.2.0a1/src/ngio/__init__.py +41 -0
  11. ngio-0.2.0a1/src/ngio/common/__init__.py +44 -0
  12. ngio-0.2.0a1/src/ngio/common/_array_pipe.py +160 -0
  13. ngio-0.2.0a1/src/ngio/common/_axes_transforms.py +63 -0
  14. ngio-0.2.0a1/src/ngio/common/_common_types.py +5 -0
  15. ngio-0.2.0a1/src/ngio/common/_dimensions.py +113 -0
  16. ngio-0.2.0a1/src/ngio/common/_pyramid.py +222 -0
  17. ngio-0.1.5/src/ngio/core/roi.py → ngio-0.2.0a1/src/ngio/common/_roi.py +22 -23
  18. ngio-0.2.0a1/src/ngio/common/_slicer.py +97 -0
  19. ngio-0.1.5/src/ngio/pipes/_zoom_utils.py → ngio-0.2.0a1/src/ngio/common/_zoom.py +46 -80
  20. ngio-0.2.0a1/src/ngio/hcs/__init__.py +60 -0
  21. ngio-0.2.0a1/src/ngio/images/__init__.py +23 -0
  22. ngio-0.2.0a1/src/ngio/images/abstract_image.py +240 -0
  23. ngio-0.2.0a1/src/ngio/images/create.py +251 -0
  24. ngio-0.2.0a1/src/ngio/images/image.py +383 -0
  25. ngio-0.2.0a1/src/ngio/images/label.py +96 -0
  26. ngio-0.2.0a1/src/ngio/images/omezarr_container.py +512 -0
  27. ngio-0.2.0a1/src/ngio/ome_zarr_meta/__init__.py +35 -0
  28. ngio-0.2.0a1/src/ngio/ome_zarr_meta/_generic_handlers.py +320 -0
  29. ngio-0.2.0a1/src/ngio/ome_zarr_meta/_meta_handlers.py +142 -0
  30. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/__init__.py +63 -0
  31. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/_axes.py +481 -0
  32. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/_channels.py +378 -0
  33. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/_dataset.py +134 -0
  34. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py +5 -0
  35. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/_ngio_image.py +434 -0
  36. ngio-0.2.0a1/src/ngio/ome_zarr_meta/ngio_specs/_pixel_size.py +84 -0
  37. ngio-0.2.0a1/src/ngio/ome_zarr_meta/v04/__init__.py +11 -0
  38. ngio-0.2.0a1/src/ngio/ome_zarr_meta/v04/_meta_handlers.py +54 -0
  39. ngio-0.2.0a1/src/ngio/ome_zarr_meta/v04/_v04_spec_utils.py +412 -0
  40. ngio-0.2.0a1/src/ngio/tables/__init__.py +27 -0
  41. ngio-0.2.0a1/src/ngio/tables/_validators.py +192 -0
  42. ngio-0.2.0a1/src/ngio/tables/backends/__init__.py +8 -0
  43. ngio-0.2.0a1/src/ngio/tables/backends/_abstract_backend.py +71 -0
  44. ngio-0.2.0a1/src/ngio/tables/backends/_anndata_utils.py +194 -0
  45. ngio-0.2.0a1/src/ngio/tables/backends/_anndata_v1.py +75 -0
  46. ngio-0.2.0a1/src/ngio/tables/backends/_json_v1.py +56 -0
  47. ngio-0.2.0a1/src/ngio/tables/backends/_table_backends.py +102 -0
  48. ngio-0.2.0a1/src/ngio/tables/tables_container.py +300 -0
  49. ngio-0.2.0a1/src/ngio/tables/v1/__init__.py +8 -0
  50. ngio-0.2.0a1/src/ngio/tables/v1/_feature_table.py +161 -0
  51. ngio-0.2.0a1/src/ngio/tables/v1/_generic_table.py +118 -0
  52. ngio-0.2.0a1/src/ngio/tables/v1/_masking_roi_table.py +175 -0
  53. ngio-0.2.0a1/src/ngio/tables/v1/_roi_table.py +226 -0
  54. ngio-0.2.0a1/src/ngio/utils/__init__.py +43 -0
  55. ngio-0.2.0a1/src/ngio/utils/_datasets.py +51 -0
  56. {ngio-0.1.5 → ngio-0.2.0a1}/src/ngio/utils/_errors.py +10 -4
  57. ngio-0.2.0a1/src/ngio/utils/_zarr_utils.py +378 -0
  58. ngio-0.2.0a1/tests/conftest.py +11 -0
  59. ngio-0.2.0a1/tests/data/meta_v04/base_ome_zarr_image_meta.json +73 -0
  60. ngio-0.2.0a1/tests/data/meta_v04/base_ome_zarr_image_meta_wrong_axis_order.json +73 -0
  61. ngio-0.2.0a1/tests/data/meta_v04/base_ome_zarr_label_meta.json +50 -0
  62. ngio-0.2.0a1/tests/unit/common/test_dimensions.py +78 -0
  63. ngio-0.2.0a1/tests/unit/common/test_pyramid.py +27 -0
  64. ngio-0.2.0a1/tests/unit/common/test_roi.py +43 -0
  65. ngio-0.2.0a1/tests/unit/images/test_omezarr_container.py +95 -0
  66. ngio-0.2.0a1/tests/unit/tables/test_backends.py +197 -0
  67. ngio-0.2.0a1/tests/unit/tables/test_feature_table.py +24 -0
  68. ngio-0.2.0a1/tests/unit/tables/test_generic_table.py +24 -0
  69. ngio-0.2.0a1/tests/unit/tables/test_masking_roi_table_v1.py +60 -0
  70. ngio-0.2.0a1/tests/unit/tables/test_roi_table_v1.py +67 -0
  71. ngio-0.2.0a1/tests/unit/tables/test_table_group.py +9 -0
  72. ngio-0.2.0a1/tests/unit/tables/test_validators.py +53 -0
  73. ngio-0.2.0a1/tests/unit/test_ome_zarr_meta/test_image_handler.py +13 -0
  74. ngio-0.2.0a1/tests/unit/test_ome_zarr_meta/test_unit_ngio_specs.py +465 -0
  75. ngio-0.2.0a1/tests/unit/test_ome_zarr_meta/test_unit_v04_utils.py +41 -0
  76. ngio-0.2.0a1/tests/unit/utils/test_download_datasets.py +17 -0
  77. ngio-0.2.0a1/tests/unit/utils/test_zarr_utils.py +185 -0
  78. ngio-0.1.5/setup_data.sh +0 -9
  79. ngio-0.1.5/src/ngio/__init__.py +0 -15
  80. ngio-0.1.5/src/ngio/core/__init__.py +0 -7
  81. ngio-0.1.5/src/ngio/core/dimensions.py +0 -122
  82. ngio-0.1.5/src/ngio/core/image_handler.py +0 -228
  83. ngio-0.1.5/src/ngio/core/image_like_handler.py +0 -549
  84. ngio-0.1.5/src/ngio/core/label_handler.py +0 -410
  85. ngio-0.1.5/src/ngio/core/ngff_image.py +0 -387
  86. ngio-0.1.5/src/ngio/core/utils.py +0 -287
  87. ngio-0.1.5/src/ngio/io/__init__.py +0 -19
  88. ngio-0.1.5/src/ngio/io/_zarr.py +0 -88
  89. ngio-0.1.5/src/ngio/io/_zarr_array_utils.py +0 -0
  90. ngio-0.1.5/src/ngio/io/_zarr_group_utils.py +0 -61
  91. ngio-0.1.5/src/ngio/iterators/__init__.py +0 -1
  92. ngio-0.1.5/src/ngio/ngff_meta/__init__.py +0 -27
  93. ngio-0.1.5/src/ngio/ngff_meta/fractal_image_meta.py +0 -1267
  94. ngio-0.1.5/src/ngio/ngff_meta/meta_handler.py +0 -92
  95. ngio-0.1.5/src/ngio/ngff_meta/utils.py +0 -235
  96. ngio-0.1.5/src/ngio/ngff_meta/v04/__init__.py +0 -6
  97. ngio-0.1.5/src/ngio/ngff_meta/v04/specs.py +0 -158
  98. ngio-0.1.5/src/ngio/ngff_meta/v04/zarr_utils.py +0 -376
  99. ngio-0.1.5/src/ngio/pipes/__init__.py +0 -7
  100. ngio-0.1.5/src/ngio/pipes/_slicer_transforms.py +0 -176
  101. ngio-0.1.5/src/ngio/pipes/_transforms.py +0 -33
  102. ngio-0.1.5/src/ngio/pipes/data_pipe.py +0 -52
  103. ngio-0.1.5/src/ngio/tables/__init__.py +0 -11
  104. ngio-0.1.5/src/ngio/tables/_ad_reader.py +0 -80
  105. ngio-0.1.5/src/ngio/tables/_utils.py +0 -301
  106. ngio-0.1.5/src/ngio/tables/tables_group.py +0 -252
  107. ngio-0.1.5/src/ngio/tables/v1/__init__.py +0 -7
  108. ngio-0.1.5/src/ngio/tables/v1/_generic_table.py +0 -201
  109. ngio-0.1.5/src/ngio/tables/v1/feature_tables.py +0 -182
  110. ngio-0.1.5/src/ngio/tables/v1/masking_roi_tables.py +0 -243
  111. ngio-0.1.5/src/ngio/tables/v1/roi_tables.py +0 -285
  112. ngio-0.1.5/src/ngio/utils/__init__.py +0 -30
  113. ngio-0.1.5/src/ngio/utils/_common_types.py +0 -5
  114. ngio-0.1.5/src/ngio/utils/_pydantic_utils.py +0 -52
  115. ngio-0.1.5/tests/core/conftest.py +0 -50
  116. ngio-0.1.5/tests/core/test_image_handler.py +0 -31
  117. ngio-0.1.5/tests/core/test_image_like_handler.py +0 -74
  118. ngio-0.1.5/tests/core/test_label_handler.py +0 -30
  119. ngio-0.1.5/tests/core/test_ngff_image.py +0 -59
  120. ngio-0.1.5/tests/core/test_roi.py +0 -20
  121. ngio-0.1.5/tests/io/conftest.py +0 -66
  122. ngio-0.1.5/tests/io/test_zarr_group_utils.py +0 -28
  123. ngio-0.1.5/tests/ngff_meta/conftest.py +0 -44
  124. ngio-0.1.5/tests/ngff_meta/test_fractal_image_meta.py +0 -37
  125. ngio-0.1.5/tests/ngff_meta/test_pixel_size.py +0 -27
  126. ngio-0.1.5/tests/ngff_meta/test_utils.py +0 -121
  127. ngio-0.1.5/tests/ngff_meta/test_v04.py +0 -86
  128. ngio-0.1.5/tests/pipes/conftest.py +0 -46
  129. ngio-0.1.5/tests/pipes/test_zoom.py +0 -77
  130. ngio-0.1.5/tests/tables/conftest.py +0 -39
  131. ngio-0.1.5/tests/tables/test_table_conversion.py +0 -82
  132. ngio-0.1.5/tests/tables/test_table_group.py +0 -39
  133. ngio-0.1.5/tests/tables/test_v1_tables.py +0 -55
  134. ngio-0.1.5/tests/tables/test_validation.py +0 -53
  135. {ngio-0.1.5 → ngio-0.2.0a1}/.copier-answers.yml +0 -0
  136. {ngio-0.1.5 → ngio-0.2.0a1}/.gitattributes +0 -0
  137. {ngio-0.1.5 → ngio-0.2.0a1}/.github/ISSUE_TEMPLATE.md +0 -0
  138. {ngio-0.1.5 → ngio-0.2.0a1}/.github/TEST_FAIL_TEMPLATE.md +0 -0
  139. {ngio-0.1.5 → ngio-0.2.0a1}/.github/dependabot.yml +0 -0
  140. {ngio-0.1.5 → ngio-0.2.0a1}/LICENSE +0 -0
  141. {ngio-0.1.5 → ngio-0.2.0a1}/README.md +0 -0
  142. {ngio-0.1.5 → ngio-0.2.0a1}/_typos.toml +0 -0
  143. {ngio-0.1.5 → ngio-0.2.0a1}/docs/api/core.md +0 -0
  144. {ngio-0.1.5 → ngio-0.2.0a1}/docs/getting-started.md +0 -0
  145. {ngio-0.1.5 → ngio-0.2.0a1}/docs/index.md +0 -0
  146. {ngio-0.1.5 → ngio-0.2.0a1}/mkdocs.yml +0 -0
  147. {ngio-0.1.5 → ngio-0.2.0a1}/src/ngio/utils/_logger.py +0 -0
@@ -21,22 +21,11 @@ jobs:
21
21
  python-version: "3.13"
22
22
  cache-dependency-path: "pyproject.toml"
23
23
  cache: "pip"
24
-
25
- - name: Download Dataset from Zenodo
26
- run: |
27
- mkdir -p data
28
- wget -O data/dataset.zip https://zenodo.org/records/13305156/files/20200812-CardiomyocyteDifferentiation14-Cycle1.zarr.zip?download=1?
29
- unzip -o data/dataset.zip -d data
30
- - name: Download Dataset from Zenodo MIP
31
- run: |
32
- mkdir -p data
33
- wget -O data/dataset.zip https://zenodo.org/records/13305316/files/20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr.zip?download=1?
34
- unzip -o data/dataset.zip -d data
35
24
 
36
25
  - name: Install Dependencies
37
26
  run: |
38
27
  python -m pip install -U pip
39
- python -m pip install .[dev2]
28
+ python -m pip install .[dev]
40
29
  python -m pip install .[docs]
41
30
 
42
31
  - name: 📚 Build Docs
@@ -32,11 +32,14 @@ jobs:
32
32
  strategy:
33
33
  fail-fast: false
34
34
  matrix:
35
- python-version: ["3.10", "3.11", "3.12", "3.13"]
36
- # Skip Windows for now It's seems there are some issues with the
37
- # ZarrV3 on Windows
35
+ python-version: ["3.11", "3.12", "3.13"]
38
36
  platform: [ubuntu-latest, macos-latest, windows-latest]
39
37
  # platform: [ubuntu-latest, macos-latest]
38
+ exclude:
39
+ - python-version: "3.11"
40
+ platform: windows-latest
41
+ - python-version: "3.12"
42
+ platform: windows-latest
40
43
 
41
44
  steps:
42
45
  - uses: actions/checkout@v4
@@ -78,30 +81,6 @@ jobs:
78
81
  token: ${{ secrets.CODECOV_TOKEN }}
79
82
  files: /home/runner/work/ngio/ngio/coverage.xml
80
83
 
81
- zarrv3:
82
- name: Test zarr-python v3 compatibility
83
- runs-on: ubuntu-latest
84
-
85
- steps:
86
- - uses: actions/checkout@v4
87
-
88
- - name: 🐍 Set up Python
89
- uses: actions/setup-python@v5
90
- with:
91
- python-version: "3.11"
92
- cache-dependency-path: "pyproject.toml"
93
- cache: "pip"
94
-
95
- - name: Install Dependencies
96
- run: |
97
- python -m pip install -U pip
98
- # if running a cron job, we add the --pre flag to test against pre-releases
99
- python -m pip install .[dev3] ${{ github.event_name == 'schedule' && '--pre' || '' }}
100
-
101
- - name: 🧪 Run Tests
102
- run: pytest
103
- continue-on-error: true
104
-
105
84
  deploy:
106
85
  name: Deploy
107
86
  needs: test
@@ -119,5 +119,13 @@ pixi.lock
119
119
  *.zarr
120
120
 
121
121
  # ignore data directory
122
- data/
123
- *.zip
122
+ ./data/
123
+ *.zip
124
+
125
+ src/ngio/_v01
126
+ tests/_v01
127
+
128
+ # Ignore locks
129
+ *.lock
130
+
131
+ benchmark/*
@@ -21,7 +21,7 @@ repos:
21
21
  args: [--force-exclude, --write-changes]
22
22
 
23
23
  - repo: https://github.com/charliermarsh/ruff-pre-commit
24
- rev: v0.4.8
24
+ rev: v0.9.6
25
25
  hooks:
26
26
  - id: ruff
27
27
  args: [--fix] # may also add '--unsafe-fixes'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngio
3
- Version: 0.1.5
3
+ Version: 0.2.0a1
4
4
  Summary: Next Generation file format IO
5
5
  Project-URL: homepage, https://github.com/lorenzocerrone/ngio
6
6
  Project-URL: repository, https://github.com/lorenzocerrone/ngio
@@ -10,53 +10,34 @@ License-File: LICENSE
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: License :: OSI Approved :: BSD License
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Typing :: Typed
17
- Requires-Python: >=3.10
17
+ Requires-Python: <3.14,>=3.11
18
18
  Requires-Dist: aiohttp
19
19
  Requires-Dist: anndata>=0.8.0
20
20
  Requires-Dist: dask[array]
21
+ Requires-Dist: dask[distributed]
22
+ Requires-Dist: filelock
21
23
  Requires-Dist: numpy
24
+ Requires-Dist: ome-zarr-models
22
25
  Requires-Dist: pandas>=1.2.0
26
+ Requires-Dist: pooch
23
27
  Requires-Dist: pydantic
24
28
  Requires-Dist: requests
25
- Provides-Extra: core
26
- Requires-Dist: dask-image; extra == 'core'
27
- Requires-Dist: dask[distributed]; extra == 'core'
28
- Requires-Dist: zarr<3; extra == 'core'
29
- Provides-Extra: dev2
30
- Requires-Dist: dask-image; extra == 'dev2'
31
- Requires-Dist: dask[distributed]; extra == 'dev2'
32
- Requires-Dist: ipython; extra == 'dev2'
33
- Requires-Dist: matplotlib; extra == 'dev2'
34
- Requires-Dist: mypy; extra == 'dev2'
35
- Requires-Dist: napari; extra == 'dev2'
36
- Requires-Dist: notebook; extra == 'dev2'
37
- Requires-Dist: pdbpp; extra == 'dev2'
38
- Requires-Dist: plotly; extra == 'dev2'
39
- Requires-Dist: pre-commit; extra == 'dev2'
40
- Requires-Dist: pyqt5; extra == 'dev2'
41
- Requires-Dist: pytest; extra == 'dev2'
42
- Requires-Dist: pytest-cov; extra == 'dev2'
43
- Requires-Dist: rich; extra == 'dev2'
44
- Requires-Dist: ruff; extra == 'dev2'
45
- Requires-Dist: scikit-image; extra == 'dev2'
46
- Requires-Dist: zarr<3; extra == 'dev2'
47
- Provides-Extra: dev3
48
- Requires-Dist: dask-image; extra == 'dev3'
49
- Requires-Dist: dask[distributed]; extra == 'dev3'
50
- Requires-Dist: ipython; extra == 'dev3'
51
- Requires-Dist: mypy; extra == 'dev3'
52
- Requires-Dist: notebook; extra == 'dev3'
53
- Requires-Dist: pdbpp; extra == 'dev3'
54
- Requires-Dist: pre-commit; extra == 'dev3'
55
- Requires-Dist: pytest; extra == 'dev3'
56
- Requires-Dist: pytest-cov; extra == 'dev3'
57
- Requires-Dist: rich; extra == 'dev3'
58
- Requires-Dist: ruff; extra == 'dev3'
59
- Requires-Dist: zarr==v3.0.0-alpha.4; extra == 'dev3'
29
+ Requires-Dist: xarray
30
+ Requires-Dist: zarr<3
31
+ Provides-Extra: dev
32
+ Requires-Dist: matplotlib; extra == 'dev'
33
+ Requires-Dist: mypy; extra == 'dev'
34
+ Requires-Dist: napari; extra == 'dev'
35
+ Requires-Dist: notebook; extra == 'dev'
36
+ Requires-Dist: pdbpp; extra == 'dev'
37
+ Requires-Dist: pre-commit; extra == 'dev'
38
+ Requires-Dist: pyqt5; extra == 'dev'
39
+ Requires-Dist: rich; extra == 'dev'
40
+ Requires-Dist: ruff; extra == 'dev'
60
41
  Provides-Extra: docs
61
42
  Requires-Dist: mkdocs; extra == 'docs'
62
43
  Requires-Dist: mkdocs-autorefs; extra == 'docs'
@@ -69,7 +50,6 @@ Requires-Dist: scikit-image; extra == 'docs'
69
50
  Provides-Extra: test
70
51
  Requires-Dist: pytest; extra == 'test'
71
52
  Requires-Dist: pytest-cov; extra == 'test'
72
- Requires-Dist: zarr<3; extra == 'test'
73
53
  Description-Content-Type: text/markdown
74
54
 
75
55
  # NGIO - Next Generation file format IO
@@ -6,7 +6,7 @@
6
6
  "source": [
7
7
  "# OME-Zarr Image Exploration\n",
8
8
  "\n",
9
- "In this notebook we will show how to use the 'NgffImage' class to explore and manage an OME-NGFF image.\n",
9
+ "In this notebook we will show how to use the 'OmeZarr Container' class to explore and manage an OME-NGFF image.\n",
10
10
  "\n",
11
11
  "For this example we will use a small example image that can be downloaded from the following link: [example ome-zarr](https://zenodo.org/records/13305156)\n",
12
12
  "\n",
@@ -19,10 +19,10 @@
19
19
  "```\n",
20
20
  "from the root of the repository.\n",
21
21
  "\n",
22
- "## NgffImage\n",
22
+ "## OmeZarr Container\n",
23
23
  "\n",
24
- "The `NgffImage` provides a high-level interface to read, write and manipulate NGFF images.\n",
25
- "A `NgffImage` can be created from a storelike object (e.g. a path to a directory, or a url) or from a `zarr.Group` object. "
24
+ "The `OmeZarr Container` provides a high-level interface to read, write and manipulate NGFF images.\n",
25
+ "A `OmeZarr Container` can be created from a storelike object (e.g. a path to a directory, or a url) or from a `zarr.Group` object. "
26
26
  ]
27
27
  },
28
28
  {
@@ -31,11 +31,12 @@
31
31
  "metadata": {},
32
32
  "outputs": [],
33
33
  "source": [
34
- "from ngio.core import NgffImage\n",
34
+ "from ngio import open_omezarr_container\n",
35
+ "from ngio.utils import download_ome_zarr_dataset\n",
35
36
  "\n",
36
- "# Ngio can stream data from any fsspec-compatible store\n",
37
- "path = \"../../data/20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr/B/03/0\"\n",
38
- "ngff_image = NgffImage(path, \"r\")"
37
+ "hcs_path = download_ome_zarr_dataset(\"CardiomyocyteSmallMip\")\n",
38
+ "image_path = hcs_path / \"B\" / \"03\" / \"0\"\n",
39
+ "omezarr_container = open_omezarr_container(image_path)"
39
40
  ]
40
41
  },
41
42
  {
@@ -43,7 +44,7 @@
43
44
  "metadata": {},
44
45
  "source": [
45
46
  "\n",
46
- "The `ngff_image` object provides a high-level interface to read, write and manipulate OME-Zarr images.\n",
47
+ "The `omezarr_container` object provides a high-level interface to read, write and manipulate OME-Zarr images.\n",
47
48
  "\n",
48
49
  "Print the image will show some overview information like:\n",
49
50
  "* The path to the image\n",
@@ -58,14 +59,14 @@
58
59
  "metadata": {},
59
60
  "outputs": [],
60
61
  "source": [
61
- "print(ngff_image)"
62
+ "print(omezarr_container)"
62
63
  ]
63
64
  },
64
65
  {
65
66
  "cell_type": "markdown",
66
67
  "metadata": {},
67
68
  "source": [
68
- "From the `NgffImage` object we can easily access access the image data (at any resolution level), the labels and the tables."
69
+ "From the `OmeZarr Container` object we can easily access access the image data (at any resolution level), the labels and the tables."
69
70
  ]
70
71
  },
71
72
  {
@@ -83,18 +84,18 @@
83
84
  "metadata": {},
84
85
  "outputs": [],
85
86
  "source": [
86
- "from ngio.ngff_meta import PixelSize\n",
87
+ "from ngio import PixelSize\n",
87
88
  "\n",
88
89
  "# 1. Get image from highest resolution (default)\n",
89
- "image = ngff_image.get_image()\n",
90
+ "image = omezarr_container.get_image()\n",
90
91
  "print(image)\n",
91
92
  "\n",
92
93
  "# 2. Get image from a specific level using the path keyword\n",
93
- "image = ngff_image.get_image(path=\"1\")\n",
94
+ "image = omezarr_container.get_image(path=\"1\")\n",
94
95
  "print(image)\n",
95
96
  "\n",
96
97
  "# 3. Get image from a specific pixel size using the pixel_size keyword\n",
97
- "image = ngff_image.get_image(pixel_size=PixelSize(x=0.65, y=0.65, z=1))\n",
98
+ "image = omezarr_container.get_image(pixel_size=PixelSize(x=0.65, y=0.65, z=1))\n",
98
99
  "print(image)"
99
100
  ]
100
101
  },
@@ -112,7 +113,6 @@
112
113
  "outputs": [],
113
114
  "source": [
114
115
  "print(\"Shape\", image.shape)\n",
115
- "print(\"Axes\", image.axes_names)\n",
116
116
  "print(\"PixelSize\", image.pixel_size)\n",
117
117
  "print(\"Dimensions\", image.dimensions)\n",
118
118
  "print(\"Channel Names\", image.channel_labels)"
@@ -137,19 +137,7 @@
137
137
  "metadata": {},
138
138
  "source": [
139
139
  "`ngio` design is to always provide the data in a canonical axis order (`t`, `c`, `z`, `y`, `x`) no matter what is the order on disk. \n",
140
- "The `Image` object provides methods to access the data in this order. \n",
141
- "If you want to access data or metadata in the on-disk order, you can by using `on_disk_{method_name}` methods.\n"
142
- ]
143
- },
144
- {
145
- "cell_type": "code",
146
- "execution_count": null,
147
- "metadata": {},
148
- "outputs": [],
149
- "source": [
150
- "print(\"On-disk shape\", image.on_disk_shape)\n",
151
- "print(\"On-disk array\", image.on_disk_array)\n",
152
- "print(\"On-disk dask array\", image.on_disk_dask_array)"
140
+ "The `Image` object provides methods to access the data in this order. \n"
153
141
  ]
154
142
  },
155
143
  {
@@ -167,9 +155,9 @@
167
155
  "metadata": {},
168
156
  "outputs": [],
169
157
  "source": [
170
- "print(\"List of Labels: \", ngff_image.labels.list())\n",
158
+ "print(\"List of Labels: \", omezarr_container.list_labels())\n",
171
159
  "\n",
172
- "label_nuclei = ngff_image.labels.get_label(\"nuclei\", path=\"0\")\n",
160
+ "label_nuclei = omezarr_container.get_label(\"nuclei\", path=\"0\")\n",
173
161
  "print(label_nuclei)"
174
162
  ]
175
163
  },
@@ -193,10 +181,7 @@
193
181
  "metadata": {},
194
182
  "outputs": [],
195
183
  "source": [
196
- "print(\"List of Tables: \", ngff_image.tables.list())\n",
197
- "print(\" - Feature tables: \", ngff_image.tables.list(table_type='feature_table'))\n",
198
- "print(\" - Roi tables: \", ngff_image.tables.list(table_type='roi_table'))\n",
199
- "print(\" - Masking Roi tables: \", ngff_image.tables.list(table_type='masking_roi_table'))"
184
+ "print(\"List of Tables: \", omezarr_container.list_tables())"
200
185
  ]
201
186
  },
202
187
  {
@@ -206,8 +191,8 @@
206
191
  "outputs": [],
207
192
  "source": [
208
193
  "# Loading a table\n",
209
- "feature_table = ngff_image.tables.get_table(\"regionprops_DAPI\")\n",
210
- "feature_table.table"
194
+ "feature_table = omezarr_container.get_table(\"regionprops_DAPI\")\n",
195
+ "feature_table.dataframe"
211
196
  ]
212
197
  },
213
198
  {
@@ -217,12 +202,9 @@
217
202
  "outputs": [],
218
203
  "source": [
219
204
  "# Loading a roi table\n",
220
- "roi_table = ngff_image.tables.get_table(\"FOV_ROI_table\")\n",
205
+ "roi_table = omezarr_container.get_table(\"FOV_ROI_table\")\n",
221
206
  "\n",
222
- "print(f\"{roi_table.field_indexes=}\")\n",
223
- "print(f\"{roi_table.get_roi('FOV_1')=}\")\n",
224
- "\n",
225
- "roi_table.table"
207
+ "print(f\"{roi_table.get('FOV_1')=}\")"
226
208
  ]
227
209
  },
228
210
  {
@@ -241,10 +223,10 @@
241
223
  "import matplotlib.pyplot as plt\n",
242
224
  "\n",
243
225
  "# Plotting a single ROI\n",
244
- "roi = roi_table.get_roi(\"FOV_1\")\n",
245
- "roi_data = image.get_array_from_roi(roi, c=0, mode=\"numpy\")\n",
226
+ "roi = roi_table.get(\"FOV_1\")\n",
227
+ "roi_data = image.get_roi(roi, c=0, mode=\"numpy\")\n",
246
228
  "plt.title(\"ROI: FOV_1\")\n",
247
- "plt.imshow(roi_data[0], cmap=\"gray\")\n",
229
+ "plt.imshow(roi_data[0, 0], cmap=\"gray\")\n",
248
230
  "plt.axis(\"off\")\n",
249
231
  "plt.show()"
250
232
  ]
@@ -267,17 +249,17 @@
267
249
  "metadata": {},
268
250
  "outputs": [],
269
251
  "source": [
270
- "new_ngff_image = ngff_image.derive_new_image(\"../../data/new_ome.zarr\", name=\"new_image\")\n",
271
- "print(new_ngff_image)"
252
+ "new_omezarr_image = omezarr_container.derive_image(\"data/new_ome.zarr\", overwrite=True)\n",
253
+ "print(new_omezarr_image)"
272
254
  ]
273
255
  },
274
256
  {
275
257
  "cell_type": "markdown",
276
258
  "metadata": {},
277
259
  "source": [
278
- "## Steam an NgffImage over HTTP\n",
260
+ "## Steam an OmeZarr over HTTP\n",
279
261
  "\n",
280
- "The `NgffImage` class can also be used to stream an image over HTTP. This is useful when the image is stored on a remote server and you want to access it without downloading the entire image. All features of the `NgffImage` class are available when streaming an image over HTTP (besides anything that requires writing to the image)."
262
+ "The `OmeZarr` class can also be used to stream an image over HTTP. This is useful when the image is stored on a remote server and you want to access it without downloading the entire image. All features of the `OmeZarr` class are available when streaming an image over HTTP (besides anything that requires writing to the image)."
281
263
  ]
282
264
  },
283
265
  {
@@ -286,20 +268,33 @@
286
268
  "metadata": {},
287
269
  "outputs": [],
288
270
  "source": [
289
- "from ngio.core.utils import get_fsspec_http_store\n",
271
+ "import fsspec.implementations.http\n",
272
+ "\n",
273
+ "url = (\n",
274
+ " \"https://raw.githubusercontent.com/\"\n",
275
+ " \"fractal-analytics-platform/fractal-ome-zarr-examples/\"\n",
276
+ " \"refs/heads/main/v04/\"\n",
277
+ " \"20200812-CardiomyocyteDifferentiation14-Cycle1_B_03_mip.zarr/\"\n",
278
+ ")\n",
290
279
  "\n",
291
- "# Ngio can stream data from any fsspec-compatible store\n",
292
- "url = \"https://raw.githubusercontent.com/fractal-analytics-platform/fractal-ome-zarr-examples/refs/heads/main/v04/20200812-CardiomyocyteDifferentiation14-Cycle1_B_03_mip.zarr/\"\n",
293
- "store = get_fsspec_http_store(url)\n",
294
- "ngff_image = NgffImage(store, \"r\")\n",
280
+ "fs = fsspec.implementations.http.HTTPFileSystem(client_kwargs={})\n",
281
+ "store = fs.get_mapper(url)\n",
295
282
  "\n",
296
- "print(ngff_image)"
283
+ "omezarr = open_omezarr_container(store)\n",
284
+ "omezarr"
297
285
  ]
286
+ },
287
+ {
288
+ "cell_type": "code",
289
+ "execution_count": null,
290
+ "metadata": {},
291
+ "outputs": [],
292
+ "source": []
298
293
  }
299
294
  ],
300
295
  "metadata": {
301
296
  "kernelspec": {
302
- "display_name": "ngio",
297
+ "display_name": "dev",
303
298
  "language": "python",
304
299
  "name": "python3"
305
300
  },
@@ -313,7 +308,7 @@
313
308
  "name": "python",
314
309
  "nbconvert_exporter": "python",
315
310
  "pygments_lexer": "ipython3",
316
- "version": "3.12.7"
311
+ "version": "3.11.11"
317
312
  }
318
313
  },
319
314
  "nbformat": 4,
@@ -18,8 +18,11 @@
18
18
  "import matplotlib.pyplot as plt\n",
19
19
  "\n",
20
20
  "from ngio.core.ngff_image import NgffImage\n",
21
+ "from ngio.utils import download_ome_zarr_dataset\n",
21
22
  "\n",
22
- "ngff_image = NgffImage(\"../../data/20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr/B/03/0\")"
23
+ "hcs_path = download_ome_zarr_dataset(\"CardiomyocyteSmallMip\")\n",
24
+ "image_path = hcs_path / \"B\" / \"03\" / \"0\"\n",
25
+ "ngff_image = NgffImage(image_path)"
23
26
  ]
24
27
  },
25
28
  {
@@ -88,7 +91,9 @@
88
91
  "metadata": {},
89
92
  "outputs": [],
90
93
  "source": [
91
- "image_numpy = image.get_array(c=0, x=slice(0, 250), y=slice(0, 250), preserve_dimensions=False, mode=\"numpy\")\n",
94
+ "image_numpy = image.get_array(\n",
95
+ " c=0, x=slice(0, 250), y=slice(0, 250), preserve_dimensions=False, mode=\"numpy\"\n",
96
+ ")\n",
92
97
  "\n",
93
98
  "print(f\"{image_numpy.shape=}\")"
94
99
  ]
@@ -112,7 +117,9 @@
112
117
  "roi = roi_table.get_roi(\"FOV_1\")\n",
113
118
  "print(f\"{roi=}\")\n",
114
119
  "\n",
115
- "image_roi_1 = image.get_array_from_roi(roi=roi, c=0, preserve_dimensions=True, mode=\"dask\")\n",
120
+ "image_roi_1 = image.get_array_from_roi(\n",
121
+ " roi=roi, c=0, preserve_dimensions=True, mode=\"dask\"\n",
122
+ ")\n",
116
123
  "image_roi_1"
117
124
  ]
118
125
  },
@@ -277,39 +284,52 @@
277
284
  "print(f\"List of feature table: {ngff_image.tables.list(table_type='feature_table')}\")\n",
278
285
  "\n",
279
286
  "\n",
280
- "nuclei = ngff_image.labels.get_label('nuclei')\n",
287
+ "nuclei = ngff_image.labels.get_label(\"nuclei\")\n",
281
288
  "\n",
282
289
  "# Create a table with random features for each nuclei in each ROI\n",
283
290
  "list_of_records = []\n",
284
291
  "for roi in roi_table.rois:\n",
285
- " nuclei_in_roi = nuclei.get_array_from_roi(roi, mode='numpy')\n",
292
+ " nuclei_in_roi = nuclei.get_array_from_roi(roi, mode=\"numpy\")\n",
286
293
  " for nuclei_id in np.unique(nuclei_in_roi)[1:]:\n",
287
294
  " list_of_records.append(\n",
288
- " {\"label\": nuclei_id,\n",
289
- " \"feat1\": np.random.rand(),\n",
290
- " \"feat2\": np.random.rand(),\n",
291
- " \"ROI\": roi.infos.get(\"FieldIndex\")}\n",
292
- " )\n",
295
+ " {\n",
296
+ " \"label\": nuclei_id,\n",
297
+ " \"feat1\": np.random.rand(),\n",
298
+ " \"feat2\": np.random.rand(),\n",
299
+ " \"ROI\": roi.infos.get(\"FieldIndex\"),\n",
300
+ " }\n",
301
+ " )\n",
293
302
  "\n",
294
303
  "feat_df = pd.DataFrame.from_records(list_of_records)\n",
295
304
  "\n",
296
305
  "# Create a new feature table\n",
297
- "feat_table = ngff_image.tables.new(name='new_feature_table',\n",
298
- " label_image='../nuclei',\n",
299
- " table_type='feature_table',\n",
300
- " overwrite=True)\n",
301
- "\n",
302
- "print(f\"New list of feature table: {ngff_image.tables.list(table_type='feature_table')}\")\n",
306
+ "feat_table = ngff_image.tables.new(\n",
307
+ " name=\"new_feature_table\",\n",
308
+ " label_image=\"../nuclei\",\n",
309
+ " table_type=\"feature_table\",\n",
310
+ " overwrite=True,\n",
311
+ ")\n",
312
+ "\n",
313
+ "print(\n",
314
+ " f\"New list of feature table: {ngff_image.tables.list(table_type='feature_table')}\"\n",
315
+ ")\n",
303
316
  "feat_table.set_table(feat_df)\n",
304
317
  "feat_table.consolidate()\n",
305
318
  "\n",
306
319
  "feat_table.table"
307
320
  ]
321
+ },
322
+ {
323
+ "cell_type": "code",
324
+ "execution_count": null,
325
+ "metadata": {},
326
+ "outputs": [],
327
+ "source": []
308
328
  }
309
329
  ],
310
330
  "metadata": {
311
331
  "kernelspec": {
312
- "display_name": "ngio",
332
+ "display_name": "dev",
313
333
  "language": "python",
314
334
  "name": "python3"
315
335
  },
@@ -323,7 +343,7 @@
323
343
  "name": "python",
324
344
  "nbconvert_exporter": "python",
325
345
  "pygments_lexer": "ipython3",
326
- "version": "3.12.7"
346
+ "version": "3.11.11"
327
347
  }
328
348
  },
329
349
  "nbformat": 4,
@@ -36,8 +36,11 @@
36
36
  "import matplotlib.pyplot as plt\n",
37
37
  "\n",
38
38
  "from ngio.core import NgffImage\n",
39
+ "from ngio.utils import download_ome_zarr_dataset\n",
39
40
  "\n",
40
- "ngff_image = NgffImage(\"../../data/20200812-CardiomyocyteDifferentiation14-Cycle1.zarr/B/03/0\")"
41
+ "hcs_path = download_ome_zarr_dataset(\"CardiomyocyteTiny\")\n",
42
+ "image_path = hcs_path / \"B\" / \"03\" / \"0\"\n",
43
+ "ngff_image = NgffImage(image_path)"
41
44
  ]
42
45
  },
43
46
  {
@@ -53,9 +56,11 @@
53
56
  "metadata": {},
54
57
  "outputs": [],
55
58
  "source": [
56
- "mip_ngff = ngff_image.derive_new_image(\"../../data/20200812-CardiomyocyteDifferentiation14-Cycle1.zarr/B/03/0_mip\",\n",
57
- " name=\"MIP\",\n",
58
- " on_disk_shape=(1, 1, 2160, 5120))"
59
+ "mip_ngff = ngff_image.derive_new_image(\n",
60
+ " \"data/20200812-CardiomyocyteDifferentiation14-Cycle1.zarr/B/03/0_mip\",\n",
61
+ " name=\"MIP\",\n",
62
+ " on_disk_shape=(1, 1, 2160, 5120),\n",
63
+ ")"
59
64
  ]
60
65
  },
61
66
  {
@@ -93,15 +98,15 @@
93
98
  " patch = source_image.get_array_from_roi(roi)\n",
94
99
  " mip_patch = patch.max(axis=1, keepdims=True)\n",
95
100
  " mip_image.set_array_from_roi(patch=mip_patch, roi=roi)\n",
96
- " \n",
101
+ "\n",
97
102
  "print(\"MIP image saved\")\n",
98
103
  "\n",
99
104
  "plt.figure(figsize=(5, 5))\n",
100
105
  "plt.title(\"Mip\")\n",
101
106
  "plt.imshow(mip_image.on_disk_array[0, 0, :, :], cmap=\"gray\")\n",
102
- "plt.axis('off')\n",
107
+ "plt.axis(\"off\")\n",
103
108
  "plt.tight_layout()\n",
104
- "plt.show()\n"
109
+ "plt.show()"
105
110
  ]
106
111
  },
107
112
  {
@@ -136,9 +141,9 @@
136
141
  "axs[1].set_title(\"After consolidation\")\n",
137
142
  "axs[1].imshow(image_after_consolidation, cmap=\"gray\")\n",
138
143
  "for ax in axs:\n",
139
- " ax.axis('off')\n",
144
+ " ax.axis(\"off\")\n",
140
145
  "plt.tight_layout()\n",
141
- "plt.show()\n"
146
+ "plt.show()"
142
147
  ]
143
148
  },
144
149
  {
@@ -162,7 +167,7 @@
162
167
  "roi_list = []\n",
163
168
  "for roi in roi_table.rois:\n",
164
169
  " print(f\" - Processing ROI {roi.infos.get('field_index')}\")\n",
165
- " roi.z_length = 1 # In the MIP image, the z dimension is 1\n",
170
+ " roi.z_length = 1 # In the MIP image, the z dimension is 1\n",
166
171
  " roi_list.append(roi)\n",
167
172
  "\n",
168
173
  "mip_roi_table.set_rois(roi_list, overwrite=True)\n",
@@ -198,7 +203,7 @@
198
203
  "rand_cmap = ListedColormap(rand_cmap)\n",
199
204
  "\n",
200
205
  "\n",
201
- "def otsu_threshold_segmentation(image: np.ndarray, max_label:int) -> np.ndarray:\n",
206
+ "def otsu_threshold_segmentation(image: np.ndarray, max_label: int) -> np.ndarray:\n",
202
207
  " \"\"\"Simple segmentation using Otsu thresholding.\"\"\"\n",
203
208
  " threshold = threshold_otsu(image)\n",
204
209
  " binary = image > threshold\n",
@@ -271,11 +276,11 @@
271
276
  "axs[0].set_title(\"MIP\")\n",
272
277
  "axs[0].imshow(source_image.on_disk_array[0, 0], cmap=\"gray\")\n",
273
278
  "axs[1].set_title(\"Nuclei segmentation\")\n",
274
- "axs[1].imshow(nuclei_image.on_disk_array[0], cmap=rand_cmap, interpolation='nearest')\n",
279
+ "axs[1].imshow(nuclei_image.on_disk_array[0], cmap=rand_cmap, interpolation=\"nearest\")\n",
275
280
  "for ax in axs:\n",
276
- " ax.axis('off')\n",
281
+ " ax.axis(\"off\")\n",
277
282
  "plt.tight_layout()\n",
278
- "plt.show()\n"
283
+ "plt.show()"
279
284
  ]
280
285
  },
281
286
  {
@@ -288,7 +293,7 @@
288
293
  ],
289
294
  "metadata": {
290
295
  "kernelspec": {
291
- "display_name": "dev2",
296
+ "display_name": "dev",
292
297
  "language": "python",
293
298
  "name": "python3"
294
299
  },
@@ -302,7 +307,7 @@
302
307
  "name": "python",
303
308
  "nbconvert_exporter": "python",
304
309
  "pygments_lexer": "ipython3",
305
- "version": "3.10.15"
310
+ "version": "3.11.11"
306
311
  }
307
312
  },
308
313
  "nbformat": 4,