ngio 0.1.3__tar.gz → 0.1.5__tar.gz

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 (82) hide show
  1. {ngio-0.1.3 → ngio-0.1.5}/PKG-INFO +1 -1
  2. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/fractal_image_meta.py +2 -5
  3. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/v04/zarr_utils.py +8 -1
  4. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/tables_group.py +5 -2
  5. {ngio-0.1.3 → ngio-0.1.5}/tests/ngff_meta/test_utils.py +1 -0
  6. {ngio-0.1.3 → ngio-0.1.5}/tests/ngff_meta/test_v04.py +30 -0
  7. {ngio-0.1.3 → ngio-0.1.5}/.copier-answers.yml +0 -0
  8. {ngio-0.1.3 → ngio-0.1.5}/.gitattributes +0 -0
  9. {ngio-0.1.3 → ngio-0.1.5}/.github/ISSUE_TEMPLATE.md +0 -0
  10. {ngio-0.1.3 → ngio-0.1.5}/.github/TEST_FAIL_TEMPLATE.md +0 -0
  11. {ngio-0.1.3 → ngio-0.1.5}/.github/dependabot.yml +0 -0
  12. {ngio-0.1.3 → ngio-0.1.5}/.github/workflows/build_docs.yml +0 -0
  13. {ngio-0.1.3 → ngio-0.1.5}/.github/workflows/ci.yml +0 -0
  14. {ngio-0.1.3 → ngio-0.1.5}/.gitignore +0 -0
  15. {ngio-0.1.3 → ngio-0.1.5}/.pre-commit-config.yaml +0 -0
  16. {ngio-0.1.3 → ngio-0.1.5}/LICENSE +0 -0
  17. {ngio-0.1.3 → ngio-0.1.5}/README.md +0 -0
  18. {ngio-0.1.3 → ngio-0.1.5}/_typos.toml +0 -0
  19. {ngio-0.1.3 → ngio-0.1.5}/docs/api/core.md +0 -0
  20. {ngio-0.1.3 → ngio-0.1.5}/docs/getting-started.md +0 -0
  21. {ngio-0.1.3 → ngio-0.1.5}/docs/index.md +0 -0
  22. {ngio-0.1.3 → ngio-0.1.5}/docs/notebooks/basic_usage.ipynb +0 -0
  23. {ngio-0.1.3 → ngio-0.1.5}/docs/notebooks/image.ipynb +0 -0
  24. {ngio-0.1.3 → ngio-0.1.5}/docs/notebooks/processing.ipynb +0 -0
  25. {ngio-0.1.3 → ngio-0.1.5}/mkdocs.yml +0 -0
  26. {ngio-0.1.3 → ngio-0.1.5}/pyproject.toml +0 -0
  27. {ngio-0.1.3 → ngio-0.1.5}/setup_data.sh +0 -0
  28. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/__init__.py +0 -0
  29. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/__init__.py +0 -0
  30. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/dimensions.py +0 -0
  31. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/image_handler.py +0 -0
  32. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/image_like_handler.py +0 -0
  33. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/label_handler.py +0 -0
  34. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/ngff_image.py +0 -0
  35. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/roi.py +0 -0
  36. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/core/utils.py +0 -0
  37. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/io/__init__.py +0 -0
  38. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/io/_zarr.py +0 -0
  39. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/io/_zarr_array_utils.py +0 -0
  40. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/io/_zarr_group_utils.py +0 -0
  41. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/iterators/__init__.py +0 -0
  42. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/__init__.py +0 -0
  43. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/meta_handler.py +0 -0
  44. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/utils.py +0 -0
  45. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/v04/__init__.py +0 -0
  46. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/ngff_meta/v04/specs.py +0 -0
  47. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/pipes/__init__.py +0 -0
  48. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/pipes/_slicer_transforms.py +0 -0
  49. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/pipes/_transforms.py +0 -0
  50. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/pipes/_zoom_utils.py +0 -0
  51. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/pipes/data_pipe.py +0 -0
  52. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/__init__.py +0 -0
  53. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/_ad_reader.py +0 -0
  54. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/_utils.py +0 -0
  55. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/v1/__init__.py +0 -0
  56. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/v1/_generic_table.py +0 -0
  57. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/v1/feature_tables.py +0 -0
  58. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/v1/masking_roi_tables.py +0 -0
  59. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/tables/v1/roi_tables.py +0 -0
  60. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/utils/__init__.py +0 -0
  61. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/utils/_common_types.py +0 -0
  62. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/utils/_errors.py +0 -0
  63. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/utils/_logger.py +0 -0
  64. {ngio-0.1.3 → ngio-0.1.5}/src/ngio/utils/_pydantic_utils.py +0 -0
  65. {ngio-0.1.3 → ngio-0.1.5}/tests/core/conftest.py +0 -0
  66. {ngio-0.1.3 → ngio-0.1.5}/tests/core/test_image_handler.py +0 -0
  67. {ngio-0.1.3 → ngio-0.1.5}/tests/core/test_image_like_handler.py +0 -0
  68. {ngio-0.1.3 → ngio-0.1.5}/tests/core/test_label_handler.py +0 -0
  69. {ngio-0.1.3 → ngio-0.1.5}/tests/core/test_ngff_image.py +0 -0
  70. {ngio-0.1.3 → ngio-0.1.5}/tests/core/test_roi.py +0 -0
  71. {ngio-0.1.3 → ngio-0.1.5}/tests/io/conftest.py +0 -0
  72. {ngio-0.1.3 → ngio-0.1.5}/tests/io/test_zarr_group_utils.py +0 -0
  73. {ngio-0.1.3 → ngio-0.1.5}/tests/ngff_meta/conftest.py +0 -0
  74. {ngio-0.1.3 → ngio-0.1.5}/tests/ngff_meta/test_fractal_image_meta.py +0 -0
  75. {ngio-0.1.3 → ngio-0.1.5}/tests/ngff_meta/test_pixel_size.py +0 -0
  76. {ngio-0.1.3 → ngio-0.1.5}/tests/pipes/conftest.py +0 -0
  77. {ngio-0.1.3 → ngio-0.1.5}/tests/pipes/test_zoom.py +0 -0
  78. {ngio-0.1.3 → ngio-0.1.5}/tests/tables/conftest.py +0 -0
  79. {ngio-0.1.3 → ngio-0.1.5}/tests/tables/test_table_conversion.py +0 -0
  80. {ngio-0.1.3 → ngio-0.1.5}/tests/tables/test_table_group.py +0 -0
  81. {ngio-0.1.3 → ngio-0.1.5}/tests/tables/test_v1_tables.py +0 -0
  82. {ngio-0.1.3 → ngio-0.1.5}/tests/tables/test_validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngio
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Next Generation file format IO
5
5
  Project-URL: homepage, https://github.com/lorenzocerrone/ngio
6
6
  Project-URL: repository, https://github.com/lorenzocerrone/ngio
@@ -823,9 +823,7 @@ class Dataset:
823
823
  raise ValueError("Spatial axes must have a unit.")
824
824
  if return_type not in SpaceUnits.allowed_names():
825
825
  raise ValueError(f"Invalid space unit {return_type}.")
826
- if isinstance(return_type, str):
827
- return_type = SpaceUnits(return_type)
828
- return return_type
826
+ return SpaceUnits(return_type)
829
827
 
830
828
  @property
831
829
  def pixel_size(self) -> PixelSize:
@@ -850,8 +848,7 @@ class Dataset:
850
848
  if len(types) == 0:
851
849
  return None
852
850
  elif len(types) == 1:
853
- assert isinstance(types[0], TimeUnits)
854
- return types[0]
851
+ return TimeUnits(types[0])
855
852
  else:
856
853
  raise ValueError("Multiple time axes found. Only one time axis is allowed.")
857
854
 
@@ -110,7 +110,13 @@ def vanilla_omero_v04_to_fractal(omero04: Omero04) -> Omero:
110
110
  for channel04 in omero04.channels:
111
111
  # Convert the window to a dictionary
112
112
  label = channel04.label
113
- wavelength_id = channel04.extra_fields.get("wavelength_id", label)
113
+
114
+ if "wavelength_id" in channel04.extra_fields:
115
+ # If the wavelength_id is present, pop it from the extra fields
116
+ # so that it is not added to the channel_visualisation
117
+ wavelength_id = channel04.extra_fields.pop("wavelength_id")
118
+ else:
119
+ wavelength_id = label
114
120
 
115
121
  if channel04.window is None:
116
122
  window04 = Window04(
@@ -161,6 +167,7 @@ def fractal_omero_to_vanilla_v04(omero: Omero) -> Omero04:
161
167
  color=channel.channel_visualisation.color,
162
168
  active=channel.channel_visualisation.active,
163
169
  window=window04,
170
+ wavelength_id=channel.wavelength_id,
164
171
  **channel.channel_visualisation.extra_fields,
165
172
  )
166
173
  list_channels04.append(channel04)
@@ -156,14 +156,17 @@ class TableGroup:
156
156
 
157
157
  list_of_tables = self._get_list_of_tables()
158
158
  self._validate_list_of_tables(list_of_tables=list_of_tables)
159
+
160
+ all_table_types = ["roi_table", "feature_table", "masking_roi_table"]
161
+
159
162
  if table_type is None:
160
163
  return list_of_tables
161
164
 
162
165
  else:
163
- if table_type not in ["roi_table", "feature_table", "masking_roi_table"]:
166
+ if table_type not in all_table_types:
164
167
  raise ValueError(
165
168
  f"Table type {table_type} not recognized. "
166
- " Allowed values are: 'roi', 'feature', 'masking_roi'."
169
+ f" Allowed values are: {all_table_types}"
167
170
  )
168
171
  list_of_typed_tables = []
169
172
  for table_name in list_of_tables:
@@ -22,6 +22,7 @@ class TestUtils:
22
22
  )
23
23
 
24
24
  assert meta.channel_labels == ["DAPI", "nanog", "Lamin B1"]
25
+ assert meta.channel_wavelength_ids == ["A01_C01", "A02_C02", "A03_C03"]
25
26
  np.testing.assert_array_equal(meta.pixel_size(idx=0).zyx, [1.0, 1.0, 1.0])
26
27
  np.testing.assert_array_equal(meta.scale(idx=0), [1.0, 1.0, 1.0, 1.0, 1.0])
27
28
  np.testing.assert_array_equal(meta.pixel_size(path="2").zyx, [1.0, 4.0, 4.0])
@@ -4,6 +4,36 @@ import pytest
4
4
 
5
5
 
6
6
  class TestOMEZarrHandlerV04:
7
+ def test_create_image_meta(self, tmp_path):
8
+ from ngio.ngff_meta import create_image_metadata
9
+ from ngio.ngff_meta.v04.zarr_utils import (
10
+ fractal_ngff_image_meta_to_vanilla_v04,
11
+ vanilla_ngff_image_meta_v04_to_fractal,
12
+ )
13
+
14
+ meta = create_image_metadata(
15
+ on_disk_axis=("t", "c", "z", "y", "x"),
16
+ pixel_sizes=None,
17
+ xy_scaling_factor=2.0,
18
+ z_scaling_factor=1.0,
19
+ time_spacing=1.0,
20
+ time_units="s",
21
+ levels=5,
22
+ name="test",
23
+ channel_labels=["DAPI", "nanog", "Lamin B1"],
24
+ channel_wavelengths=["A01_C01", "A02_C02", "A03_C03"],
25
+ channel_visualization=None,
26
+ omero_kwargs=None,
27
+ version="0.4",
28
+ )
29
+
30
+ meta04 = fractal_ngff_image_meta_to_vanilla_v04(meta)
31
+ meta2 = vanilla_ngff_image_meta_v04_to_fractal(meta04)
32
+ assert meta.channel_labels == meta2.channel_labels
33
+ assert meta.channel_wavelength_ids == meta2.channel_wavelength_ids
34
+ assert meta.axes_names == meta2.axes_names
35
+ assert meta.scale(path="2") == meta2.scale(path="2")
36
+
7
37
  def test_basic_workflow(self, ome_zarr_image_v04_path):
8
38
  from ngio.ngff_meta import get_ngff_image_meta_handler
9
39
  from ngio.ngff_meta.v04.zarr_utils import NgffImageMeta04
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes