ngio 0.4.4__py3-none-any.whl → 0.4.6__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
@@ -2,6 +2,7 @@ import math
2
2
  from collections.abc import Callable, Sequence
3
3
  from typing import Literal
4
4
 
5
+ import dask
5
6
  import dask.array as da
6
7
  import numpy as np
7
8
  import zarr
@@ -36,9 +37,17 @@ def _on_disk_dask_zoom(
36
37
  ) -> None:
37
38
  source_array = da.from_zarr(source)
38
39
  target_array = dask_zoom(source_array, target_shape=target.shape, order=order)
39
-
40
+ # This is a potential fix for Dask 2025.11
41
+ # chunk_size_bytes = np.prod(target.chunks) * target_array.dtype.itemsize
42
+ # current_chunk_size = dask.config.get("array.chunk-size", 0)
43
+ #
44
+ #if current_chunk_size < chunk_size_bytes:
45
+ # # Increase the chunk size to avoid dask potentially creating
46
+ # # corrupted chunks when writing chunks that are not multiple of the
47
+ # # target chunk size
48
+ # dask.config.set({"array.chunk-size": f"{chunk_size_bytes}B"})
40
49
  target_array = target_array.rechunk(target.chunks)
41
- target_array.compute_chunk_sizes()
50
+ target_array = target_array.compute_chunk_sizes()
42
51
  target_array.to_zarr(target)
43
52
 
44
53
 
@@ -241,13 +250,11 @@ def init_empty_pyramid(
241
250
  compressor=compressor,
242
251
  )
243
252
 
244
- _shape = [
253
+ ref_shape = [
245
254
  math.floor(s / sc) for s, sc in zip(ref_shape, scaling_factors, strict=True)
246
255
  ]
247
- ref_shape = _shape
256
+ chunks = tuple(
257
+ min(c, s) for c, s in zip(new_arr.chunks, ref_shape, strict=True)
258
+ )
248
259
 
249
- if chunks is None:
250
- chunks = new_arr.chunks
251
- assert chunks is not None
252
- chunks = [min(c, s) for c, s in zip(chunks, ref_shape, strict=True)]
253
260
  return None
ngio/images/_image.py CHANGED
@@ -875,7 +875,7 @@ def _parse_str_or_model(
875
875
  )
876
876
  elif channel_selection.mode == "wavelength_id":
877
877
  return image.get_channel_idx(
878
- channel_label=str(channel_selection.identifier)
878
+ wavelength_id=str(channel_selection.identifier)
879
879
  )
880
880
  elif channel_selection.mode == "index":
881
881
  return int(channel_selection.identifier)
@@ -359,7 +359,7 @@ ImplementedTables().add_implementation(ConditionTableV1)
359
359
  def open_tables_container(
360
360
  store: StoreOrGroup,
361
361
  cache: bool = False,
362
- mode: AccessModeLiteral = "a",
362
+ mode: AccessModeLiteral = "r+",
363
363
  parallel_safe: bool = False,
364
364
  ) -> TablesContainer:
365
365
  """Open a table handler from a Zarr store."""
@@ -373,7 +373,7 @@ def open_table(
373
373
  store: StoreOrGroup,
374
374
  backend: TableBackend | None = None,
375
375
  cache: bool = False,
376
- mode: AccessModeLiteral = "a",
376
+ mode: AccessModeLiteral = "r+",
377
377
  parallel_safe: bool = False,
378
378
  ) -> Table:
379
379
  """Open a table from a Zarr store."""
@@ -391,7 +391,7 @@ def open_table_as(
391
391
  table_cls: type[TableType],
392
392
  backend: TableBackend | None = None,
393
393
  cache: bool = False,
394
- mode: AccessModeLiteral = "a",
394
+ mode: AccessModeLiteral = "r+",
395
395
  parallel_safe: bool = False,
396
396
  ) -> TableType:
397
397
  """Open a table from a Zarr store as a specific type."""
@@ -86,10 +86,10 @@ def _dataframe_to_rois(
86
86
  ) -> dict[str, Roi]:
87
87
  """Convert a DataFrame to a WorldCooROI object."""
88
88
  # Validate the columns of the DataFrame
89
- _required_columns = set(dataframe.columns).intersection(set(required_columns))
90
- if len(_required_columns) != len(required_columns):
89
+ _missing_columns = set(required_columns).difference(set(dataframe.columns))
90
+ if len(_missing_columns) != 0:
91
91
  raise NgioTableValidationError(
92
- f"Could not find required columns: {_required_columns} in the table."
92
+ f"Could not find required columns: {_missing_columns} in the table."
93
93
  )
94
94
 
95
95
  extra_columns = set(dataframe.columns).difference(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngio
3
- Version: 0.4.4
3
+ Version: 0.4.6
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<0.11.4,>=0.8.0
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
@@ -2,7 +2,7 @@ ngio/__init__.py,sha256=rEgnXuU6TCejUUGsxt4eKmjMhxjYh0fYBxWF4o5YjbE,1435
2
2
  ngio/common/__init__.py,sha256=aPSuUbdGryrxbnlWrsVNe3LZoBAWC4GijR1BNH1UwuU,612
3
3
  ngio/common/_dimensions.py,sha256=w8PYgyWxA8hgJETjFbw5CXf7WrasCL5FbzgfL1in86M,11361
4
4
  ngio/common/_masking_roi.py,sha256=ZZTXordEZoq_ADk0OzADvq-5dPOwUBSuNobzFR8fpTw,5697
5
- ngio/common/_pyramid.py,sha256=F5OI_mULxzMTpMeihC4Y22cjuB5GKN2jRdpwfMXJHiE,8018
5
+ ngio/common/_pyramid.py,sha256=Wxj8RXSWWEPm5ILqvga484Hd2j3IQ4tGzHZsL5WSOuo,8446
6
6
  ngio/common/_roi.py,sha256=9fKFTHoUiP0xmxvQiFkNmIuwWg3bFuRaAx-froCSqvA,11487
7
7
  ngio/common/_synt_images_utils.py,sha256=B6uYOW1NyrM06YMR-csca3_YnAAkPRTbvnbLdy9tk9E,3188
8
8
  ngio/common/_zoom.py,sha256=U01c-vqXjzZkrpd9Yvs24frVfTls_xPJeeaFCGmUwYI,6727
@@ -20,7 +20,7 @@ ngio/images/__init__.py,sha256=9Whvt7GTiCgT_vXaEEqGnDaY1-UsRk3dhLTv091F_g4,1211
20
20
  ngio/images/_abstract_image.py,sha256=hrB9xn4MFRxnxE1d7HKnM8SXVPUGhMD9u32yBHTsFiU,18517
21
21
  ngio/images/_create.py,sha256=61cuco2jUK25WzOY-Sel9s931FtGPL2ut25L9W10bJ4,10171
22
22
  ngio/images/_create_synt_container.py,sha256=il_rr5_2KIQ5Xsskj2rb2fEm100ZErZq89aW06kn_7k,5444
23
- ngio/images/_image.py,sha256=GDUmBhoTj9js7rC785g3__l_xSH1oKSgx2AAAr25OSM,33053
23
+ ngio/images/_image.py,sha256=aMJb-YDghbZIHfSzY8ZoTmScEOqNfWQzJFO2AoMCdF4,33053
24
24
  ngio/images/_label.py,sha256=Se3ZpgXDArtLHPlx9pw8Rnr5pZ_sEkmbeMh9sU63ncg,11799
25
25
  ngio/images/_masked_image.py,sha256=YhbBzgPZMav6rX0WYue1BaxAzEIsfaQrxUIOK6ZWZcw,18848
26
26
  ngio/images/_ome_zarr_container.py,sha256=UJERXEgBkwclpLaHzWqUIQc6P-TG4zYuKuxPukJGa4Y,38433
@@ -55,7 +55,7 @@ ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/nuclei.png,sha
55
55
  ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/raw.jpg,sha256=82lejQAIokj5w9g-qqhysDTWpHtNvJTkdURG_BjqIxQ,37743
56
56
  ngio/tables/__init__.py,sha256=_BV3sclNMLITu_J8_3DkkUrCB6Kro0HzeWLDCD1ivKM,877
57
57
  ngio/tables/_abstract_table.py,sha256=rwGa47TzbFmosucBWVfFq6JEXtgGvOdUVtU9DIelV88,8204
58
- ngio/tables/_tables_container.py,sha256=3xmpREaN671l40MPprnl1BD-VoOb6xfjECb5mNoMW0w,12173
58
+ ngio/tables/_tables_container.py,sha256=jB3iVlUnJdMIBUqfuZDtPkiEI9haL19Bz-QfJ0BUwl4,12176
59
59
  ngio/tables/backends/__init__.py,sha256=MwSRXNF1rWQBFOTDA_vT3oGoNZpviVgytsL5Txnu08I,1619
60
60
  ngio/tables/backends/_abstract_backend.py,sha256=54Vh9yPfLx1NixGVfFkW4msD51nsim0zIfHRnO80Xt8,7276
61
61
  ngio/tables/backends/_anndata.py,sha256=97RWG4Hjc42JBxm-YxjHEU8HHd14NiayelKlI1PTsCo,2868
@@ -70,7 +70,7 @@ ngio/tables/v1/__init__.py,sha256=Wr1_9RZFpaN8FYMTnxT9Yjkw4AS7y9FMWailmB_uj5g,61
70
70
  ngio/tables/v1/_condition_table.py,sha256=T0Uq5BKkmMoEspt_Rx0U99Ow6S9GAMZDHqvUO5obCAM,1780
71
71
  ngio/tables/v1/_feature_table.py,sha256=n9uMHwoBh-_dlOhUXCFbmAjXFVXncNCR3SjE2qzXI68,3821
72
72
  ngio/tables/v1/_generic_table.py,sha256=1ktJHeuv7U1g5Z8PFUuTkCjOzcYMQd8xegKHKUedJB8,1240
73
- ngio/tables/v1/_roi_table.py,sha256=g7UpMmpf3uAfaG59WYRnimUBgiB_T1qUJRwMZpMt9cI,17099
73
+ ngio/tables/v1/_roi_table.py,sha256=b7lwjsdCSUOCMT6Lx4hwAqGBKC25Q5bdzoK3DQWnAQM,17074
74
74
  ngio/transforms/__init__.py,sha256=JA0-Ui7skbXkm9ofN-AEhU1FTLutkMkwTdVD-310frQ,113
75
75
  ngio/transforms/_zoom.py,sha256=otyE-vxFnywUJ8U4mHjat-bNG_7_jv62ckTpqDMxyVQ,550
76
76
  ngio/utils/__init__.py,sha256=XPYh8ehC7uXNU2cFFXZAw-S3DpWpX1Yq2xGkffZv5vI,1142
@@ -79,7 +79,7 @@ ngio/utils/_errors.py,sha256=pKQ12LUjQLYE1nUawemA5h7HsgznjaSvV1n2PQU33N0,759
79
79
  ngio/utils/_fractal_fsspec_store.py,sha256=RdcCFOgHexRKX9zZvJV5RI-5OPc7VOPS6q_IeRxm24I,1548
80
80
  ngio/utils/_logger.py,sha256=N5W0a_xwze4blS1MolidBkTMbjTbg8GPguJZNun3mAE,1392
81
81
  ngio/utils/_zarr_utils.py,sha256=GUOcAx02IcfrJ5tIdKu8ChtRUUaBbkkddW5jaCCYnS8,13797
82
- ngio-0.4.4.dist-info/METADATA,sha256=1yjBnjq6IURXZSApn3fLn31KBRWNLhTM6J4unvUrnHg,6117
83
- ngio-0.4.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
- ngio-0.4.4.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
85
- ngio-0.4.4.dist-info/RECORD,,
82
+ ngio-0.4.6.dist-info/METADATA,sha256=swcrfn7bpQliiDtVbWuUOf-JMMgK6zEfkXeh9Qv8fxg,6137
83
+ ngio-0.4.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ ngio-0.4.6.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
85
+ ngio-0.4.6.dist-info/RECORD,,
File without changes