ngio 0.2.1__py3-none-any.whl → 0.2.3__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 (38) hide show
  1. ngio/__init__.py +20 -2
  2. ngio/common/_pyramid.py +5 -1
  3. ngio/common/_roi.py +2 -2
  4. ngio/hcs/__init__.py +16 -2
  5. ngio/hcs/plate.py +496 -18
  6. ngio/images/abstract_image.py +11 -0
  7. ngio/images/create.py +25 -36
  8. ngio/images/image.py +80 -6
  9. ngio/images/label.py +38 -9
  10. ngio/images/ome_zarr_container.py +70 -33
  11. ngio/ome_zarr_meta/__init__.py +5 -3
  12. ngio/ome_zarr_meta/ngio_specs/__init__.py +10 -2
  13. ngio/ome_zarr_meta/ngio_specs/_axes.py +90 -65
  14. ngio/ome_zarr_meta/ngio_specs/_dataset.py +46 -8
  15. ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py +242 -70
  16. ngio/ome_zarr_meta/ngio_specs/_ngio_image.py +49 -11
  17. ngio/ome_zarr_meta/ngio_specs/_pixel_size.py +28 -11
  18. ngio/ome_zarr_meta/v04/_custom_models.py +18 -0
  19. ngio/ome_zarr_meta/v04/_v04_spec_utils.py +2 -2
  20. ngio/tables/_validators.py +1 -83
  21. ngio/tables/backends/__init__.py +27 -1
  22. ngio/tables/backends/_abstract_backend.py +207 -22
  23. ngio/tables/backends/_anndata_utils.py +3 -109
  24. ngio/tables/backends/_anndata_v1.py +43 -46
  25. ngio/tables/backends/_csv_v1.py +162 -0
  26. ngio/tables/backends/_json_v1.py +54 -18
  27. ngio/tables/backends/_table_backends.py +98 -18
  28. ngio/tables/backends/_utils.py +458 -0
  29. ngio/tables/tables_container.py +3 -1
  30. ngio/tables/v1/_feature_table.py +20 -11
  31. ngio/tables/v1/_generic_table.py +20 -15
  32. ngio/tables/v1/_roi_table.py +7 -9
  33. ngio/utils/_zarr_utils.py +46 -32
  34. {ngio-0.2.1.dist-info → ngio-0.2.3.dist-info}/METADATA +3 -1
  35. ngio-0.2.3.dist-info/RECORD +57 -0
  36. ngio-0.2.1.dist-info/RECORD +0 -54
  37. {ngio-0.2.1.dist-info → ngio-0.2.3.dist-info}/WHEEL +0 -0
  38. {ngio-0.2.1.dist-info → ngio-0.2.3.dist-info}/licenses/LICENSE +0 -0
ngio/__init__.py CHANGED
@@ -10,7 +10,14 @@ __author__ = "Lorenzo Cerrone"
10
10
  __email__ = "lorenzo.cerrone@uzh.ch"
11
11
 
12
12
  from ngio.common import ArrayLike, Dimensions, Roi, RoiPixels
13
- from ngio.hcs import OmeZarrPlate, create_empty_plate, open_ome_zarr_plate
13
+ from ngio.hcs import (
14
+ OmeZarrPlate,
15
+ OmeZarrWell,
16
+ create_empty_plate,
17
+ create_empty_well,
18
+ open_ome_zarr_plate,
19
+ open_ome_zarr_well,
20
+ )
14
21
  from ngio.images import (
15
22
  Image,
16
23
  Label,
@@ -20,24 +27,35 @@ from ngio.images import (
20
27
  open_image,
21
28
  open_ome_zarr_container,
22
29
  )
23
- from ngio.ome_zarr_meta.ngio_specs import AxesSetup, ImageInWellPath, PixelSize
30
+ from ngio.ome_zarr_meta.ngio_specs import (
31
+ AxesSetup,
32
+ DefaultNgffVersion,
33
+ ImageInWellPath,
34
+ NgffVersions,
35
+ PixelSize,
36
+ )
24
37
 
25
38
  __all__ = [
26
39
  "ArrayLike",
27
40
  "AxesSetup",
41
+ "DefaultNgffVersion",
28
42
  "Dimensions",
29
43
  "Image",
30
44
  "ImageInWellPath",
31
45
  "Label",
46
+ "NgffVersions",
32
47
  "OmeZarrContainer",
33
48
  "OmeZarrPlate",
49
+ "OmeZarrWell",
34
50
  "PixelSize",
35
51
  "Roi",
36
52
  "RoiPixels",
37
53
  "create_empty_ome_zarr",
38
54
  "create_empty_plate",
55
+ "create_empty_well",
39
56
  "create_ome_zarr_from_array",
40
57
  "open_image",
41
58
  "open_ome_zarr_container",
42
59
  "open_ome_zarr_plate",
60
+ "open_ome_zarr_well",
43
61
  ]
ngio/common/_pyramid.py CHANGED
@@ -190,12 +190,16 @@ def init_empty_pyramid(
190
190
  "The shape and chunks must have the same number of dimensions."
191
191
  )
192
192
 
193
+ if chunks is not None:
194
+ chunks = [min(c, s) for c, s in zip(chunks, ref_shape, strict=True)]
195
+
193
196
  if len(ref_shape) != len(scaling_factors):
194
197
  raise NgioValueError(
195
198
  "The shape and scaling factor must have the same number of dimensions."
196
199
  )
197
200
 
198
- root_group, _ = open_group_wrapper(store, mode=mode)
201
+ root_group = open_group_wrapper(store, mode=mode)
202
+
199
203
  for path in paths:
200
204
  if any(s < 1 for s in ref_shape):
201
205
  raise NgioValueError(
ngio/common/_roi.py CHANGED
@@ -10,7 +10,7 @@ import numpy as np
10
10
  from pydantic import BaseModel, ConfigDict, Field
11
11
 
12
12
  from ngio.common._dimensions import Dimensions
13
- from ngio.ome_zarr_meta.ngio_specs import PixelSize, SpaceUnits
13
+ from ngio.ome_zarr_meta.ngio_specs import DefaultSpaceUnit, PixelSize, SpaceUnits
14
14
  from ngio.utils import NgioValueError
15
15
 
16
16
 
@@ -36,7 +36,7 @@ class Roi(BaseModel):
36
36
  x: float = 0.0
37
37
  y: float = 0.0
38
38
  z: float = 0.0
39
- unit: SpaceUnits = Field(SpaceUnits.micrometer, repr=False)
39
+ unit: SpaceUnits | str | None = Field(DefaultSpaceUnit, repr=False)
40
40
 
41
41
  model_config = ConfigDict(extra="allow")
42
42
 
ngio/hcs/__init__.py CHANGED
@@ -1,5 +1,19 @@
1
1
  """OME-Zarr HCS objects models."""
2
2
 
3
- from ngio.hcs.plate import OmeZarrPlate, create_empty_plate, open_ome_zarr_plate
3
+ from ngio.hcs.plate import (
4
+ OmeZarrPlate,
5
+ OmeZarrWell,
6
+ create_empty_plate,
7
+ create_empty_well,
8
+ open_ome_zarr_plate,
9
+ open_ome_zarr_well,
10
+ )
4
11
 
5
- __all__ = ["OmeZarrPlate", "create_empty_plate", "open_ome_zarr_plate"]
12
+ __all__ = [
13
+ "OmeZarrPlate",
14
+ "OmeZarrWell",
15
+ "create_empty_plate",
16
+ "create_empty_well",
17
+ "open_ome_zarr_plate",
18
+ "open_ome_zarr_well",
19
+ ]