ngio 0.5.0a1__py3-none-any.whl → 0.5.0a3__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.
Files changed (48) hide show
  1. ngio/__init__.py +2 -2
  2. ngio/common/__init__.py +11 -6
  3. ngio/common/_masking_roi.py +12 -41
  4. ngio/common/_pyramid.py +218 -78
  5. ngio/common/_roi.py +257 -329
  6. ngio/experimental/iterators/_feature.py +3 -3
  7. ngio/experimental/iterators/_rois_utils.py +10 -11
  8. ngio/hcs/_plate.py +114 -123
  9. ngio/images/_abstract_image.py +417 -35
  10. ngio/images/_create_synt_container.py +36 -43
  11. ngio/images/_create_utils.py +423 -0
  12. ngio/images/_image.py +155 -177
  13. ngio/images/_label.py +144 -119
  14. ngio/images/_ome_zarr_container.py +361 -196
  15. ngio/io_pipes/_io_pipes.py +9 -9
  16. ngio/io_pipes/_io_pipes_masked.py +7 -7
  17. ngio/io_pipes/_io_pipes_roi.py +6 -6
  18. ngio/io_pipes/_io_pipes_types.py +3 -3
  19. ngio/io_pipes/_match_shape.py +5 -4
  20. ngio/io_pipes/_ops_slices_utils.py +8 -5
  21. ngio/ome_zarr_meta/__init__.py +15 -18
  22. ngio/ome_zarr_meta/_meta_handlers.py +334 -713
  23. ngio/ome_zarr_meta/ngio_specs/_axes.py +1 -0
  24. ngio/ome_zarr_meta/ngio_specs/_dataset.py +13 -22
  25. ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py +54 -61
  26. ngio/ome_zarr_meta/ngio_specs/_ngio_image.py +14 -68
  27. ngio/ome_zarr_meta/v04/__init__.py +1 -1
  28. ngio/ome_zarr_meta/v04/{_v04_spec_utils.py → _v04_spec.py} +16 -61
  29. ngio/ome_zarr_meta/v05/__init__.py +1 -1
  30. ngio/ome_zarr_meta/v05/{_v05_spec_utils.py → _v05_spec.py} +18 -61
  31. ngio/tables/_tables_container.py +25 -20
  32. ngio/tables/backends/_anndata.py +57 -8
  33. ngio/tables/backends/_anndata_utils.py +1 -6
  34. ngio/tables/backends/_csv.py +3 -19
  35. ngio/tables/backends/_json.py +10 -13
  36. ngio/tables/backends/_parquet.py +3 -31
  37. ngio/tables/backends/_py_arrow_backends.py +222 -0
  38. ngio/tables/v1/_roi_table.py +44 -27
  39. ngio/utils/__init__.py +6 -12
  40. ngio/utils/_cache.py +48 -0
  41. ngio/utils/_zarr_utils.py +285 -245
  42. {ngio-0.5.0a1.dist-info → ngio-0.5.0a3.dist-info}/METADATA +8 -4
  43. {ngio-0.5.0a1.dist-info → ngio-0.5.0a3.dist-info}/RECORD +45 -45
  44. {ngio-0.5.0a1.dist-info → ngio-0.5.0a3.dist-info}/WHEEL +1 -1
  45. ngio/images/_create.py +0 -283
  46. ngio/tables/backends/_non_zarr_backends.py +0 -196
  47. ngio/utils/_logger.py +0 -50
  48. {ngio-0.5.0a1.dist-info → ngio-0.5.0a3.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngio
3
- Version: 0.5.0a1
3
+ Version: 0.5.0a3
4
4
  Summary: Next Generation file format IO
5
5
  Project-URL: homepage, https://github.com/BioVisionCenter/ngio
6
6
  Project-URL: repository, https://github.com/BioVisionCenter/ngio
@@ -17,8 +17,8 @@ Classifier: Typing :: Typed
17
17
  Requires-Python: <3.14,>=3.11
18
18
  Requires-Dist: aiohttp
19
19
  Requires-Dist: anndata
20
- Requires-Dist: dask[array]
21
- Requires-Dist: dask[distributed]
20
+ Requires-Dist: dask[array]<2025.11.0
21
+ Requires-Dist: dask[distributed]<2025.11.0
22
22
  Requires-Dist: filelock
23
23
  Requires-Dist: numpy
24
24
  Requires-Dist: ome-zarr-models
@@ -31,7 +31,6 @@ Requires-Dist: pydantic
31
31
  Requires-Dist: requests
32
32
  Requires-Dist: zarr>3
33
33
  Provides-Extra: dev
34
- Requires-Dist: devtools; extra == 'dev'
35
34
  Requires-Dist: matplotlib; extra == 'dev'
36
35
  Requires-Dist: mypy; extra == 'dev'
37
36
  Requires-Dist: napari; extra == 'dev'
@@ -60,8 +59,13 @@ Requires-Dist: rich; extra == 'docs'
60
59
  Requires-Dist: scikit-image; extra == 'docs'
61
60
  Requires-Dist: tabulate; extra == 'docs'
62
61
  Provides-Extra: test
62
+ Requires-Dist: boto; extra == 'test'
63
+ Requires-Dist: devtools; extra == 'test'
64
+ Requires-Dist: moto[server]; extra == 'test'
63
65
  Requires-Dist: pytest; extra == 'test'
64
66
  Requires-Dist: pytest-cov; extra == 'test'
67
+ Requires-Dist: pytest-httpserver; extra == 'test'
68
+ Requires-Dist: s3fs; extra == 'test'
65
69
  Requires-Dist: scikit-image; extra == 'test'
66
70
  Description-Content-Type: text/markdown
67
71
 
@@ -1,56 +1,56 @@
1
- ngio/__init__.py,sha256=rEgnXuU6TCejUUGsxt4eKmjMhxjYh0fYBxWF4o5YjbE,1435
2
- ngio/common/__init__.py,sha256=aPSuUbdGryrxbnlWrsVNe3LZoBAWC4GijR1BNH1UwuU,612
1
+ ngio/__init__.py,sha256=A7o63AVFPNbhOpePPOb-BZvszc52tNqp2NW277h3rAo,1433
2
+ ngio/common/__init__.py,sha256=F3zAHQIhwig1xUA-SpmFVRtMeOrEj926-nHWhj-wS6c,684
3
3
  ngio/common/_dimensions.py,sha256=w8PYgyWxA8hgJETjFbw5CXf7WrasCL5FbzgfL1in86M,11361
4
- ngio/common/_masking_roi.py,sha256=ZZTXordEZoq_ADk0OzADvq-5dPOwUBSuNobzFR8fpTw,5697
5
- ngio/common/_pyramid.py,sha256=186eQSCxP_x2heYKmMP_Edl4Aml9Eo1bBmIHlwslqy8,8699
6
- ngio/common/_roi.py,sha256=9fKFTHoUiP0xmxvQiFkNmIuwWg3bFuRaAx-froCSqvA,11487
4
+ ngio/common/_masking_roi.py,sha256=YSEZ5nv3-TqMrQ04cI70U9NGx3LSy7Z1_cbw_NE-78k,4831
5
+ ngio/common/_pyramid.py,sha256=vPlxHUWBmfw6BtRoZeA7YNu3ft1YdAzyW1tWG8gA_to,14117
6
+ ngio/common/_roi.py,sha256=UMr7ie7dIZ6gMcM0_AlFMev_PRKxBdzUy_1WKRZ4zQU,11403
7
7
  ngio/common/_synt_images_utils.py,sha256=B6uYOW1NyrM06YMR-csca3_YnAAkPRTbvnbLdy9tk9E,3188
8
8
  ngio/common/_zoom.py,sha256=U01c-vqXjzZkrpd9Yvs24frVfTls_xPJeeaFCGmUwYI,6727
9
9
  ngio/experimental/__init__.py,sha256=3pmBtHi-i8bKjTsvrOJM56ZyRX3Pv_dceCdt88-8COQ,147
10
10
  ngio/experimental/iterators/__init__.py,sha256=TECOMGb5PEEZ0yXxt8pqIGvLKG41g_L1fTJU-zGPeV8,488
11
11
  ngio/experimental/iterators/_abstract_iterator.py,sha256=7aAoMI-6vYGCMKxO3M10WpuBMTdqX4zr0K-TutAOp88,13195
12
- ngio/experimental/iterators/_feature.py,sha256=g03yHIzYpTVeD3KUq2a4TwX29Dt48XaaGdZNSykYy7M,6749
12
+ ngio/experimental/iterators/_feature.py,sha256=OnqeSP-UMWku7AIBcutsDsAWqnFqPrjCJiMvMGM96fk,6714
13
13
  ngio/experimental/iterators/_image_processing.py,sha256=cM7sL7xgdcjSOKAu-6367Aov89o6wgiJ_wqCGkU2Bsw,5091
14
14
  ngio/experimental/iterators/_mappers.py,sha256=VVVsjems57wJUnWeufUFcgqa23k7VPeFL4Nc04HVw4o,1399
15
- ngio/experimental/iterators/_rois_utils.py,sha256=Q-8lQ26neYn63h_RvfypYqvrq2UUN2O3xqVe57k_ufU,4363
15
+ ngio/experimental/iterators/_rois_utils.py,sha256=5foGjt3qrACNrO29LlvSUbJ4yfI0z6MhU2oVCzEU214,4363
16
16
  ngio/experimental/iterators/_segmentation.py,sha256=xzotGvTn04HPeMeXZ_URnQqWco6d2lH6Ng6vkCUh9NM,9153
17
17
  ngio/hcs/__init__.py,sha256=G8j9vD-liLeB_UeGtKYIgshWvJnUA6ks9GwjvWBLdHs,357
18
- ngio/hcs/_plate.py,sha256=qfRwbCKaoz_AWTi8RDFFwOxy5geSknfJrPcqFVno9zI,44288
18
+ ngio/hcs/_plate.py,sha256=-8Ffx07s73jKTDKBj11yrJTtfNfwBP0DwUbzJQKPCWM,43503
19
19
  ngio/images/__init__.py,sha256=9Whvt7GTiCgT_vXaEEqGnDaY1-UsRk3dhLTv091F_g4,1211
20
- ngio/images/_abstract_image.py,sha256=hrB9xn4MFRxnxE1d7HKnM8SXVPUGhMD9u32yBHTsFiU,18517
21
- ngio/images/_create.py,sha256=OirIKg843CCSiwy_oUolX2UHlROR_iO4rN_IK47jDWc,10448
22
- ngio/images/_create_synt_container.py,sha256=D3SkjYN_AZ5fSefjEX0iQ3ZGEuBTWZvuPQIwHc6l-CU,5519
23
- ngio/images/_image.py,sha256=JWN7qmNVZxAzm9zmaImYseDt8xzYtOw-N0olR6VQo_8,33483
24
- ngio/images/_label.py,sha256=sJUB8of7t1YErZRu3t7jzGjlRn3KAAs0EL5nFrbvvlc,11921
20
+ ngio/images/_abstract_image.py,sha256=xCpI--oe9B81s3A99JGSYNiZzN-DaYheUJoP19n9Uwg,31915
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=YSO6dzEKdrgh4AE-cE4j_hxsU4QBpxUc_j6-Xpq5YqM,33664
24
+ ngio/images/_label.py,sha256=Y7Y0yLgoRUJtRzqgNPWc1yZ3HgDu4bbXbwhQJlnPKA8,14047
25
25
  ngio/images/_masked_image.py,sha256=YhbBzgPZMav6rX0WYue1BaxAzEIsfaQrxUIOK6ZWZcw,18848
26
- ngio/images/_ome_zarr_container.py,sha256=tfG40PLNfyfaR2pVAmGINlkKJRoQ4W0L0melFotMcP8,38737
26
+ ngio/images/_ome_zarr_container.py,sha256=_fI23IHb1iuhgLUqWdVvOwbFKtFpLY3J6y_k_i6mkjA,46044
27
27
  ngio/images/_table_ops.py,sha256=jFv_AMqoB4JBpoWsMtZppZVW7dAOC_u-JpfNm8b33kY,15292
28
28
  ngio/io_pipes/__init__.py,sha256=arW_7GWzZs82kPNKdm_6B1sIDFV0lWwp-ZaORr9Q1FQ,2412
29
- ngio/io_pipes/_io_pipes.py,sha256=KuwMYofE11EKx0iplWXBQZ-eE1A9YpGDprWh98cUlAI,10710
30
- ngio/io_pipes/_io_pipes_masked.py,sha256=077j1XNgyCNOHlOsbjPOWcLtb2ccFvbLp-cPzWL1j3c,16999
31
- ngio/io_pipes/_io_pipes_roi.py,sha256=cu_vd4MTDuyiabCWQ5ieMLI4v3tu_twSEe4X5-3bp84,4543
32
- ngio/io_pipes/_io_pipes_types.py,sha256=xCeUd9rZe2wsgoZR1pUq6L4LSeawoPsb-9pmz5C6ztA,1393
33
- ngio/io_pipes/_match_shape.py,sha256=eDy_Eqzld08m9zDuIjAvJnIhWh_HVjQS-5Pw9BMjdbw,13200
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
34
  ngio/io_pipes/_ops_axes.py,sha256=Geg4ZXxB0njWWopX9YeiwRJJ9Ef2GKfG0NIUafOmi2c,10043
35
35
  ngio/io_pipes/_ops_slices.py,sha256=hHMIOQ_niUSK9uFl8P2-10dP_K4GX3Do6vivN4fGRE0,14520
36
- ngio/io_pipes/_ops_slices_utils.py,sha256=xjDaCVGmtME5Q0XSmGrY3nUKYgw5jOBQZW4YDq5s4vE,6580
36
+ ngio/io_pipes/_ops_slices_utils.py,sha256=mps_I0eTI4gdBVM9MCKsd8rCyefdo9bIK9fEmqwr23E,6633
37
37
  ngio/io_pipes/_ops_transforms.py,sha256=uITs6v6sZ7DQ_Hpw3JdX8MuPOzir-bihvGzY84Qn4wY,2934
38
38
  ngio/io_pipes/_zoom_transform.py,sha256=WBY1tO6_Qhf8FaDujfTdipuuqFf7PSi204wx5VKKs88,6884
39
- ngio/ome_zarr_meta/__init__.py,sha256=tzxW2oVhfeMBVuv3XkcbOLzMnbDvUnie-AVsvSxRkdE,1265
40
- ngio/ome_zarr_meta/_meta_handlers.py,sha256=P2Edraf2MlTMlwFOpXCkUqD1QTN2nTwGv5Ff0ab5csw,26715
39
+ ngio/ome_zarr_meta/__init__.py,sha256=3_QbSt-Ta8MXL8R_tGmgrYMGePgawI96Hc5msrbZCgM,1139
40
+ ngio/ome_zarr_meta/_meta_handlers.py,sha256=70R0waA1BNX7yNOZnvVuNBeIIxkzGQN6xEKebFpYFx0,13673
41
41
  ngio/ome_zarr_meta/ngio_specs/__init__.py,sha256=U2FqZR91Ob2N6CqKdyw-_Ll-wMgmGuPZGVRCr6wuRFY,1698
42
- ngio/ome_zarr_meta/ngio_specs/_axes.py,sha256=gNzxCddn53m9dlNJlV5CL-aQS-nGJrbCDGfAp5L97LY,16412
42
+ ngio/ome_zarr_meta/ngio_specs/_axes.py,sha256=CY63mWf7_ALoi7o_1QDVK1lAG56xN0gvgwfcuNRmMIg,16446
43
43
  ngio/ome_zarr_meta/ngio_specs/_channels.py,sha256=TDxIy-yVc2YaWPIFJRYnYwZbA8O5Ee_OiWppHYrEdpU,16647
44
- ngio/ome_zarr_meta/ngio_specs/_dataset.py,sha256=CrHnjVWBGYPqErKkHR-E2DKrE3DmGznXMkd3Y9Z4uYo,3434
45
- ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py,sha256=N1CGPOubwf0pvm8tiTnh-C1cOu9lToyDe3WagnEnPN4,17207
46
- ngio/ome_zarr_meta/ngio_specs/_ngio_image.py,sha256=y44AVdB7IQD9t5yiZV6cXSvV9_-CGDiYrCfX3PeaclQ,16231
44
+ ngio/ome_zarr_meta/ngio_specs/_dataset.py,sha256=5YdAplk90koX3vjoIJimms-CJYxt095rJ9YagZSQg88,2872
45
+ ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py,sha256=_KM9Ql-sBL1zV_OLhDiFBj9QhEjwVcW8W5sMUA7xtzM,16944
46
+ ngio/ome_zarr_meta/ngio_specs/_ngio_image.py,sha256=kjlC2Otz7z__ojrSHYsFJaQW_OKNQoevVlAn1cZYNJs,14442
47
47
  ngio/ome_zarr_meta/ngio_specs/_pixel_size.py,sha256=4VF1djY9T5tp6GCJXppFrUJwALI1XgIm0imoM5rNvdE,3876
48
- ngio/ome_zarr_meta/v04/__init__.py,sha256=dJRzzxyYc81kf-0Hip_bqvbdManaM8XTdQX2meWyCSs,583
48
+ ngio/ome_zarr_meta/v04/__init__.py,sha256=WHT8RFLxqx9QBtm8wwg8tZ_EBuC1l8PG_JxwFl02Tk4,577
49
49
  ngio/ome_zarr_meta/v04/_custom_models.py,sha256=5GxiDERvLuvq4QvApcA6EiKLS6hLFX1R0R_9rSaa85A,530
50
- ngio/ome_zarr_meta/v04/_v04_spec_utils.py,sha256=xa3DT7VJJZyd-4EB-KGjlPcKkTmst_izTcoWj30mLiY,15766
51
- ngio/ome_zarr_meta/v05/__init__.py,sha256=j6YuIKu2bxmhlhFCbhXg5UA4qD7V8CpyTAHl1vnIpq8,583
50
+ ngio/ome_zarr_meta/v04/_v04_spec.py,sha256=qmp9xAfA2z9UErrs4xvS0qmO5G8Dli-CenAL3rO4TFo,14348
51
+ ngio/ome_zarr_meta/v05/__init__.py,sha256=zGWjeVCXQX7ezs4hEmmLrgOcQNhR6nZJ4LXKpj1oCfE,577
52
52
  ngio/ome_zarr_meta/v05/_custom_models.py,sha256=ZN3bE9nwx4y3tElhsYafI4S2zp_WzdkQKcyuuBiaXXo,530
53
- ngio/ome_zarr_meta/v05/_v05_spec_utils.py,sha256=vd9-EiZZjBpCXmwgLj8a1RWiwFpSjjxKBfbH8OpsG9M,16493
53
+ ngio/ome_zarr_meta/v05/_v05_spec.py,sha256=JBZrm3BRZVbxHB29UFsfo3tuedhpMdy8KuWf4vDL3_g,15134
54
54
  ngio/resources/__init__.py,sha256=4E4TXTNYEgRHt26C1XcC4pPobJJsmZRYm1Ml4uAuAkE,1664
55
55
  ngio/resources/resource_model.py,sha256=eE1m0dyk-2psPC4X8Ifyan524QHUOd52TEQdvoU0m8I,861
56
56
  ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/mask.png,sha256=g3QmxQdmeciAtBe5cTCRfR6yw3keG9cBYfjizMo6EGo,11890
@@ -58,31 +58,31 @@ ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/nuclei.png,sha
58
58
  ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/raw.jpg,sha256=82lejQAIokj5w9g-qqhysDTWpHtNvJTkdURG_BjqIxQ,37743
59
59
  ngio/tables/__init__.py,sha256=_BV3sclNMLITu_J8_3DkkUrCB6Kro0HzeWLDCD1ivKM,877
60
60
  ngio/tables/_abstract_table.py,sha256=rwGa47TzbFmosucBWVfFq6JEXtgGvOdUVtU9DIelV88,8204
61
- ngio/tables/_tables_container.py,sha256=3xmpREaN671l40MPprnl1BD-VoOb6xfjECb5mNoMW0w,12173
61
+ ngio/tables/_tables_container.py,sha256=DV_uX_bf3kCcmWLFKjY9FhKX8iBewbHkZSECqKjsCIw,12333
62
62
  ngio/tables/backends/__init__.py,sha256=MwSRXNF1rWQBFOTDA_vT3oGoNZpviVgytsL5Txnu08I,1619
63
63
  ngio/tables/backends/_abstract_backend.py,sha256=M1ogsBpWBiQMV65YweZhA845PAtkzG2BsZCPN_7Xp8U,7613
64
- ngio/tables/backends/_anndata.py,sha256=KBzXVxaXstVx3ofcLYYFm8ECVFDaHxfUWcKdg5vQPqY,2992
65
- ngio/tables/backends/_anndata_utils.py,sha256=g0mIfihXd4p75bvMvCYTljBKTP13EZ9p_SVMifDKE3Y,3208
66
- ngio/tables/backends/_csv.py,sha256=Ev61D-AUKo4LIhXRmWPJgYbHI7eQdxiajQR574DevEM,932
67
- ngio/tables/backends/_json.py,sha256=1ZsEuXDJm1rOZV_KjFm8CB0qhv7L1W7L2EGWPf4q_p0,3137
68
- ngio/tables/backends/_non_zarr_backends.py,sha256=5a1fbxiVnUXt1tiA025BqN0T7SQJvIERFtQHp4PhFHw,7294
69
- ngio/tables/backends/_parquet.py,sha256=ic-p86h8lce8q9luBJGRzy6vxlWyJvA0-2l5cUD6OqY,1398
64
+ ngio/tables/backends/_anndata.py,sha256=brJaTZCBe_ipexWbGQgFM2-B30sRKI1kxNLuSTcY2uE,4546
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
70
  ngio/tables/backends/_table_backends.py,sha256=ksP2NAosXZkNMZf-IMrLx7bjQgp_eKfvPYK4vMdT1A8,7250
71
71
  ngio/tables/backends/_utils.py,sha256=t4dLXSPxx2AnJvVtj0GIwrLoO11h4Ges6U7hj4md0hY,19730
72
72
  ngio/tables/v1/__init__.py,sha256=Wr1_9RZFpaN8FYMTnxT9Yjkw4AS7y9FMWailmB_uj5g,617
73
73
  ngio/tables/v1/_condition_table.py,sha256=T0Uq5BKkmMoEspt_Rx0U99Ow6S9GAMZDHqvUO5obCAM,1780
74
74
  ngio/tables/v1/_feature_table.py,sha256=n9uMHwoBh-_dlOhUXCFbmAjXFVXncNCR3SjE2qzXI68,3821
75
75
  ngio/tables/v1/_generic_table.py,sha256=1ktJHeuv7U1g5Z8PFUuTkCjOzcYMQd8xegKHKUedJB8,1240
76
- ngio/tables/v1/_roi_table.py,sha256=g7UpMmpf3uAfaG59WYRnimUBgiB_T1qUJRwMZpMt9cI,17099
76
+ ngio/tables/v1/_roi_table.py,sha256=DuKJlDmtQtLOfL0g4CSdncfm4hBsKWG6F6fkMUpt4Nk,17821
77
77
  ngio/transforms/__init__.py,sha256=JA0-Ui7skbXkm9ofN-AEhU1FTLutkMkwTdVD-310frQ,113
78
78
  ngio/transforms/_zoom.py,sha256=otyE-vxFnywUJ8U4mHjat-bNG_7_jv62ckTpqDMxyVQ,550
79
- ngio/utils/__init__.py,sha256=XPYh8ehC7uXNU2cFFXZAw-S3DpWpX1Yq2xGkffZv5vI,1142
79
+ ngio/utils/__init__.py,sha256=1eIInpFEEWQtMeGaRhAyVjqSKWUCuksMkx2cqg9D9nI,987
80
+ ngio/utils/_cache.py,sha256=Ey9fgc_BTdMyqg6c80C0CuGDhOafln8-3e_1MQ0MFzw,1283
80
81
  ngio/utils/_datasets.py,sha256=6GtxfPkjutNaeg5BHuJDBP0GudvQXHLU6mmHp_o0bGA,5650
81
82
  ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
82
83
  ngio/utils/_fractal_fsspec_store.py,sha256=RdcCFOgHexRKX9zZvJV5RI-5OPc7VOPS6q_IeRxm24I,1548
83
- ngio/utils/_logger.py,sha256=N5W0a_xwze4blS1MolidBkTMbjTbg8GPguJZNun3mAE,1392
84
- ngio/utils/_zarr_utils.py,sha256=ATehiEALPI__eNQSWdSW5PpJLmI2FECrexA9jTZAI2s,16103
85
- ngio-0.5.0a1.dist-info/METADATA,sha256=AT0kbnHlYkhiL0_AmZpOm8DagaEPGCkI1xze_cJy3w8,6104
86
- ngio-0.5.0a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
87
- ngio-0.5.0a1.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
88
- ngio-0.5.0a1.dist-info/RECORD,,
84
+ ngio/utils/_zarr_utils.py,sha256=asAmD4FSFspyAfIDB8ISwHLCZYctsKENyCCAQHEfubA,17817
85
+ ngio-0.5.0a3.dist-info/METADATA,sha256=yvzf4IseuuNv8cAvtQLnrWwrdbZYVl422KnEjnQpyQc,6294
86
+ ngio-0.5.0a3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
87
+ ngio-0.5.0a3.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
88
+ ngio-0.5.0a3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
ngio/images/_create.py DELETED
@@ -1,283 +0,0 @@
1
- """Utility functions for working with OME-Zarr images."""
2
-
3
- from collections.abc import Sequence
4
- from typing import Literal, TypeVar
5
-
6
- from zarr.core.array import CompressorLike
7
-
8
- from ngio.common._pyramid import init_empty_pyramid
9
- from ngio.ome_zarr_meta import (
10
- NgioImageMeta,
11
- NgioLabelMeta,
12
- PixelSize,
13
- get_image_meta_handler,
14
- get_label_meta_handler,
15
- )
16
- from ngio.ome_zarr_meta.ngio_specs import (
17
- DefaultNgffVersion,
18
- DefaultSpaceUnit,
19
- DefaultTimeUnit,
20
- NgffVersions,
21
- SpaceUnits,
22
- TimeUnits,
23
- canonical_axes_order,
24
- canonical_label_axes_order,
25
- )
26
- from ngio.utils import NgioValueError, StoreOrGroup, ZarrGroupHandler
27
-
28
- _image_or_label_meta = TypeVar("_image_or_label_meta", NgioImageMeta, NgioLabelMeta)
29
-
30
-
31
- def _init_generic_meta(
32
- meta_type: type[_image_or_label_meta],
33
- pixelsize: float,
34
- axes_names: Sequence[str],
35
- z_spacing: float = 1.0,
36
- time_spacing: float = 1.0,
37
- levels: int | list[str] = 5,
38
- yx_scaling_factor: float | tuple[float, float] = 2.0,
39
- z_scaling_factor: float = 1.0,
40
- space_unit: SpaceUnits | str | None = DefaultSpaceUnit,
41
- time_unit: TimeUnits | str | None = DefaultTimeUnit,
42
- name: str | None = None,
43
- version: NgffVersions = DefaultNgffVersion,
44
- ) -> tuple[_image_or_label_meta, list[float]]:
45
- """Initialize the metadata for an image or label."""
46
- scaling_factors = []
47
- for ax in axes_names:
48
- if ax == "z":
49
- scaling_factors.append(z_scaling_factor)
50
- elif ax in ["x"]:
51
- if isinstance(yx_scaling_factor, tuple):
52
- scaling_factors.append(yx_scaling_factor[1])
53
- else:
54
- scaling_factors.append(yx_scaling_factor)
55
- elif ax in ["y"]:
56
- if isinstance(yx_scaling_factor, tuple):
57
- scaling_factors.append(yx_scaling_factor[0])
58
- else:
59
- scaling_factors.append(yx_scaling_factor)
60
- else:
61
- scaling_factors.append(1.0)
62
-
63
- pixel_sizes = PixelSize(
64
- x=pixelsize,
65
- y=pixelsize,
66
- z=z_spacing,
67
- t=time_spacing,
68
- space_unit=space_unit,
69
- time_unit=time_unit,
70
- )
71
-
72
- meta = meta_type.default_init(
73
- name=name,
74
- levels=levels,
75
- axes_names=axes_names,
76
- pixel_size=pixel_sizes,
77
- scaling_factors=scaling_factors,
78
- version=version,
79
- )
80
- return meta, scaling_factors
81
-
82
-
83
- def create_empty_label_container(
84
- store: StoreOrGroup,
85
- shape: Sequence[int],
86
- pixelsize: float,
87
- z_spacing: float = 1.0,
88
- time_spacing: float = 1.0,
89
- levels: int | list[str] = 5,
90
- yx_scaling_factor: float | tuple[float, float] = 2.0,
91
- z_scaling_factor: float = 1.0,
92
- space_unit: SpaceUnits | str | None = DefaultSpaceUnit,
93
- time_unit: TimeUnits | str | None = DefaultTimeUnit,
94
- axes_names: Sequence[str] | None = None,
95
- name: str | None = None,
96
- chunks: Sequence[int] | Literal["auto"] = "auto",
97
- dtype: str = "uint32",
98
- dimension_separator: Literal[".", "/"] = "/",
99
- compressors: CompressorLike = "auto",
100
- overwrite: bool = False,
101
- version: NgffVersions = DefaultNgffVersion,
102
- ) -> ZarrGroupHandler:
103
- """Create an empty label with the given shape and metadata.
104
-
105
- Args:
106
- store (StoreOrGroup): The Zarr store or group to create the image in.
107
- shape (Sequence[int]): The shape of the image.
108
- pixelsize (float): The pixel size in x and y dimensions.
109
- z_spacing (float, optional): The spacing between z slices. Defaults to 1.0.
110
- time_spacing (float, optional): The spacing between time points.
111
- Defaults to 1.0.
112
- levels (int | list[str], optional): The number of levels in the pyramid or a
113
- list of level names. Defaults to 5.
114
- yx_scaling_factor (float, optional): The down-scaling factor in x and y
115
- dimensions. Defaults to 2.0.
116
- z_scaling_factor (float, optional): The down-scaling factor in z dimension.
117
- Defaults to 1.0.
118
- space_unit (SpaceUnits, optional): The unit of space. Defaults to
119
- DefaultSpaceUnit.
120
- time_unit (TimeUnits, optional): The unit of time. Defaults to
121
- DefaultTimeUnit.
122
- axes_names (Sequence[str] | None, optional): The names of the axes.
123
- If None the canonical names are used. Defaults to None.
124
- name (str | None, optional): The name of the image. Defaults to None.
125
- chunks (Sequence[int] | Literal["auto"]): The chunk shape. If None the shape
126
- is used. Defaults to None.
127
- dimension_separator (DIMENSION_SEPARATOR): The separator to use for
128
- dimensions. Defaults to "/".
129
- compressors (CompressorLike): The compressors to use. Defaults to "auto".
130
- dtype (str, optional): The data type of the image. Defaults to "uint16".
131
- overwrite (bool, optional): Whether to overwrite an existing image.
132
- Defaults to True.
133
- version (str, optional): The version of the OME-Zarr specification.
134
- Defaults to DefaultVersion.
135
-
136
- """
137
- if axes_names is None:
138
- axes_names = canonical_label_axes_order()[-len(shape) :]
139
-
140
- if len(axes_names) != len(shape):
141
- raise NgioValueError(
142
- f"Number of axes names {axes_names} does not match the number of "
143
- f"dimensions {shape}."
144
- )
145
-
146
- meta, scaling_factors = _init_generic_meta(
147
- meta_type=NgioLabelMeta,
148
- pixelsize=pixelsize,
149
- z_spacing=z_spacing,
150
- time_spacing=time_spacing,
151
- levels=levels,
152
- yx_scaling_factor=yx_scaling_factor,
153
- z_scaling_factor=z_scaling_factor,
154
- space_unit=space_unit,
155
- time_unit=time_unit,
156
- axes_names=axes_names,
157
- name=name,
158
- version=version,
159
- )
160
-
161
- mode = "w" if overwrite else "w-"
162
- group_handler = ZarrGroupHandler(
163
- store=store, mode=mode, cache=False, zarr_format=meta.zarr_format
164
- )
165
- image_handler = get_label_meta_handler(version=version, group_handler=group_handler)
166
- image_handler.write_meta(meta)
167
-
168
- init_empty_pyramid(
169
- store=store,
170
- paths=meta.paths,
171
- scaling_factors=scaling_factors,
172
- ref_shape=shape,
173
- chunks=chunks,
174
- axes=axes_names,
175
- dtype=dtype,
176
- mode="a",
177
- dimension_separator=dimension_separator,
178
- compressors=compressors,
179
- )
180
- group_handler._mode = "r+"
181
- return group_handler
182
-
183
-
184
- def create_empty_image_container(
185
- store: StoreOrGroup,
186
- shape: Sequence[int],
187
- pixelsize: float,
188
- z_spacing: float = 1.0,
189
- time_spacing: float = 1.0,
190
- levels: int | list[str] = 5,
191
- yx_scaling_factor: float | tuple[float, float] = 2,
192
- z_scaling_factor: float = 1.0,
193
- space_unit: SpaceUnits | str | None = DefaultSpaceUnit,
194
- time_unit: TimeUnits | str | None = DefaultTimeUnit,
195
- axes_names: Sequence[str] | None = None,
196
- name: str | None = None,
197
- chunks: Sequence[int] | Literal["auto"] = "auto",
198
- dtype: str = "uint16",
199
- dimension_separator: Literal[".", "/"] = "/",
200
- compressors: CompressorLike = "auto",
201
- overwrite: bool = False,
202
- version: NgffVersions = DefaultNgffVersion,
203
- ) -> ZarrGroupHandler:
204
- """Create an empty OME-Zarr image with the given shape and metadata.
205
-
206
- Args:
207
- store (StoreOrGroup): The Zarr store or group to create the image in.
208
- shape (Sequence[int]): The shape of the image.
209
- pixelsize (float): The pixel size in x and y dimensions.
210
- z_spacing (float, optional): The spacing between z slices. Defaults to 1.0.
211
- time_spacing (float, optional): The spacing between time points.
212
- Defaults to 1.0.
213
- levels (int | list[str], optional): The number of levels in the pyramid or a
214
- list of level names. Defaults to 5.
215
- yx_scaling_factor (float, optional): The down-scaling factor in x and y
216
- dimensions. Defaults to 2.0.
217
- z_scaling_factor (float, optional): The down-scaling factor in z dimension.
218
- Defaults to 1.0.
219
- space_unit (SpaceUnits, optional): The unit of space. Defaults to
220
- DefaultSpaceUnit.
221
- time_unit (TimeUnits, optional): The unit of time. Defaults to
222
- DefaultTimeUnit.
223
- axes_names (Sequence[str] | None, optional): The names of the axes.
224
- If None the canonical names are used. Defaults to None.
225
- name (str | None, optional): The name of the image. Defaults to None.
226
- chunks (Sequence[int] | Literal["auto"]): The chunk shape. If None the shape
227
- is used. Defaults to None.
228
- dtype (str, optional): The data type of the image. Defaults to "uint16".
229
- dimension_separator (DIMENSION_SEPARATOR): The separator to use for
230
- dimensions. Defaults to "/".
231
- compressors (CompressorLike): The compressors to use. Defaults to "auto".
232
- overwrite (bool, optional): Whether to overwrite an existing image.
233
- Defaults to True.
234
- version (str, optional): The version of the OME-Zarr specification.
235
- Defaults to DefaultVersion.
236
-
237
- """
238
- if axes_names is None:
239
- axes_names = canonical_axes_order()[-len(shape) :]
240
-
241
- if len(axes_names) != len(shape):
242
- raise NgioValueError(
243
- f"Number of axes names {axes_names} does not match the number of "
244
- f"dimensions {shape}."
245
- )
246
-
247
- meta, scaling_factors = _init_generic_meta(
248
- meta_type=NgioImageMeta,
249
- pixelsize=pixelsize,
250
- z_spacing=z_spacing,
251
- time_spacing=time_spacing,
252
- levels=levels,
253
- yx_scaling_factor=yx_scaling_factor,
254
- z_scaling_factor=z_scaling_factor,
255
- space_unit=space_unit,
256
- time_unit=time_unit,
257
- axes_names=axes_names,
258
- name=name,
259
- version=version,
260
- )
261
- mode = "w" if overwrite else "w-"
262
- group_handler = ZarrGroupHandler(
263
- store=store, mode=mode, cache=False, zarr_format=meta.zarr_format
264
- )
265
- image_handler = get_image_meta_handler(version=version, group_handler=group_handler)
266
- image_handler.write_meta(meta)
267
-
268
- init_empty_pyramid(
269
- store=store,
270
- paths=meta.paths,
271
- scaling_factors=scaling_factors,
272
- ref_shape=shape,
273
- chunks=chunks,
274
- axes=axes_names,
275
- dtype=dtype,
276
- mode="a",
277
- dimension_separator=dimension_separator,
278
- compressors=compressors,
279
- zarr_format=meta.zarr_format,
280
- )
281
-
282
- group_handler._mode = "r+"
283
- return group_handler
@@ -1,196 +0,0 @@
1
- import io
2
- from collections.abc import Callable
3
- from typing import Any
4
-
5
- from pandas import DataFrame
6
- from polars import DataFrame as PolarsDataFrame
7
- from polars import LazyFrame
8
- from zarr.storage import FsspecStore, LocalStore
9
-
10
- from ngio.tables.backends._abstract_backend import AbstractTableBackend
11
- from ngio.tables.backends._utils import normalize_pandas_df, normalize_polars_lf
12
- from ngio.utils import NgioFileNotFoundError, NgioValueError
13
-
14
-
15
- class NonZarrBaseBackend(AbstractTableBackend):
16
- """A class to load and write small tables in CSV format."""
17
-
18
- def __init__(
19
- self,
20
- df_reader: Callable[[Any], DataFrame],
21
- lf_reader: Callable[[Any], LazyFrame],
22
- df_writer: Callable[[str, DataFrame], None],
23
- lf_writer: Callable[[str, PolarsDataFrame], None],
24
- table_name: str,
25
- ):
26
- self.df_reader = df_reader
27
- self.lf_reader = lf_reader
28
- self.df_writer = df_writer
29
- self.lf_writer = lf_writer
30
- self.table_name = table_name
31
-
32
- @staticmethod
33
- def implements_anndata() -> bool:
34
- """Whether the handler implements the anndata protocol."""
35
- return False
36
-
37
- @staticmethod
38
- def implements_pandas() -> bool:
39
- """Whether the handler implements the dataframe protocol."""
40
- return True
41
-
42
- @staticmethod
43
- def implements_polars() -> bool:
44
- """Whether the handler implements the polars protocol."""
45
- return True
46
-
47
- @staticmethod
48
- def backend_name() -> str:
49
- """Return the name of the backend."""
50
- raise NotImplementedError(
51
- "The backend_name method must be implemented in the subclass."
52
- )
53
-
54
- def _load_from_directory_store(self, reader):
55
- """Load the table from a directory store."""
56
- url = self._group_handler.full_url
57
- if url is None:
58
- ext = self.table_name.split(".")[-1]
59
- raise NgioValueError(
60
- f"Ngio does not support reading a {ext} table from a "
61
- f"store of type {type(self._group_handler)}. "
62
- "Please make sure to use a compatible "
63
- "store like a zarr.DirectoryStore."
64
- )
65
- table_path = f"{url}/{self.table_name}"
66
- dataframe = reader(table_path)
67
- return dataframe
68
-
69
- def _load_from_fs_store_df(self, reader):
70
- """Load the table from an FS store."""
71
- path = self._group_handler.group.path
72
- table_path = f"{path}/{self.table_name}"
73
- bytes_table = self._group_handler.store.get(table_path)
74
- if bytes_table is None:
75
- raise NgioFileNotFoundError(f"No table found at {table_path}. ")
76
- dataframe = reader(io.BytesIO(bytes_table))
77
- return dataframe
78
-
79
- def _load_from_fs_store_lf(self, reader):
80
- """Load the table from an FS store."""
81
- full_url = self._group_handler.full_url
82
- parquet_path = f"{full_url}/{self.table_name}"
83
- store_fs = self._group_handler.store.fs # type: ignore (in this context, store_fs is a fs.FSStore)
84
- with store_fs.open(parquet_path, "rb") as f:
85
- dataframe = reader(f)
86
- return dataframe
87
-
88
- def load_as_pandas_df(self) -> DataFrame:
89
- """Load the table as a pandas DataFrame."""
90
- store = self._group_handler.store
91
- if isinstance(store, LocalStore):
92
- dataframe = self._load_from_directory_store(reader=self.df_reader)
93
- elif isinstance(store, FsspecStore):
94
- dataframe = self._load_from_fs_store_df(reader=self.df_reader)
95
- else:
96
- ext = self.table_name.split(".")[-1]
97
- raise NgioValueError(
98
- f"Ngio does not support reading a {ext} table from a "
99
- f"store of type {type(store)}. "
100
- "Please make sure to use a compatible "
101
- "store like a zarr.DirectoryStore or "
102
- "zarr.FSStore."
103
- )
104
-
105
- dataframe = normalize_pandas_df(
106
- dataframe,
107
- index_key=self.index_key,
108
- index_type=self.index_type,
109
- reset_index=False,
110
- )
111
- return dataframe
112
-
113
- def load(self) -> DataFrame:
114
- """Load the table as a pandas DataFrame."""
115
- return self.load_as_pandas_df()
116
-
117
- def load_as_polars_lf(self) -> LazyFrame:
118
- """Load the table as a polars LazyFrame."""
119
- store = self._group_handler.store
120
- if isinstance(store, LocalStore):
121
- lazy_frame = self._load_from_directory_store(reader=self.lf_reader)
122
- elif isinstance(store, FsspecStore):
123
- lazy_frame = self._load_from_fs_store_lf(reader=self.lf_reader)
124
- else:
125
- ext = self.table_name.split(".")[-1]
126
- raise NgioValueError(
127
- f"Ngio does not support reading a {ext} from a "
128
- f"store of type {type(store)}. "
129
- "Please make sure to use a compatible "
130
- "store like a zarr.DirectoryStore or "
131
- "zarr.FSStore."
132
- )
133
- if not isinstance(lazy_frame, LazyFrame):
134
- raise NgioValueError(
135
- "Table is not a lazy frame. Please report this issue as an ngio bug."
136
- f" {type(lazy_frame)}"
137
- )
138
-
139
- lazy_frame = normalize_polars_lf(
140
- lazy_frame,
141
- index_key=self.index_key,
142
- index_type=self.index_type,
143
- )
144
- return lazy_frame
145
-
146
- def _get_store_url(self) -> str:
147
- """Get the store URL."""
148
- store = self._group_handler.store
149
- if isinstance(store, LocalStore):
150
- full_url = self._group_handler.full_url
151
- else:
152
- ext = self.table_name.split(".")[-1]
153
- raise NgioValueError(
154
- f"Ngio does not support writing a {ext} file to a "
155
- f"store of type {type(store)}. "
156
- "Please make sure to use a compatible "
157
- "store like a zarr.DirectoryStore or "
158
- "zarr.FSStore."
159
- )
160
- if full_url is None:
161
- ext = self.table_name.split(".")[-1]
162
- raise NgioValueError(
163
- f"Ngio does not support writing a {ext} file to a "
164
- f"store of type {type(store)}. "
165
- "Please make sure to use a compatible "
166
- "store like a zarr.DirectoryStore or "
167
- "zarr.FSStore."
168
- )
169
- return full_url
170
-
171
- def write_from_pandas(self, table: DataFrame) -> None:
172
- """Write the table from a pandas DataFrame."""
173
- table = normalize_pandas_df(
174
- table,
175
- index_key=self.index_key,
176
- index_type=self.index_type,
177
- reset_index=True,
178
- )
179
- full_url = self._get_store_url()
180
- table_path = f"{full_url}/{self.table_name}"
181
- self.df_writer(table_path, table)
182
-
183
- def write_from_polars(self, table: PolarsDataFrame | LazyFrame) -> None:
184
- """Write the table from a polars DataFrame or LazyFrame."""
185
- table = normalize_polars_lf(
186
- table,
187
- index_key=self.index_key,
188
- index_type=self.index_type,
189
- )
190
-
191
- if isinstance(table, LazyFrame):
192
- table = table.collect()
193
-
194
- full_url = self._get_store_url()
195
- table_path = f"{full_url}/{self.table_name}"
196
- self.lf_writer(table_path, table)