ngio 0.4.4__py3-none-any.whl → 0.4.5__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
@@ -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.5
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
@@ -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.5.dist-info/METADATA,sha256=6g28iSwZ32mHJmEmOYOFaixVkTyQa-xaCy50teScyjk,6137
83
+ ngio-0.4.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
84
+ ngio-0.4.5.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
85
+ ngio-0.4.5.dist-info/RECORD,,
File without changes