ngio 0.3.4__py3-none-any.whl → 0.4.0__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 +7 -2
- ngio/common/__init__.py +5 -52
- ngio/common/_dimensions.py +270 -55
- ngio/common/_masking_roi.py +38 -10
- ngio/common/_pyramid.py +51 -30
- ngio/common/_roi.py +269 -82
- ngio/common/_synt_images_utils.py +101 -0
- ngio/common/_zoom.py +49 -19
- 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 +127 -0
- ngio/experimental/iterators/_segmentation.py +235 -0
- ngio/hcs/_plate.py +41 -36
- ngio/images/__init__.py +22 -1
- ngio/images/_abstract_image.py +403 -176
- ngio/images/_create.py +31 -15
- ngio/images/_create_synt_container.py +138 -0
- ngio/images/_image.py +452 -63
- ngio/images/_label.py +56 -30
- ngio/images/_masked_image.py +387 -129
- ngio/images/_ome_zarr_container.py +237 -67
- ngio/{common → images}/_table_ops.py +41 -41
- 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 +152 -0
- ngio/io_pipes/_io_pipes_types.py +56 -0
- ngio/io_pipes/_match_shape.py +376 -0
- ngio/io_pipes/_ops_axes.py +344 -0
- ngio/io_pipes/_ops_slices.py +446 -0
- ngio/io_pipes/_ops_slices_utils.py +196 -0
- ngio/io_pipes/_ops_transforms.py +104 -0
- ngio/io_pipes/_zoom_transform.py +175 -0
- ngio/ome_zarr_meta/__init__.py +4 -2
- ngio/ome_zarr_meta/ngio_specs/__init__.py +4 -10
- ngio/ome_zarr_meta/ngio_specs/_axes.py +186 -175
- ngio/ome_zarr_meta/ngio_specs/_channels.py +55 -18
- ngio/ome_zarr_meta/ngio_specs/_dataset.py +48 -122
- ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py +6 -15
- ngio/ome_zarr_meta/ngio_specs/_ngio_image.py +38 -87
- ngio/ome_zarr_meta/ngio_specs/_pixel_size.py +17 -1
- ngio/ome_zarr_meta/v04/_v04_spec_utils.py +34 -31
- 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/backends/_abstract_backend.py +5 -6
- ngio/tables/backends/_anndata.py +1 -2
- ngio/tables/backends/_anndata_utils.py +3 -3
- ngio/tables/backends/_non_zarr_backends.py +1 -1
- ngio/tables/backends/_table_backends.py +0 -1
- ngio/tables/backends/_utils.py +3 -3
- ngio/tables/v1/_roi_table.py +165 -70
- ngio/transforms/__init__.py +5 -0
- ngio/transforms/_zoom.py +19 -0
- ngio/utils/__init__.py +2 -3
- ngio/utils/_datasets.py +5 -0
- ngio/utils/_logger.py +19 -0
- ngio/utils/_zarr_utils.py +6 -6
- {ngio-0.3.4.dist-info → ngio-0.4.0.dist-info}/METADATA +24 -22
- ngio-0.4.0.dist-info/RECORD +85 -0
- ngio/common/_array_pipe.py +0 -288
- ngio/common/_axes_transforms.py +0 -64
- ngio/common/_common_types.py +0 -5
- ngio/common/_slicer.py +0 -96
- ngio-0.3.4.dist-info/RECORD +0 -61
- {ngio-0.3.4.dist-info → ngio-0.4.0.dist-info}/WHEEL +0 -0
- {ngio-0.3.4.dist-info → ngio-0.4.0.dist-info}/licenses/LICENSE +0 -0
ngio/common/_slicer.py
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
from collections.abc import Iterable
|
|
2
|
-
|
|
3
|
-
import dask.array as da
|
|
4
|
-
import numpy as np
|
|
5
|
-
import zarr
|
|
6
|
-
|
|
7
|
-
from ngio.common._dimensions import Dimensions
|
|
8
|
-
from ngio.ome_zarr_meta.ngio_specs import AxesTransformation
|
|
9
|
-
from ngio.utils import NgioValueError
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def _validate_int(value: int, shape: int) -> int:
|
|
13
|
-
if not isinstance(value, int):
|
|
14
|
-
raise NgioValueError(f"Invalid value {value} of type {type(value)}")
|
|
15
|
-
if value < 0 or value >= shape:
|
|
16
|
-
raise NgioValueError(
|
|
17
|
-
f"Invalid value {value}. Index out of bounds for axis of shape {shape}"
|
|
18
|
-
)
|
|
19
|
-
return value
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def _validate_iter_of_ints(value: Iterable[int], shape: int) -> list[int]:
|
|
23
|
-
if not isinstance(value, list):
|
|
24
|
-
raise NgioValueError(f"Invalid value {value} of type {type(value)}")
|
|
25
|
-
value = [_validate_int(v, shape=shape) for v in value]
|
|
26
|
-
return value
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def _validate_slice(value: slice, shape: int) -> slice:
|
|
30
|
-
start = value.start if value.start is not None else 0
|
|
31
|
-
start = max(start, 0)
|
|
32
|
-
stop = value.stop if value.stop is not None else shape
|
|
33
|
-
return slice(start, stop)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class SliceTransform(AxesTransformation):
|
|
37
|
-
slices: tuple[slice | tuple[int, ...], ...]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def compute_and_slices(
|
|
41
|
-
*,
|
|
42
|
-
dimensions: Dimensions,
|
|
43
|
-
**slice_kwargs: slice | int | Iterable[int],
|
|
44
|
-
) -> SliceTransform:
|
|
45
|
-
_slices = {}
|
|
46
|
-
axes_names = dimensions._axes_mapper.on_disk_axes_names
|
|
47
|
-
for axis_name, slice_ in slice_kwargs.items():
|
|
48
|
-
axis = dimensions._axes_mapper.get_axis(axis_name)
|
|
49
|
-
if axis is None:
|
|
50
|
-
raise NgioValueError(
|
|
51
|
-
f"Invalid axis {axis_name}. "
|
|
52
|
-
f"Not found on the on-disk axes {axes_names}. "
|
|
53
|
-
"If you want to get/set a singletorn value include "
|
|
54
|
-
"it in the axes_order parameter."
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
shape = dimensions.get(axis.on_disk_name)
|
|
58
|
-
|
|
59
|
-
if isinstance(slice_, int):
|
|
60
|
-
slice_ = _validate_int(slice_, shape)
|
|
61
|
-
slice_ = slice(slice_, slice_ + 1)
|
|
62
|
-
|
|
63
|
-
elif isinstance(slice_, Iterable):
|
|
64
|
-
slice_ = _validate_iter_of_ints(slice_, shape)
|
|
65
|
-
slice_ = tuple(slice_)
|
|
66
|
-
|
|
67
|
-
elif isinstance(slice_, slice):
|
|
68
|
-
slice_ = _validate_slice(slice_, shape)
|
|
69
|
-
|
|
70
|
-
elif not isinstance(slice_, slice):
|
|
71
|
-
raise NgioValueError(
|
|
72
|
-
f"Invalid slice definition {slice_} of type {type(slice_)}"
|
|
73
|
-
)
|
|
74
|
-
_slices[axis.on_disk_name] = slice_
|
|
75
|
-
|
|
76
|
-
slices = tuple(_slices.get(axis, slice(None)) for axis in axes_names)
|
|
77
|
-
return SliceTransform(slices=slices)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def numpy_get_slice(array: zarr.Array, slices: SliceTransform) -> np.ndarray:
|
|
81
|
-
return array[slices.slices]
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def dask_get_slice(array: zarr.Array, slices: SliceTransform) -> da.Array:
|
|
85
|
-
da_array = da.from_zarr(array)
|
|
86
|
-
return da_array[slices.slices]
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def numpy_set_slice(
|
|
90
|
-
array: zarr.Array, patch: np.ndarray, slices: SliceTransform
|
|
91
|
-
) -> None:
|
|
92
|
-
array[slices.slices] = patch
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def dask_set_slice(array: zarr.Array, patch: da.Array, slices: SliceTransform) -> None:
|
|
96
|
-
da.to_zarr(arr=patch, url=array, region=slices.slices)
|
ngio-0.3.4.dist-info/RECORD
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
ngio/__init__.py,sha256=zce-RIfRhkiFyfKwO6s7A1-9ZCD3n6RuVuW3GeRj_VA,1309
|
|
2
|
-
ngio/common/__init__.py,sha256=BttXCAV2ks6_oXVDfapk1Lvlxp4J0ffX7-FXR3LL1BM,1834
|
|
3
|
-
ngio/common/_array_pipe.py,sha256=mvBsOtNSow9S6bSPMJ0288gCqQFYffGnaTTLyuB2XHw,8641
|
|
4
|
-
ngio/common/_axes_transforms.py,sha256=kWU0M5erNmgWBXdu5LNv-tLW3jqkT00MMYX7cz-kyHs,2035
|
|
5
|
-
ngio/common/_common_types.py,sha256=OkAYNSNjZkixL1MI-HPBVuXamheFBr862uJ4PvTxmhk,129
|
|
6
|
-
ngio/common/_dimensions.py,sha256=UV2XulWaROb3Y2f4fv27ZkTIu-MoS53U26aDkrv-_lk,3900
|
|
7
|
-
ngio/common/_masking_roi.py,sha256=-o6meGP17iTXEbkO9aGh1VX2drkc2laIcRJvCy_pRRM,4919
|
|
8
|
-
ngio/common/_pyramid.py,sha256=SJzPauuduuqcm9B7nFCJhMTzIg6Knjsnp4CY4lN61Is,7411
|
|
9
|
-
ngio/common/_roi.py,sha256=xJZ3vSusxhM1wXOizyjPbgzYhneva4IlhaWQc13Kuk4,5186
|
|
10
|
-
ngio/common/_slicer.py,sha256=AKpwXRncOmF9nhjKYma0C_41WqAgSv860beKGx-aw-0,3075
|
|
11
|
-
ngio/common/_table_ops.py,sha256=ToNR7F053l1dubVv-gvBD-523T10HnE2UzqeU2BuNy8,15494
|
|
12
|
-
ngio/common/_zoom.py,sha256=KsURa5VuixmpbAAY5-6obmuQV8vfiHKZqBxZDXvchpM,5473
|
|
13
|
-
ngio/hcs/__init__.py,sha256=G8j9vD-liLeB_UeGtKYIgshWvJnUA6ks9GwjvWBLdHs,357
|
|
14
|
-
ngio/hcs/_plate.py,sha256=o-Myg1sPUT9mCfYjHOuUTIpm2Nl0siacmuztGoPcYc0,44265
|
|
15
|
-
ngio/images/__init__.py,sha256=PlYvbHOMvZLDgn_PeGrytOEU3e_-AO8GWpRjEqoX_Gw,536
|
|
16
|
-
ngio/images/_abstract_image.py,sha256=8PNQPZjiDz-pcTFXSJAVw7nUr4yL_iRwqDEUTKkAnp0,10266
|
|
17
|
-
ngio/images/_create.py,sha256=XYn30m_2OSZeHHASYHc3eK9u_gZIYy9wo6mGdRGaq5c,9473
|
|
18
|
-
ngio/images/_image.py,sha256=B9MTk3Cei-FBR4jbhSujTSNcKM_ySape28yXR_JlY0A,17980
|
|
19
|
-
ngio/images/_label.py,sha256=Q1vPrXDcjJ7Gdd0wDz6NCVYQLNe1Ae6YDI4iK0oq31s,10557
|
|
20
|
-
ngio/images/_masked_image.py,sha256=sd6aQetNVwtDkwUvKX-lssQyHzt5m-CYZL8ZFkwDSn8,8533
|
|
21
|
-
ngio/images/_ome_zarr_container.py,sha256=CygzzFMYFT35ztLSPKe6iKLzCtgCnVWk8M9xOj6Tc5U,31221
|
|
22
|
-
ngio/ome_zarr_meta/__init__.py,sha256=oZ8PEsWM7U0KwzpsnvVfX9k4UfuTz5sZ8B6B9eY5hyY,1193
|
|
23
|
-
ngio/ome_zarr_meta/_meta_handlers.py,sha256=ctknNDT8jxwyvxQf9on5gW31H1tRRsnneO38GT2UXoE,25880
|
|
24
|
-
ngio/ome_zarr_meta/ngio_specs/__init__.py,sha256=05NQukZG0nNvjzf8AKWGu7PhjhQcImGSAOK3D3Bg-Js,1786
|
|
25
|
-
ngio/ome_zarr_meta/ngio_specs/_axes.py,sha256=tHtx6NfBgDcCgDk9CosjIjw1KZJ2qi0i_eoLgrdiEWw,16681
|
|
26
|
-
ngio/ome_zarr_meta/ngio_specs/_channels.py,sha256=Jwys1yYC8q6_gIaJ52KcKcTP7hzqVjBE-VlVQvJurCs,15394
|
|
27
|
-
ngio/ome_zarr_meta/ngio_specs/_dataset.py,sha256=hY8ogPPxvCgVg6k02t3zUr24lasYrvnxBd1iPEigdG4,5892
|
|
28
|
-
ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py,sha256=uh345KQmEQtslIyMmLK9sB-NbjPYxi0Y9FuYIFhd3Rc,17465
|
|
29
|
-
ngio/ome_zarr_meta/ngio_specs/_ngio_image.py,sha256=8E38Mgw-l0Ff1nkmCJIzo64G_paAVhM8xktUS_V5egY,17960
|
|
30
|
-
ngio/ome_zarr_meta/ngio_specs/_pixel_size.py,sha256=5TT8250XdCKUnk3OwZeyXIMNFKOg_jx4NnoCo9RLsXI,4079
|
|
31
|
-
ngio/ome_zarr_meta/v04/__init__.py,sha256=dJRzzxyYc81kf-0Hip_bqvbdManaM8XTdQX2meWyCSs,583
|
|
32
|
-
ngio/ome_zarr_meta/v04/_custom_models.py,sha256=5GxiDERvLuvq4QvApcA6EiKLS6hLFX1R0R_9rSaa85A,530
|
|
33
|
-
ngio/ome_zarr_meta/v04/_v04_spec_utils.py,sha256=05tEr2eEP_XVIfBMOAWLT7lzJV4KS5eYrpK8l94tn3w,15876
|
|
34
|
-
ngio/tables/__init__.py,sha256=_BV3sclNMLITu_J8_3DkkUrCB6Kro0HzeWLDCD1ivKM,877
|
|
35
|
-
ngio/tables/_abstract_table.py,sha256=rwGa47TzbFmosucBWVfFq6JEXtgGvOdUVtU9DIelV88,8204
|
|
36
|
-
ngio/tables/_tables_container.py,sha256=3xmpREaN671l40MPprnl1BD-VoOb6xfjECb5mNoMW0w,12173
|
|
37
|
-
ngio/tables/backends/__init__.py,sha256=MwSRXNF1rWQBFOTDA_vT3oGoNZpviVgytsL5Txnu08I,1619
|
|
38
|
-
ngio/tables/backends/_abstract_backend.py,sha256=tsbHzSPTX88fiCbVc8khXv5aN68ck6HKG8r5OHkY3S8,7457
|
|
39
|
-
ngio/tables/backends/_anndata.py,sha256=EdzGH0Zr85GBjVVBy3OxnRoDGgsi5zZLWRWpSLF2GhQ,2832
|
|
40
|
-
ngio/tables/backends/_anndata_utils.py,sha256=DBWIcR0btnH-DIvDvzlcnMXoYhhtXc9DstryiOP0Qsg,3122
|
|
41
|
-
ngio/tables/backends/_csv.py,sha256=Ev61D-AUKo4LIhXRmWPJgYbHI7eQdxiajQR574DevEM,932
|
|
42
|
-
ngio/tables/backends/_json.py,sha256=1ZsEuXDJm1rOZV_KjFm8CB0qhv7L1W7L2EGWPf4q_p0,3137
|
|
43
|
-
ngio/tables/backends/_non_zarr_backends.py,sha256=SvPPhT6n5TrKUOyV1mNcdHQK49huZ5lwR8EVe9MdydM,7254
|
|
44
|
-
ngio/tables/backends/_parquet.py,sha256=ic-p86h8lce8q9luBJGRzy6vxlWyJvA0-2l5cUD6OqY,1398
|
|
45
|
-
ngio/tables/backends/_table_backends.py,sha256=56lMLrkmRS8-NTwNF0wkMzrRwTmOFLk1g_LBDA2i6wg,7318
|
|
46
|
-
ngio/tables/backends/_utils.py,sha256=tJBSWN6OhO_1ybxl4vT2l3ImB028Fb6h0vaitPRcr8A,19668
|
|
47
|
-
ngio/tables/v1/__init__.py,sha256=Wr1_9RZFpaN8FYMTnxT9Yjkw4AS7y9FMWailmB_uj5g,617
|
|
48
|
-
ngio/tables/v1/_condition_table.py,sha256=T0Uq5BKkmMoEspt_Rx0U99Ow6S9GAMZDHqvUO5obCAM,1780
|
|
49
|
-
ngio/tables/v1/_feature_table.py,sha256=n9uMHwoBh-_dlOhUXCFbmAjXFVXncNCR3SjE2qzXI68,3821
|
|
50
|
-
ngio/tables/v1/_generic_table.py,sha256=1ktJHeuv7U1g5Z8PFUuTkCjOzcYMQd8xegKHKUedJB8,1240
|
|
51
|
-
ngio/tables/v1/_roi_table.py,sha256=DgXhp-DHTeEJwzSsSRSlnPghjMhYGa3IGSpwTt5LKZU,13603
|
|
52
|
-
ngio/utils/__init__.py,sha256=VxPVDKF0QF9HtG8wY0J6PXESNcWLaMXQNZiw5dHflBU,1179
|
|
53
|
-
ngio/utils/_datasets.py,sha256=2g-Neg78dNcqyDz39QQw-Ifp9GITHjVHisdqgvvDNDE,5475
|
|
54
|
-
ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
|
|
55
|
-
ngio/utils/_fractal_fsspec_store.py,sha256=RdcCFOgHexRKX9zZvJV5RI-5OPc7VOPS6q_IeRxm24I,1548
|
|
56
|
-
ngio/utils/_logger.py,sha256=HIuqD_2ShfFGDswBddcouStbKfL0Vz_ah8cAIFGhbS8,888
|
|
57
|
-
ngio/utils/_zarr_utils.py,sha256=qOI-HL2HsfFLCj_yxsTR-aq4oHpSqS9KR13aEIvhGDY,13593
|
|
58
|
-
ngio-0.3.4.dist-info/METADATA,sha256=CejDvwMriZ2JvTO2bLW3AA0W3zlAGmWjU10Hw20thy8,5868
|
|
59
|
-
ngio-0.3.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
60
|
-
ngio-0.3.4.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
|
|
61
|
-
ngio-0.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|