ngio 0.2.0a2__py3-none-any.whl → 0.5.0b4__py3-none-any.whl
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.
- ngio/__init__.py +40 -12
- ngio/common/__init__.py +16 -32
- ngio/common/_dimensions.py +270 -48
- ngio/common/_masking_roi.py +153 -0
- ngio/common/_pyramid.py +267 -73
- ngio/common/_roi.py +290 -66
- ngio/common/_synt_images_utils.py +101 -0
- ngio/common/_zoom.py +54 -22
- ngio/experimental/__init__.py +5 -0
- ngio/experimental/iterators/__init__.py +15 -0
- ngio/experimental/iterators/_abstract_iterator.py +390 -0
- ngio/experimental/iterators/_feature.py +189 -0
- ngio/experimental/iterators/_image_processing.py +130 -0
- ngio/experimental/iterators/_mappers.py +48 -0
- ngio/experimental/iterators/_rois_utils.py +126 -0
- ngio/experimental/iterators/_segmentation.py +235 -0
- ngio/hcs/__init__.py +17 -58
- ngio/hcs/_plate.py +1354 -0
- ngio/images/__init__.py +30 -9
- ngio/images/_abstract_image.py +968 -0
- ngio/images/_create_synt_container.py +132 -0
- ngio/images/_create_utils.py +423 -0
- ngio/images/_image.py +926 -0
- ngio/images/_label.py +417 -0
- ngio/images/_masked_image.py +531 -0
- ngio/images/_ome_zarr_container.py +1235 -0
- ngio/images/_table_ops.py +471 -0
- ngio/io_pipes/__init__.py +75 -0
- ngio/io_pipes/_io_pipes.py +361 -0
- ngio/io_pipes/_io_pipes_masked.py +488 -0
- ngio/io_pipes/_io_pipes_roi.py +146 -0
- ngio/io_pipes/_io_pipes_types.py +56 -0
- ngio/io_pipes/_match_shape.py +377 -0
- ngio/io_pipes/_ops_axes.py +344 -0
- ngio/io_pipes/_ops_slices.py +411 -0
- ngio/io_pipes/_ops_slices_utils.py +199 -0
- ngio/io_pipes/_ops_transforms.py +104 -0
- ngio/io_pipes/_zoom_transform.py +180 -0
- ngio/ome_zarr_meta/__init__.py +39 -15
- ngio/ome_zarr_meta/_meta_handlers.py +490 -96
- ngio/ome_zarr_meta/ngio_specs/__init__.py +24 -10
- ngio/ome_zarr_meta/ngio_specs/_axes.py +268 -234
- ngio/ome_zarr_meta/ngio_specs/_channels.py +125 -41
- ngio/ome_zarr_meta/ngio_specs/_dataset.py +42 -87
- ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py +536 -2
- ngio/ome_zarr_meta/ngio_specs/_ngio_image.py +202 -198
- ngio/ome_zarr_meta/ngio_specs/_pixel_size.py +72 -34
- ngio/ome_zarr_meta/v04/__init__.py +21 -5
- ngio/ome_zarr_meta/v04/_custom_models.py +18 -0
- ngio/ome_zarr_meta/v04/{_v04_spec_utils.py → _v04_spec.py} +151 -90
- ngio/ome_zarr_meta/v05/__init__.py +27 -0
- ngio/ome_zarr_meta/v05/_custom_models.py +18 -0
- ngio/ome_zarr_meta/v05/_v05_spec.py +511 -0
- ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/mask.png +0 -0
- ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/nuclei.png +0 -0
- ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/raw.jpg +0 -0
- ngio/resources/__init__.py +55 -0
- ngio/resources/resource_model.py +36 -0
- ngio/tables/__init__.py +20 -4
- ngio/tables/_abstract_table.py +270 -0
- ngio/tables/_tables_container.py +449 -0
- ngio/tables/backends/__init__.py +50 -1
- ngio/tables/backends/_abstract_backend.py +200 -31
- ngio/tables/backends/_anndata.py +139 -0
- ngio/tables/backends/_anndata_utils.py +10 -114
- ngio/tables/backends/_csv.py +19 -0
- ngio/tables/backends/_json.py +92 -0
- ngio/tables/backends/_parquet.py +19 -0
- ngio/tables/backends/_py_arrow_backends.py +222 -0
- ngio/tables/backends/_table_backends.py +162 -38
- ngio/tables/backends/_utils.py +608 -0
- ngio/tables/v1/__init__.py +19 -4
- ngio/tables/v1/_condition_table.py +71 -0
- ngio/tables/v1/_feature_table.py +79 -115
- ngio/tables/v1/_generic_table.py +21 -90
- ngio/tables/v1/_roi_table.py +486 -137
- ngio/transforms/__init__.py +5 -0
- ngio/transforms/_zoom.py +19 -0
- ngio/utils/__init__.py +16 -14
- ngio/utils/_cache.py +48 -0
- ngio/utils/_datasets.py +121 -13
- ngio/utils/_fractal_fsspec_store.py +42 -0
- ngio/utils/_zarr_utils.py +374 -218
- ngio-0.5.0b4.dist-info/METADATA +147 -0
- ngio-0.5.0b4.dist-info/RECORD +88 -0
- {ngio-0.2.0a2.dist-info → ngio-0.5.0b4.dist-info}/WHEEL +1 -1
- ngio/common/_array_pipe.py +0 -160
- ngio/common/_axes_transforms.py +0 -63
- ngio/common/_common_types.py +0 -5
- ngio/common/_slicer.py +0 -97
- ngio/images/abstract_image.py +0 -240
- ngio/images/create.py +0 -251
- ngio/images/image.py +0 -389
- ngio/images/label.py +0 -236
- ngio/images/omezarr_container.py +0 -535
- ngio/ome_zarr_meta/_generic_handlers.py +0 -320
- ngio/ome_zarr_meta/v04/_meta_handlers.py +0 -54
- ngio/tables/_validators.py +0 -192
- ngio/tables/backends/_anndata_v1.py +0 -75
- ngio/tables/backends/_json_v1.py +0 -56
- ngio/tables/tables_container.py +0 -300
- ngio/tables/v1/_masking_roi_table.py +0 -175
- ngio/utils/_logger.py +0 -29
- ngio-0.2.0a2.dist-info/METADATA +0 -95
- ngio-0.2.0a2.dist-info/RECORD +0 -53
- {ngio-0.2.0a2.dist-info → ngio-0.5.0b4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ngio
|
|
3
|
+
Version: 0.5.0b4
|
|
4
|
+
Summary: Next Generation file format IO
|
|
5
|
+
Project-URL: homepage, https://github.com/BioVisionCenter/ngio
|
|
6
|
+
Project-URL: repository, https://github.com/BioVisionCenter/ngio
|
|
7
|
+
Author-email: Lorenzo Cerrone <lorenzo.cerrone@uzh.ch>
|
|
8
|
+
License: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: <3.14,>=3.11
|
|
18
|
+
Requires-Dist: aiohttp
|
|
19
|
+
Requires-Dist: anndata
|
|
20
|
+
Requires-Dist: dask[array]<2025.11.0
|
|
21
|
+
Requires-Dist: dask[distributed]<2025.11.0
|
|
22
|
+
Requires-Dist: filelock
|
|
23
|
+
Requires-Dist: numpy
|
|
24
|
+
Requires-Dist: ome-zarr-models
|
|
25
|
+
Requires-Dist: pandas>=1.2.0
|
|
26
|
+
Requires-Dist: pillow
|
|
27
|
+
Requires-Dist: polars
|
|
28
|
+
Requires-Dist: pooch
|
|
29
|
+
Requires-Dist: pyarrow
|
|
30
|
+
Requires-Dist: pydantic
|
|
31
|
+
Requires-Dist: requests
|
|
32
|
+
Requires-Dist: zarr>3
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
35
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
36
|
+
Requires-Dist: napari; extra == 'dev'
|
|
37
|
+
Requires-Dist: notebook; extra == 'dev'
|
|
38
|
+
Requires-Dist: pdbpp; extra == 'dev'
|
|
39
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
40
|
+
Requires-Dist: pympler; extra == 'dev'
|
|
41
|
+
Requires-Dist: pyqt5; extra == 'dev'
|
|
42
|
+
Requires-Dist: rich; extra == 'dev'
|
|
43
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
44
|
+
Requires-Dist: scikit-image; extra == 'dev'
|
|
45
|
+
Requires-Dist: zarrs; extra == 'dev'
|
|
46
|
+
Provides-Extra: docs
|
|
47
|
+
Requires-Dist: griffe-typingdoc; extra == 'docs'
|
|
48
|
+
Requires-Dist: markdown-exec[ansi]; extra == 'docs'
|
|
49
|
+
Requires-Dist: matplotlib; extra == 'docs'
|
|
50
|
+
Requires-Dist: mike; extra == 'docs'
|
|
51
|
+
Requires-Dist: mkdocs; extra == 'docs'
|
|
52
|
+
Requires-Dist: mkdocs-autorefs; extra == 'docs'
|
|
53
|
+
Requires-Dist: mkdocs-git-committers-plugin-2; extra == 'docs'
|
|
54
|
+
Requires-Dist: mkdocs-git-revision-date-localized-plugin; extra == 'docs'
|
|
55
|
+
Requires-Dist: mkdocs-include-markdown-plugin; extra == 'docs'
|
|
56
|
+
Requires-Dist: mkdocs-jupyter; extra == 'docs'
|
|
57
|
+
Requires-Dist: mkdocs-material; extra == 'docs'
|
|
58
|
+
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
59
|
+
Requires-Dist: rich; extra == 'docs'
|
|
60
|
+
Requires-Dist: scikit-image; extra == 'docs'
|
|
61
|
+
Requires-Dist: tabulate; extra == 'docs'
|
|
62
|
+
Provides-Extra: test
|
|
63
|
+
Requires-Dist: boto; extra == 'test'
|
|
64
|
+
Requires-Dist: devtools; extra == 'test'
|
|
65
|
+
Requires-Dist: moto[server]; extra == 'test'
|
|
66
|
+
Requires-Dist: pytest; extra == 'test'
|
|
67
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
68
|
+
Requires-Dist: pytest-httpserver; extra == 'test'
|
|
69
|
+
Requires-Dist: s3fs; extra == 'test'
|
|
70
|
+
Requires-Dist: scikit-image; extra == 'test'
|
|
71
|
+
Description-Content-Type: text/markdown
|
|
72
|
+
|
|
73
|
+
# Ngio - Next Generation file format IO
|
|
74
|
+
|
|
75
|
+
[](https://github.com/BioVisionCenter/ngio/raw/main/LICENSE)
|
|
76
|
+
[](https://pypi.org/project/ngio)
|
|
77
|
+
[](https://python.org)
|
|
78
|
+
[](https://github.com/BioVisionCenter/ngio/actions/workflows/ci.yml)
|
|
79
|
+
[](https://codecov.io/gh/BioVisionCenter/ngio)
|
|
80
|
+
|
|
81
|
+
ngio is a Python library designed to simplify bioimage analysis workflows, offering an intuitive interface for working with OME-Zarr files.
|
|
82
|
+
|
|
83
|
+
## What is Ngio?
|
|
84
|
+
|
|
85
|
+
Ngio is built for the [OME-Zarr](https://ngff.openmicroscopy.org/) file format, a modern, cloud-optimized format for biological imaging data. OME-Zarr stores large, multi-dimensional microscopy images and metadata in an efficient and scalable way.
|
|
86
|
+
|
|
87
|
+
Ngio's mission is to streamline working with OME-Zarr files by providing a simple, object-based API for opening, exploring, and manipulating OME-Zarr images and high-content screening (HCS) plates. It also offers comprehensive support for labels, tables and regions of interest (ROIs), making it easy to extract and analyze specific regions in your data.
|
|
88
|
+
|
|
89
|
+
## Key Features
|
|
90
|
+
|
|
91
|
+
### 🔍 Simple Object-Based API
|
|
92
|
+
|
|
93
|
+
- Easily open, explore, and manipulate OME-Zarr images and HCS plates
|
|
94
|
+
- Create and derive new images and labels with minimal boilerplate code
|
|
95
|
+
|
|
96
|
+
### 📊 Rich Tables and Regions of Interest (ROI) Support
|
|
97
|
+
|
|
98
|
+
- Tight integration with [tabular data](https://biovisioncenter.github.io/ngio/stable/table_specs/overview/)
|
|
99
|
+
- Extract and analyze specific regions of interest
|
|
100
|
+
- Store measurements and other metadata in the OME-Zarr container
|
|
101
|
+
- Extensible & modular allowing users to define custom table schemas and on disk serialization
|
|
102
|
+
|
|
103
|
+
### 🔄 Scalable Data Processing
|
|
104
|
+
|
|
105
|
+
- Powerful iterators for building scalable and generalizable image processing pipelines
|
|
106
|
+
- Extensible mapping mechanism for custom parallelization strategies
|
|
107
|
+
|
|
108
|
+
## Installation
|
|
109
|
+
|
|
110
|
+
You can install ngio via pip:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install ngio
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
To get started check out the [Quickstart Guide](https://BioVisionCenter.github.io/ngio/stable/getting_started/0_quickstart/).
|
|
117
|
+
|
|
118
|
+
## Supported OME-Zarr versions
|
|
119
|
+
|
|
120
|
+
Currently, ngio only supports OME-Zarr v0.4. Support for version 0.5 and higher is planned for future releases.
|
|
121
|
+
|
|
122
|
+
## Development Status
|
|
123
|
+
|
|
124
|
+
Ngio is under active development and is not yet stable. The API is subject to change, and bugs and breaking changes are expected.
|
|
125
|
+
We follow [Semantic Versioning](https://semver.org/). Which means for 0.x releases potentially breaking changes can be introduced in minor releases.
|
|
126
|
+
|
|
127
|
+
### Available Features
|
|
128
|
+
|
|
129
|
+
- ✅ OME-Zarr metadata handling and validation
|
|
130
|
+
- ✅ Image and label access across pyramid levels
|
|
131
|
+
- ✅ ROI and table support
|
|
132
|
+
- ✅ Image processing iterators
|
|
133
|
+
- ✅ Streaming from remote sources
|
|
134
|
+
- ✅ Documentation and examples
|
|
135
|
+
|
|
136
|
+
### Upcoming Features
|
|
137
|
+
|
|
138
|
+
- Support for OME-Zarr v0.5 and Zarr v3 (via `zarr-python` v3)
|
|
139
|
+
- Enhanced performance optimizations (parallel iterators, optimized io strategies)
|
|
140
|
+
|
|
141
|
+
## Contributors
|
|
142
|
+
|
|
143
|
+
Ngio is developed at the [BioVisionCenter](https://www.biovisioncenter.uzh.ch/en.html), University of Zurich, by [@lorenzocerrone](https://github.com/lorenzocerrone) and [@jluethi](https://github.com/jluethi).
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
Ngio is released under the BSD-3-Clause License. See [LICENSE](https://github.com/BioVisionCenter/ngio/blob/main/LICENSE) for details.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
ngio/__init__.py,sha256=kyInohhWrBs4qkbMYFIQeAiy1CDpvbSOtXB4buFocbw,1535
|
|
2
|
+
ngio/common/__init__.py,sha256=F3zAHQIhwig1xUA-SpmFVRtMeOrEj926-nHWhj-wS6c,684
|
|
3
|
+
ngio/common/_dimensions.py,sha256=w8PYgyWxA8hgJETjFbw5CXf7WrasCL5FbzgfL1in86M,11361
|
|
4
|
+
ngio/common/_masking_roi.py,sha256=rWOvhT08KfxX5djvUsX6LsUVofyU0Fq5LcUmpOYElDg,4757
|
|
5
|
+
ngio/common/_pyramid.py,sha256=JRqVm9eFyxHi1a2hCcAoTJU3L8vctRHbkVWkskyQG_U,14354
|
|
6
|
+
ngio/common/_roi.py,sha256=G2KICRbxlYenbc1qmKmdxLrfJRmqYSUbeaBdEuUYW-Q,11415
|
|
7
|
+
ngio/common/_synt_images_utils.py,sha256=B6uYOW1NyrM06YMR-csca3_YnAAkPRTbvnbLdy9tk9E,3188
|
|
8
|
+
ngio/common/_zoom.py,sha256=U01c-vqXjzZkrpd9Yvs24frVfTls_xPJeeaFCGmUwYI,6727
|
|
9
|
+
ngio/experimental/__init__.py,sha256=3pmBtHi-i8bKjTsvrOJM56ZyRX3Pv_dceCdt88-8COQ,147
|
|
10
|
+
ngio/experimental/iterators/__init__.py,sha256=TECOMGb5PEEZ0yXxt8pqIGvLKG41g_L1fTJU-zGPeV8,488
|
|
11
|
+
ngio/experimental/iterators/_abstract_iterator.py,sha256=7aAoMI-6vYGCMKxO3M10WpuBMTdqX4zr0K-TutAOp88,13195
|
|
12
|
+
ngio/experimental/iterators/_feature.py,sha256=OnqeSP-UMWku7AIBcutsDsAWqnFqPrjCJiMvMGM96fk,6714
|
|
13
|
+
ngio/experimental/iterators/_image_processing.py,sha256=cM7sL7xgdcjSOKAu-6367Aov89o6wgiJ_wqCGkU2Bsw,5091
|
|
14
|
+
ngio/experimental/iterators/_mappers.py,sha256=VVVsjems57wJUnWeufUFcgqa23k7VPeFL4Nc04HVw4o,1399
|
|
15
|
+
ngio/experimental/iterators/_rois_utils.py,sha256=5foGjt3qrACNrO29LlvSUbJ4yfI0z6MhU2oVCzEU214,4363
|
|
16
|
+
ngio/experimental/iterators/_segmentation.py,sha256=xzotGvTn04HPeMeXZ_URnQqWco6d2lH6Ng6vkCUh9NM,9153
|
|
17
|
+
ngio/hcs/__init__.py,sha256=G8j9vD-liLeB_UeGtKYIgshWvJnUA6ks9GwjvWBLdHs,357
|
|
18
|
+
ngio/hcs/_plate.py,sha256=l2a2ZMniutxRzZ88HOYwajug-svr6OanREG5mTy39x0,45773
|
|
19
|
+
ngio/images/__init__.py,sha256=9Whvt7GTiCgT_vXaEEqGnDaY1-UsRk3dhLTv091F_g4,1211
|
|
20
|
+
ngio/images/_abstract_image.py,sha256=n7xIURa3QCfTuBZz-g58y0Q2maG41AL79C9Ae8I08Ko,31864
|
|
21
|
+
ngio/images/_create_synt_container.py,sha256=Cvg_J0KSxK0PH8IBzlKLIcCwH2vRTuBj-nZo5uOKXXk,5182
|
|
22
|
+
ngio/images/_create_utils.py,sha256=hXVbFM8D_0mZTfBAhcZiuGX2lLXSJCep8THuxpH4d4E,14374
|
|
23
|
+
ngio/images/_image.py,sha256=A2dE9O3L1dLU3gdjQrNCFUYDF_NuxTxVm8klmBfmPCc,34792
|
|
24
|
+
ngio/images/_label.py,sha256=P4m6K6xaYoE7XrpCxbxHQwJOHncXdmXY057ZUv4a76E,15856
|
|
25
|
+
ngio/images/_masked_image.py,sha256=YhbBzgPZMav6rX0WYue1BaxAzEIsfaQrxUIOK6ZWZcw,18848
|
|
26
|
+
ngio/images/_ome_zarr_container.py,sha256=mD1PEos33EfapkUVMJnSZdQiQI57cZa_bB2hdEEJQuM,48276
|
|
27
|
+
ngio/images/_table_ops.py,sha256=jFv_AMqoB4JBpoWsMtZppZVW7dAOC_u-JpfNm8b33kY,15292
|
|
28
|
+
ngio/io_pipes/__init__.py,sha256=arW_7GWzZs82kPNKdm_6B1sIDFV0lWwp-ZaORr9Q1FQ,2412
|
|
29
|
+
ngio/io_pipes/_io_pipes.py,sha256=l85mmjj1l0uYU3qzsSHg9l8cMIEevInm_MTD-8MlXgw,10603
|
|
30
|
+
ngio/io_pipes/_io_pipes_masked.py,sha256=uvfNIuW8prWux3fZ-a25l44zDfZW4qBaXZEm0TkhloA,16916
|
|
31
|
+
ngio/io_pipes/_io_pipes_roi.py,sha256=HJHlItx2nsFYcE4OjvVR-W0lFMMK8CcyYK23dKUrP8w,4472
|
|
32
|
+
ngio/io_pipes/_io_pipes_types.py,sha256=PcRdnjBJIsXcDT1_dbH2LZiH6d3z6D7y48cmybyZCXk,1358
|
|
33
|
+
ngio/io_pipes/_match_shape.py,sha256=e3cQM6BI8n2YODmU6wgnFoaguwRVZw9bk5eafzmcTBM,13185
|
|
34
|
+
ngio/io_pipes/_ops_axes.py,sha256=Geg4ZXxB0njWWopX9YeiwRJJ9Ef2GKfG0NIUafOmi2c,10043
|
|
35
|
+
ngio/io_pipes/_ops_slices.py,sha256=hHMIOQ_niUSK9uFl8P2-10dP_K4GX3Do6vivN4fGRE0,14520
|
|
36
|
+
ngio/io_pipes/_ops_slices_utils.py,sha256=mps_I0eTI4gdBVM9MCKsd8rCyefdo9bIK9fEmqwr23E,6633
|
|
37
|
+
ngio/io_pipes/_ops_transforms.py,sha256=uITs6v6sZ7DQ_Hpw3JdX8MuPOzir-bihvGzY84Qn4wY,2934
|
|
38
|
+
ngio/io_pipes/_zoom_transform.py,sha256=WBY1tO6_Qhf8FaDujfTdipuuqFf7PSi204wx5VKKs88,6884
|
|
39
|
+
ngio/ome_zarr_meta/__init__.py,sha256=0VVB0r5CTjVqOsC8pa_Jf9H8ctPzTLRmC6LJqWWAs7Q,1371
|
|
40
|
+
ngio/ome_zarr_meta/_meta_handlers.py,sha256=M8bHeWUjSgPCg-JTvnbwoL5sTPyGrWb2j8d-3r0Ua6Q,16172
|
|
41
|
+
ngio/ome_zarr_meta/ngio_specs/__init__.py,sha256=sYGlV2-0-z-a1gDFlk_pCjgcdRsgbwBf72vM2ZAVTtQ,1750
|
|
42
|
+
ngio/ome_zarr_meta/ngio_specs/_axes.py,sha256=CY63mWf7_ALoi7o_1QDVK1lAG56xN0gvgwfcuNRmMIg,16446
|
|
43
|
+
ngio/ome_zarr_meta/ngio_specs/_channels.py,sha256=TDxIy-yVc2YaWPIFJRYnYwZbA8O5Ee_OiWppHYrEdpU,16647
|
|
44
|
+
ngio/ome_zarr_meta/ngio_specs/_dataset.py,sha256=5YdAplk90koX3vjoIJimms-CJYxt095rJ9YagZSQg88,2872
|
|
45
|
+
ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py,sha256=-YOC39YXDk5ojFkpvj8Vup6A3tAtHotV9e8QNZ0l_Cs,16999
|
|
46
|
+
ngio/ome_zarr_meta/ngio_specs/_ngio_image.py,sha256=g32ytm4jxDR5duHyO6_kU0MrcE2NzI8V4EWCYanuIrI,14591
|
|
47
|
+
ngio/ome_zarr_meta/ngio_specs/_pixel_size.py,sha256=4VF1djY9T5tp6GCJXppFrUJwALI1XgIm0imoM5rNvdE,3876
|
|
48
|
+
ngio/ome_zarr_meta/v04/__init__.py,sha256=tRt3zGelL948EoLfy_gW-LKvJcBbSkbT9kwIgU0hQV8,721
|
|
49
|
+
ngio/ome_zarr_meta/v04/_custom_models.py,sha256=5GxiDERvLuvq4QvApcA6EiKLS6hLFX1R0R_9rSaa85A,530
|
|
50
|
+
ngio/ome_zarr_meta/v04/_v04_spec.py,sha256=PRkxNeIDCCxG4J5HD3hQPrV-iPW_KAs4HyjyrT4i_NI,15362
|
|
51
|
+
ngio/ome_zarr_meta/v05/__init__.py,sha256=B6VIUkrm5W4lcrvy4R7c7NZ6dEx-0a1AhqhZ7snCnCo,721
|
|
52
|
+
ngio/ome_zarr_meta/v05/_custom_models.py,sha256=ZN3bE9nwx4y3tElhsYafI4S2zp_WzdkQKcyuuBiaXXo,530
|
|
53
|
+
ngio/ome_zarr_meta/v05/_v05_spec.py,sha256=qjSRSkz20jQwd47tzHjeX5ECYBbZoU6q8lnALFeAZts,16285
|
|
54
|
+
ngio/resources/__init__.py,sha256=4E4TXTNYEgRHt26C1XcC4pPobJJsmZRYm1Ml4uAuAkE,1664
|
|
55
|
+
ngio/resources/resource_model.py,sha256=eE1m0dyk-2psPC4X8Ifyan524QHUOd52TEQdvoU0m8I,861
|
|
56
|
+
ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/mask.png,sha256=g3QmxQdmeciAtBe5cTCRfR6yw3keG9cBYfjizMo6EGo,11890
|
|
57
|
+
ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/nuclei.png,sha256=Yw0k5pn2EHDMWTwyb7N51NX7WVk6-MlwfP9WZrhY-Ic,19446
|
|
58
|
+
ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/raw.jpg,sha256=82lejQAIokj5w9g-qqhysDTWpHtNvJTkdURG_BjqIxQ,37743
|
|
59
|
+
ngio/tables/__init__.py,sha256=_BV3sclNMLITu_J8_3DkkUrCB6Kro0HzeWLDCD1ivKM,877
|
|
60
|
+
ngio/tables/_abstract_table.py,sha256=rwGa47TzbFmosucBWVfFq6JEXtgGvOdUVtU9DIelV88,8204
|
|
61
|
+
ngio/tables/_tables_container.py,sha256=1HXIfofOtwJr6XQ_ILM8-rr7Cxq1XmV4BzL5Q2g2tLk,13097
|
|
62
|
+
ngio/tables/backends/__init__.py,sha256=MwSRXNF1rWQBFOTDA_vT3oGoNZpviVgytsL5Txnu08I,1619
|
|
63
|
+
ngio/tables/backends/_abstract_backend.py,sha256=M1ogsBpWBiQMV65YweZhA845PAtkzG2BsZCPN_7Xp8U,7613
|
|
64
|
+
ngio/tables/backends/_anndata.py,sha256=T67N-SPNO4eqe7-VGAUfgtwaSy_o2DqCvZgE2yRH5jE,4582
|
|
65
|
+
ngio/tables/backends/_anndata_utils.py,sha256=PoHiLkGeDhBgPsEMJi9QH-NejHmfrfILcwj1CYubyCM,3095
|
|
66
|
+
ngio/tables/backends/_csv.py,sha256=iZJNLHOXYysV_2iq6Lmekq0XXYsVE7OYrKz2HP2TU9w,479
|
|
67
|
+
ngio/tables/backends/_json.py,sha256=A4iaKOIc5Q_XKDOm321QNqAN4DAOuA-dEinnfTlk1Fk,3091
|
|
68
|
+
ngio/tables/backends/_parquet.py,sha256=Fi3VZlTH5UTykk0eqr43_e_Qt_GQcEN-3pHK07XFBwk,503
|
|
69
|
+
ngio/tables/backends/_py_arrow_backends.py,sha256=lxxI5TN4lFYwpsjD1g1xAxEt4lZ9Mu7YW3-m3nIuo2g,8587
|
|
70
|
+
ngio/tables/backends/_table_backends.py,sha256=ksP2NAosXZkNMZf-IMrLx7bjQgp_eKfvPYK4vMdT1A8,7250
|
|
71
|
+
ngio/tables/backends/_utils.py,sha256=t4dLXSPxx2AnJvVtj0GIwrLoO11h4Ges6U7hj4md0hY,19730
|
|
72
|
+
ngio/tables/v1/__init__.py,sha256=Wr1_9RZFpaN8FYMTnxT9Yjkw4AS7y9FMWailmB_uj5g,617
|
|
73
|
+
ngio/tables/v1/_condition_table.py,sha256=T0Uq5BKkmMoEspt_Rx0U99Ow6S9GAMZDHqvUO5obCAM,1780
|
|
74
|
+
ngio/tables/v1/_feature_table.py,sha256=n9uMHwoBh-_dlOhUXCFbmAjXFVXncNCR3SjE2qzXI68,3821
|
|
75
|
+
ngio/tables/v1/_generic_table.py,sha256=1ktJHeuv7U1g5Z8PFUuTkCjOzcYMQd8xegKHKUedJB8,1240
|
|
76
|
+
ngio/tables/v1/_roi_table.py,sha256=DuKJlDmtQtLOfL0g4CSdncfm4hBsKWG6F6fkMUpt4Nk,17821
|
|
77
|
+
ngio/transforms/__init__.py,sha256=JA0-Ui7skbXkm9ofN-AEhU1FTLutkMkwTdVD-310frQ,113
|
|
78
|
+
ngio/transforms/_zoom.py,sha256=otyE-vxFnywUJ8U4mHjat-bNG_7_jv62ckTpqDMxyVQ,550
|
|
79
|
+
ngio/utils/__init__.py,sha256=d2OHQGMFPpf8-_ipuqquxtqCNGJpX5yXt34A65nScUU,1037
|
|
80
|
+
ngio/utils/_cache.py,sha256=Ey9fgc_BTdMyqg6c80C0CuGDhOafln8-3e_1MQ0MFzw,1283
|
|
81
|
+
ngio/utils/_datasets.py,sha256=6GtxfPkjutNaeg5BHuJDBP0GudvQXHLU6mmHp_o0bGA,5650
|
|
82
|
+
ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
|
|
83
|
+
ngio/utils/_fractal_fsspec_store.py,sha256=RdcCFOgHexRKX9zZvJV5RI-5OPc7VOPS6q_IeRxm24I,1548
|
|
84
|
+
ngio/utils/_zarr_utils.py,sha256=MVbW-a0S3iuzMaknqkliJa_lp8i6mEO4Q2YN2XxmeDw,18158
|
|
85
|
+
ngio-0.5.0b4.dist-info/METADATA,sha256=PoJXudr2QpL-O1So3ryYySSeQ-3oQdxIqPIZx2B2ejs,6331
|
|
86
|
+
ngio-0.5.0b4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
87
|
+
ngio-0.5.0b4.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
|
|
88
|
+
ngio-0.5.0b4.dist-info/RECORD,,
|
ngio/common/_array_pipe.py
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
from collections.abc import Collection, Iterable
|
|
2
|
-
from typing import Literal
|
|
3
|
-
|
|
4
|
-
import dask
|
|
5
|
-
import dask.delayed
|
|
6
|
-
import numpy as np
|
|
7
|
-
import zarr
|
|
8
|
-
|
|
9
|
-
from ngio.common._axes_transforms import transform_dask_array, transform_numpy_array
|
|
10
|
-
from ngio.common._common_types import ArrayLike
|
|
11
|
-
from ngio.common._dimensions import Dimensions
|
|
12
|
-
from ngio.common._slicer import (
|
|
13
|
-
SliceTransform,
|
|
14
|
-
compute_and_slices,
|
|
15
|
-
dask_get_slice,
|
|
16
|
-
dask_set_slice,
|
|
17
|
-
numpy_get_slice,
|
|
18
|
-
numpy_set_slice,
|
|
19
|
-
)
|
|
20
|
-
from ngio.ome_zarr_meta.ngio_specs import AxesTransformation
|
|
21
|
-
from ngio.utils import NgioValueError
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def _compute_from_disk_transforms(
|
|
25
|
-
*,
|
|
26
|
-
dimensions: Dimensions,
|
|
27
|
-
axes_order: Collection[str] | None = None,
|
|
28
|
-
**slice_kwargs: slice | int | Iterable[int],
|
|
29
|
-
) -> tuple[SliceTransform, tuple[AxesTransformation, ...]]:
|
|
30
|
-
slices = compute_and_slices(dimensions=dimensions, **slice_kwargs)
|
|
31
|
-
|
|
32
|
-
if axes_order is None:
|
|
33
|
-
return slices, ()
|
|
34
|
-
|
|
35
|
-
additional_transformations = dimensions._axes_mapper.to_order(axes_order)
|
|
36
|
-
return slices, additional_transformations
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def _compute_to_disk_transforms(
|
|
40
|
-
*,
|
|
41
|
-
dimensions: Dimensions,
|
|
42
|
-
axes_order: Collection[str] | None = None,
|
|
43
|
-
**slice_kwargs: slice | int | Iterable[int],
|
|
44
|
-
) -> tuple[SliceTransform, tuple[AxesTransformation, ...]]:
|
|
45
|
-
slices = compute_and_slices(dimensions=dimensions, **slice_kwargs)
|
|
46
|
-
if axes_order is None:
|
|
47
|
-
return slices, ()
|
|
48
|
-
|
|
49
|
-
additional_transformations = dimensions._axes_mapper.from_order(axes_order)
|
|
50
|
-
return slices, additional_transformations
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _numpy_get_pipe(
|
|
54
|
-
array: zarr.Array,
|
|
55
|
-
slices: SliceTransform,
|
|
56
|
-
transformations: tuple[AxesTransformation, ...],
|
|
57
|
-
) -> np.ndarray:
|
|
58
|
-
array = numpy_get_slice(array, slices)
|
|
59
|
-
return transform_numpy_array(array, transformations)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def _delayed_numpy_get_pipe(
|
|
63
|
-
array: zarr.Array,
|
|
64
|
-
slices: SliceTransform,
|
|
65
|
-
transformations: tuple[AxesTransformation, ...],
|
|
66
|
-
) -> dask.delayed:
|
|
67
|
-
array = dask.delayed(numpy_get_slice)(array, slices)
|
|
68
|
-
return dask.delayed(transform_numpy_array)(array, transformations)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def _dask_get_pipe(
|
|
72
|
-
array: zarr.Array,
|
|
73
|
-
slices: SliceTransform,
|
|
74
|
-
transformations: tuple[AxesTransformation, ...],
|
|
75
|
-
) -> dask.array:
|
|
76
|
-
array = dask_get_slice(array, slices)
|
|
77
|
-
return transform_dask_array(array, transformations)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def _numpy_set_pipe(
|
|
81
|
-
array: zarr.Array,
|
|
82
|
-
patch: np.ndarray,
|
|
83
|
-
slices: SliceTransform,
|
|
84
|
-
transformations: tuple[AxesTransformation, ...],
|
|
85
|
-
) -> None:
|
|
86
|
-
patch = transform_numpy_array(patch, transformations)
|
|
87
|
-
numpy_set_slice(array, patch, slices)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def _dask_set_pipe(
|
|
91
|
-
array: zarr.Array,
|
|
92
|
-
patch: np.ndarray,
|
|
93
|
-
slices: SliceTransform,
|
|
94
|
-
transformations: tuple[AxesTransformation, ...],
|
|
95
|
-
) -> None:
|
|
96
|
-
patch = transform_dask_array(patch, transformations)
|
|
97
|
-
dask_set_slice(array, patch, slices)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def _delayed_numpy_set_pipe(
|
|
101
|
-
array: zarr.Array,
|
|
102
|
-
patch: np.ndarray,
|
|
103
|
-
slices: SliceTransform,
|
|
104
|
-
transformations: tuple[AxesTransformation, ...],
|
|
105
|
-
) -> dask.delayed:
|
|
106
|
-
patch = dask.delayed(transform_numpy_array)(patch, transformations)
|
|
107
|
-
return dask.delayed(numpy_set_slice)(array, patch, slices)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def get_pipe(
|
|
111
|
-
array: zarr.Array,
|
|
112
|
-
*,
|
|
113
|
-
dimensions: Dimensions,
|
|
114
|
-
axes_order: Collection[str] | None = None,
|
|
115
|
-
mode: Literal["numpy", "dask", "delayed"] = "numpy",
|
|
116
|
-
**slice_kwargs: slice | int | Iterable[int],
|
|
117
|
-
):
|
|
118
|
-
slices, transformations = _compute_from_disk_transforms(
|
|
119
|
-
dimensions=dimensions, axes_order=axes_order, **slice_kwargs
|
|
120
|
-
)
|
|
121
|
-
match mode:
|
|
122
|
-
case "numpy":
|
|
123
|
-
return _numpy_get_pipe(array, slices, transformations)
|
|
124
|
-
case "dask":
|
|
125
|
-
return _dask_get_pipe(array, slices, transformations)
|
|
126
|
-
|
|
127
|
-
case "delayed_numpy":
|
|
128
|
-
return _delayed_numpy_get_pipe(array, slices, transformations)
|
|
129
|
-
|
|
130
|
-
case _:
|
|
131
|
-
raise NgioValueError(
|
|
132
|
-
f"Unknown get pipe mode {mode}, expected 'numpy', 'dask' or 'delayed'."
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
def set_pipe(
|
|
137
|
-
array: zarr.Array,
|
|
138
|
-
patch: ArrayLike,
|
|
139
|
-
*,
|
|
140
|
-
dimensions: Dimensions,
|
|
141
|
-
axes_order: Collection[str] | None = None,
|
|
142
|
-
**slice_kwargs: slice | int | Iterable[int],
|
|
143
|
-
):
|
|
144
|
-
slices, transformations = _compute_to_disk_transforms(
|
|
145
|
-
dimensions=dimensions, axes_order=axes_order, **slice_kwargs
|
|
146
|
-
)
|
|
147
|
-
if isinstance(patch, dask.array.Array):
|
|
148
|
-
_dask_set_pipe(
|
|
149
|
-
array=array, patch=patch, slices=slices, transformations=transformations
|
|
150
|
-
)
|
|
151
|
-
elif isinstance(patch, np.ndarray):
|
|
152
|
-
_numpy_set_pipe(
|
|
153
|
-
array=array, patch=patch, slices=slices, transformations=transformations
|
|
154
|
-
)
|
|
155
|
-
elif isinstance(patch, dask.delayed.Delayed):
|
|
156
|
-
_delayed_numpy_set_pipe(
|
|
157
|
-
array=array, patch=patch, slices=slices, transformations=transformations
|
|
158
|
-
)
|
|
159
|
-
else:
|
|
160
|
-
raise NgioValueError("Unknown patch type, expected numpy, dask or delayed.")
|
ngio/common/_axes_transforms.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from typing import TypeVar
|
|
2
|
-
|
|
3
|
-
import dask.array as da
|
|
4
|
-
import numpy as np
|
|
5
|
-
|
|
6
|
-
from ngio.ome_zarr_meta.ngio_specs._axes import (
|
|
7
|
-
AxesExpand,
|
|
8
|
-
AxesSqueeze,
|
|
9
|
-
AxesTransformation,
|
|
10
|
-
AxesTranspose,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
T = TypeVar("T")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def transform_list(
|
|
17
|
-
input_list: list[T], default: T, operations: tuple[AxesTransformation, ...]
|
|
18
|
-
) -> list[T]:
|
|
19
|
-
if isinstance(input_list, tuple):
|
|
20
|
-
input_list = list(input_list)
|
|
21
|
-
|
|
22
|
-
for operation in operations:
|
|
23
|
-
if isinstance(operation, AxesTranspose):
|
|
24
|
-
input_list = [input_list[i] for i in operation.axes]
|
|
25
|
-
|
|
26
|
-
if isinstance(operation, AxesExpand):
|
|
27
|
-
for ax in operation.axes:
|
|
28
|
-
input_list.insert(ax, default)
|
|
29
|
-
elif isinstance(operation, AxesSqueeze):
|
|
30
|
-
for offset, ax in enumerate(operation.axes):
|
|
31
|
-
input_list.pop(ax - offset)
|
|
32
|
-
|
|
33
|
-
return input_list
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def transform_numpy_array(
|
|
37
|
-
array: np.ndarray, operations: tuple[AxesTransformation, ...]
|
|
38
|
-
) -> np.ndarray:
|
|
39
|
-
for operation in operations:
|
|
40
|
-
if isinstance(operation, AxesTranspose):
|
|
41
|
-
array = np.transpose(array, operation.axes)
|
|
42
|
-
elif isinstance(operation, AxesExpand):
|
|
43
|
-
array = np.expand_dims(array, axis=operation.axes)
|
|
44
|
-
elif isinstance(operation, AxesSqueeze):
|
|
45
|
-
array = np.squeeze(array, axis=operation.axes)
|
|
46
|
-
else:
|
|
47
|
-
raise ValueError(f"Unknown operation {operation}")
|
|
48
|
-
return array
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def transform_dask_array(
|
|
52
|
-
array: da.Array, operations: tuple[AxesTransformation, ...]
|
|
53
|
-
) -> da.Array:
|
|
54
|
-
for operation in operations:
|
|
55
|
-
if isinstance(operation, AxesTranspose):
|
|
56
|
-
array = da.transpose(array, axes=operation.axes)
|
|
57
|
-
elif isinstance(operation, AxesExpand):
|
|
58
|
-
array = da.expand_dims(array, axis=operation.axes)
|
|
59
|
-
elif isinstance(operation, AxesSqueeze):
|
|
60
|
-
array = da.squeeze(array, axis=operation.axes)
|
|
61
|
-
else:
|
|
62
|
-
raise ValueError(f"Unknown operation {operation}")
|
|
63
|
-
return array
|
ngio/common/_common_types.py
DELETED
ngio/common/_slicer.py
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# %%
|
|
2
|
-
from collections.abc import Iterable
|
|
3
|
-
|
|
4
|
-
import dask.array as da
|
|
5
|
-
import numpy as np
|
|
6
|
-
import zarr
|
|
7
|
-
|
|
8
|
-
from ngio.common._dimensions import Dimensions
|
|
9
|
-
from ngio.ome_zarr_meta.ngio_specs import AxesTransformation
|
|
10
|
-
from ngio.utils import NgioValueError
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _validate_int(value: int, shape: int) -> int:
|
|
14
|
-
if not isinstance(value, int):
|
|
15
|
-
raise NgioValueError(f"Invalid value {value} of type {type(value)}")
|
|
16
|
-
if value < 0 or value >= shape:
|
|
17
|
-
raise NgioValueError(
|
|
18
|
-
f"Invalid value {value}. Index out of bounds for axis of shape {shape}"
|
|
19
|
-
)
|
|
20
|
-
return value
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def _validate_iter_of_ints(value: Iterable[int], shape: int) -> list[int]:
|
|
24
|
-
if not isinstance(value, list):
|
|
25
|
-
raise NgioValueError(f"Invalid value {value} of type {type(value)}")
|
|
26
|
-
value = [_validate_int(v, shape=shape) for v in value]
|
|
27
|
-
return value
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _validate_slice(value: slice, shape: int) -> slice:
|
|
31
|
-
start = value.start if value.start is not None else 0
|
|
32
|
-
start = max(start, 0)
|
|
33
|
-
stop = value.stop if value.stop is not None else shape
|
|
34
|
-
return slice(start, stop)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class SliceTransform(AxesTransformation):
|
|
38
|
-
slices: tuple[slice | tuple[int, ...], ...]
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def compute_and_slices(
|
|
42
|
-
*,
|
|
43
|
-
dimensions: Dimensions,
|
|
44
|
-
**slice_kwargs: slice | int | Iterable[int],
|
|
45
|
-
) -> SliceTransform:
|
|
46
|
-
_slices = {}
|
|
47
|
-
axes_names = dimensions._axes_mapper.on_disk_axes_names
|
|
48
|
-
for axis_name, slice_ in slice_kwargs.items():
|
|
49
|
-
axis = dimensions._axes_mapper.get_axis(axis_name)
|
|
50
|
-
if axis is None:
|
|
51
|
-
raise NgioValueError(
|
|
52
|
-
f"Invalid axis {axis_name}. "
|
|
53
|
-
f"Not found on the on-disk axes {axes_names}. "
|
|
54
|
-
"If you want to get/set a singletorn value include "
|
|
55
|
-
"it in the axes_order parameter."
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
shape = dimensions.get(axis.on_disk_name)
|
|
59
|
-
|
|
60
|
-
if isinstance(slice_, int):
|
|
61
|
-
slice_ = _validate_int(slice_, shape)
|
|
62
|
-
slice_ = slice(slice_, slice_ + 1)
|
|
63
|
-
|
|
64
|
-
elif isinstance(slice_, Iterable):
|
|
65
|
-
slice_ = _validate_iter_of_ints(slice_, shape)
|
|
66
|
-
slice_ = tuple(slice_)
|
|
67
|
-
|
|
68
|
-
elif isinstance(slice_, slice):
|
|
69
|
-
slice_ = _validate_slice(slice_, shape)
|
|
70
|
-
|
|
71
|
-
elif not isinstance(slice_, slice):
|
|
72
|
-
raise ValueError(
|
|
73
|
-
f"Invalid slice definition {slice_} of type {type(slice_)}"
|
|
74
|
-
)
|
|
75
|
-
_slices[axis.on_disk_name] = slice_
|
|
76
|
-
|
|
77
|
-
slices = tuple(_slices.get(axis, slice(None)) for axis in axes_names)
|
|
78
|
-
return SliceTransform(slices=slices)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def numpy_get_slice(array: zarr.Array, slices: SliceTransform) -> np.ndarray:
|
|
82
|
-
return array[slices.slices]
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def dask_get_slice(array: zarr.Array, slices: SliceTransform) -> da.Array:
|
|
86
|
-
da_array = da.from_zarr(array)
|
|
87
|
-
return da_array[slices.slices]
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def numpy_set_slice(
|
|
91
|
-
array: zarr.Array, patch: np.ndarray, slices: SliceTransform
|
|
92
|
-
) -> None:
|
|
93
|
-
array[slices.slices] = patch
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def dask_set_slice(array: zarr.Array, patch: da.Array, slices: SliceTransform) -> None:
|
|
97
|
-
da.to_zarr(arr=patch, url=array, region=slices.slices)
|