ngio 0.5.0b2__py3-none-any.whl → 0.5.0b3__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/common/_pyramid.py CHANGED
@@ -273,6 +273,10 @@ class PyramidLevel(BaseModel):
273
273
  "Shards must have the same length as shape "
274
274
  f"({len(self.shape)}), got {len(self.shards)}"
275
275
  )
276
+ normalized_shards = []
277
+ for dim_size, shard_size in zip(self.shape, self.shards, strict=True):
278
+ normalized_shards.append(min(dim_size, shard_size))
279
+ self.shards = tuple(normalized_shards)
276
280
  return self
277
281
 
278
282
 
@@ -800,7 +800,7 @@ def abstract_derive(
800
800
  channels_meta: Sequence[str | Channel] | None = None,
801
801
  ngff_version: NgffVersions | None = None,
802
802
  # Zarr Array parameters
803
- chunks: ChunksLike = "auto",
803
+ chunks: ChunksLike | None = None,
804
804
  shards: ShardsLike | None = None,
805
805
  dtype: str | None = None,
806
806
  dimension_separator: Literal[".", "/"] | None = None,
@@ -835,7 +835,7 @@ def abstract_derive(
835
835
  channels_meta (Sequence[str | Channel] | None): The channels metadata
836
836
  of the new image.
837
837
  ngff_version (NgffVersions | None): The NGFF version to use.
838
- chunks (Sequence[int] | None): The chunk shape of the new image.
838
+ chunks (ChunksLike | None): The chunk shape of the new image.
839
839
  shards (ShardsLike | None): The shard shape of the new image.
840
840
  dtype (str | None): The data type of the new image.
841
841
  dimension_separator (DIMENSION_SEPARATOR | None): The separator to use for
@@ -918,7 +918,7 @@ def abstract_derive(
918
918
 
919
919
  if chunks is None:
920
920
  chunks = ref_image.zarr_array.chunks
921
-
921
+ print(chunks)
922
922
  if shards is None:
923
923
  shards = ref_image.zarr_array.shards
924
924
 
ngio/images/_image.py CHANGED
@@ -613,9 +613,10 @@ class ImagesContainer:
613
613
  time_spacing: float | None = None,
614
614
  name: str | None = None,
615
615
  channels_meta: Sequence[str | Channel] | None = None,
616
+ channels_policy: Literal["same", "squeeze", "singleton"] | int = "same",
616
617
  ngff_version: NgffVersions | None = None,
617
618
  # Zarr Array parameters
618
- chunks: ChunksLike = "auto",
619
+ chunks: ChunksLike | None = None,
619
620
  shards: ShardsLike | None = None,
620
621
  dtype: str = "uint16",
621
622
  dimension_separator: Literal[".", "/"] = "/",
@@ -644,8 +645,15 @@ class ImagesContainer:
644
645
  name (str | None): The name of the new image.
645
646
  channels_meta (Sequence[str | Channel] | None): The channels metadata
646
647
  of the new image.
648
+ channels_policy (Literal["same", "squeeze", "singleton"] | int):
649
+ Possible policies:
650
+ - If "squeeze", the channels axis will be removed (no matter its size).
651
+ - If "same", the channels axis will be kept as is (if it exists).
652
+ - If "singleton", the channels axis will be set to size 1.
653
+ - If an integer is provided, the channels axis will be changed to have
654
+ that size.
647
655
  ngff_version (NgffVersions | None): The NGFF version to use.
648
- chunks (Sequence[int] | None): The chunk shape of the new image.
656
+ chunks (ChunksLike | None): The chunk shape of the new image.
649
657
  shards (ShardsLike | None): The shard shape of the new image.
650
658
  dtype (str | None): The data type of the new image.
651
659
  dimension_separator (DIMENSION_SEPARATOR | None): The separator to use for
@@ -674,6 +682,7 @@ class ImagesContainer:
674
682
  time_spacing=time_spacing,
675
683
  name=name,
676
684
  channels_meta=channels_meta,
685
+ channels_policy=channels_policy,
677
686
  ngff_version=ngff_version,
678
687
  chunks=chunks,
679
688
  shards=shards,
@@ -769,7 +778,7 @@ def derive_image_container(
769
778
  channels_meta: Sequence[str | Channel] | None = None,
770
779
  ngff_version: NgffVersions | None = None,
771
780
  # Zarr Array parameters
772
- chunks: ChunksLike = "auto",
781
+ chunks: ChunksLike | None = None,
773
782
  shards: ShardsLike | None = None,
774
783
  dtype: str | None = None,
775
784
  dimension_separator: Literal[".", "/"] | None = None,
@@ -804,7 +813,7 @@ def derive_image_container(
804
813
  channels_meta (Sequence[str | Channel] | None): The channels metadata
805
814
  of the new image.
806
815
  ngff_version (NgffVersions | None): The NGFF version to use.
807
- chunks (ChunksLike): The chunk shape of the new image. Defaults to "auto".
816
+ chunks (ChunksLike | None): The chunk shape of the new image.
808
817
  shards (ShardsLike | None): The shard shape of the new image.
809
818
  dtype (str | None): The data type of the new image.
810
819
  dimension_separator (Literal[".", "/"] | None): The separator to use for
ngio/images/_label.py CHANGED
@@ -219,7 +219,7 @@ class LabelsContainer:
219
219
  channels_policy: Literal["same", "squeeze", "singleton"] | int = "squeeze",
220
220
  ngff_version: NgffVersions | None = None,
221
221
  # Zarr Array parameters
222
- chunks: ChunksLike = "auto",
222
+ chunks: ChunksLike | None = None,
223
223
  shards: ShardsLike | None = None,
224
224
  dtype: str | None = None,
225
225
  dimension_separator: Literal[".", "/"] | None = None,
@@ -256,7 +256,7 @@ class LabelsContainer:
256
256
  - If an integer is provided, the channels axis will be changed to have
257
257
  that size.
258
258
  ngff_version (NgffVersions | None): The NGFF version to use.
259
- chunks (Sequence[int] | None): The chunk shape of the new image.
259
+ chunks (ChunksLike | None): The chunk shape of the new image.
260
260
  shards (ShardsLike | None): The shard shape of the new image.
261
261
  dtype (str | None): The data type of the new image.
262
262
  dimension_separator (DIMENSION_SEPARATOR | None): The separator to use for
@@ -328,7 +328,7 @@ def derive_label(
328
328
  channels_policy: Literal["same", "squeeze", "singleton"] | int = "squeeze",
329
329
  ngff_version: NgffVersions | None = None,
330
330
  # Zarr Array parameters
331
- chunks: ChunksLike = "auto",
331
+ chunks: ChunksLike | None = None,
332
332
  shards: ShardsLike | None = None,
333
333
  dtype: str | None = None,
334
334
  dimension_separator: Literal[".", "/"] | None = None,
@@ -359,7 +359,7 @@ def derive_label(
359
359
  - If an integer is provided, the channels axis will be changed to have that
360
360
  size.
361
361
  ngff_version (NgffVersions | None): The NGFF version to use.
362
- chunks (ChunksLike): The chunk shape of the new label. Defaults to "auto".
362
+ chunks (ChunksLike | None): The chunk shape of the new label.
363
363
  shards (ShardsLike | None): The shard shape of the new label.
364
364
  dtype (str | None): The data type of the new label.
365
365
  dimension_separator (Literal[".", "/"] | None): The separator to use for
@@ -434,7 +434,7 @@ class OmeZarrContainer:
434
434
  channels_meta: Sequence[str | Channel] | None = None,
435
435
  ngff_version: NgffVersions | None = None,
436
436
  # Zarr Array parameters
437
- chunks: ChunksLike = "auto",
437
+ chunks: ChunksLike | None = None,
438
438
  shards: ShardsLike | None = None,
439
439
  dtype: str = "uint16",
440
440
  dimension_separator: Literal[".", "/"] = "/",
@@ -471,7 +471,7 @@ class OmeZarrContainer:
471
471
  channels_meta (Sequence[str | Channel] | None): The channels metadata
472
472
  of the new image.
473
473
  ngff_version (NgffVersions | None): The NGFF version to use.
474
- chunks (ChunksLike): The chunk shape of the new image. Defaults to "auto".
474
+ chunks (ChunksLike | None): The chunk shape of the new image.
475
475
  shards (ShardsLike | None): The shard shape of the new image.
476
476
  dtype (str): The data type of the new image. Defaults to "uint16".
477
477
  dimension_separator (Literal[".", "/"]): The separator to use for
@@ -503,6 +503,7 @@ class OmeZarrContainer:
503
503
  time_spacing=time_spacing,
504
504
  name=name,
505
505
  channels_meta=channels_meta,
506
+ channels_policy=channels_policy,
506
507
  ngff_version=ngff_version,
507
508
  chunks=chunks,
508
509
  shards=shards,
@@ -789,7 +790,7 @@ class OmeZarrContainer:
789
790
  channels_policy: Literal["same", "squeeze", "singleton"] | int = "squeeze",
790
791
  ngff_version: NgffVersions | None = None,
791
792
  # Zarr Array parameters
792
- chunks: ChunksLike = "auto",
793
+ chunks: ChunksLike | None = None,
793
794
  shards: ShardsLike | None = None,
794
795
  dtype: str | None = None,
795
796
  dimension_separator: Literal[".", "/"] | None = None,
@@ -821,7 +822,7 @@ class OmeZarrContainer:
821
822
  that size.
822
823
  Defaults to "squeeze".
823
824
  ngff_version (NgffVersions | None): The NGFF version to use.
824
- chunks (ChunksLike): The chunk shape of the new label. Defaults to "auto".
825
+ chunks (ChunksLike | None): The chunk shape of the new label.
825
826
  shards (ShardsLike | None): The shard shape of the new label.
826
827
  dtype (str | None): The data type of the new label.
827
828
  dimension_separator (Literal[".", "/"] | None): The separator to use for
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngio
3
- Version: 0.5.0b2
3
+ Version: 0.5.0b3
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
@@ -42,6 +42,7 @@ Requires-Dist: pyqt5; extra == 'dev'
42
42
  Requires-Dist: rich; extra == 'dev'
43
43
  Requires-Dist: ruff; extra == 'dev'
44
44
  Requires-Dist: scikit-image; extra == 'dev'
45
+ Requires-Dist: zarrs; extra == 'dev'
45
46
  Provides-Extra: docs
46
47
  Requires-Dist: griffe-typingdoc; extra == 'docs'
47
48
  Requires-Dist: markdown-exec[ansi]; extra == 'docs'
@@ -2,7 +2,7 @@ ngio/__init__.py,sha256=kyInohhWrBs4qkbMYFIQeAiy1CDpvbSOtXB4buFocbw,1535
2
2
  ngio/common/__init__.py,sha256=F3zAHQIhwig1xUA-SpmFVRtMeOrEj926-nHWhj-wS6c,684
3
3
  ngio/common/_dimensions.py,sha256=w8PYgyWxA8hgJETjFbw5CXf7WrasCL5FbzgfL1in86M,11361
4
4
  ngio/common/_masking_roi.py,sha256=YSEZ5nv3-TqMrQ04cI70U9NGx3LSy7Z1_cbw_NE-78k,4831
5
- ngio/common/_pyramid.py,sha256=vPlxHUWBmfw6BtRoZeA7YNu3ft1YdAzyW1tWG8gA_to,14117
5
+ ngio/common/_pyramid.py,sha256=JRqVm9eFyxHi1a2hCcAoTJU3L8vctRHbkVWkskyQG_U,14354
6
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
@@ -17,13 +17,13 @@ ngio/experimental/iterators/_segmentation.py,sha256=xzotGvTn04HPeMeXZ_URnQqWco6d
17
17
  ngio/hcs/__init__.py,sha256=G8j9vD-liLeB_UeGtKYIgshWvJnUA6ks9GwjvWBLdHs,357
18
18
  ngio/hcs/_plate.py,sha256=l2a2ZMniutxRzZ88HOYwajug-svr6OanREG5mTy39x0,45773
19
19
  ngio/images/__init__.py,sha256=9Whvt7GTiCgT_vXaEEqGnDaY1-UsRk3dhLTv091F_g4,1211
20
- ngio/images/_abstract_image.py,sha256=PyginvViqjKNsnUBF8yX7pUI2fHDJq4QthjeQzJWzDU,31906
20
+ ngio/images/_abstract_image.py,sha256=gvOS7Nb52pgLgtBpvu3vYxwbSocqw2w-sEsJaJVrHWE,31925
21
21
  ngio/images/_create_synt_container.py,sha256=Cvg_J0KSxK0PH8IBzlKLIcCwH2vRTuBj-nZo5uOKXXk,5182
22
22
  ngio/images/_create_utils.py,sha256=hXVbFM8D_0mZTfBAhcZiuGX2lLXSJCep8THuxpH4d4E,14374
23
- ngio/images/_image.py,sha256=TiKQXnzm0Mhxx6zmS4CVThcIJLV_guwjbVx7ZOd_0IU,34197
24
- ngio/images/_label.py,sha256=MYmYIikKyf2nDqrFd8xZ3nYR-JKe-JneUNuE1jEPHdA,15682
23
+ ngio/images/_image.py,sha256=A2dE9O3L1dLU3gdjQrNCFUYDF_NuxTxVm8klmBfmPCc,34792
24
+ ngio/images/_label.py,sha256=0dqLKBVibqw6scSTWxzSyxjnXLs-fhBGQzol8C5Rzok,15676
25
25
  ngio/images/_masked_image.py,sha256=YhbBzgPZMav6rX0WYue1BaxAzEIsfaQrxUIOK6ZWZcw,18848
26
- ngio/images/_ome_zarr_container.py,sha256=aa8l8wfZ8p0YpsdBd8ixvrdgVcdZs6RnSOpUWPE1ixU,48247
26
+ ngio/images/_ome_zarr_container.py,sha256=mD1PEos33EfapkUVMJnSZdQiQI57cZa_bB2hdEEJQuM,48276
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
29
  ngio/io_pipes/_io_pipes.py,sha256=l85mmjj1l0uYU3qzsSHg9l8cMIEevInm_MTD-8MlXgw,10603
@@ -82,7 +82,7 @@ ngio/utils/_datasets.py,sha256=6GtxfPkjutNaeg5BHuJDBP0GudvQXHLU6mmHp_o0bGA,5650
82
82
  ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
83
83
  ngio/utils/_fractal_fsspec_store.py,sha256=RdcCFOgHexRKX9zZvJV5RI-5OPc7VOPS6q_IeRxm24I,1548
84
84
  ngio/utils/_zarr_utils.py,sha256=MVbW-a0S3iuzMaknqkliJa_lp8i6mEO4Q2YN2XxmeDw,18158
85
- ngio-0.5.0b2.dist-info/METADATA,sha256=r1un40xipjI7Kctjt0Gj9-B28PjO5pBSPWxOyoQjXCc,6294
86
- ngio-0.5.0b2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
87
- ngio-0.5.0b2.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
88
- ngio-0.5.0b2.dist-info/RECORD,,
85
+ ngio-0.5.0b3.dist-info/METADATA,sha256=cTOSheYJVPvHvY-3CTTSxPXudzxMzGbN98tkvpFBzbs,6331
86
+ ngio-0.5.0b3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
87
+ ngio-0.5.0b3.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
88
+ ngio-0.5.0b3.dist-info/RECORD,,
File without changes