ngio 0.1.2__py3-none-any.whl → 0.1.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.
ngio/core/ngff_image.py CHANGED
@@ -300,6 +300,8 @@ class NgffImage:
300
300
  store: StoreLike,
301
301
  name: str,
302
302
  overwrite: bool = True,
303
+ copy_labels: bool = False,
304
+ copy_tables: bool = False,
303
305
  **kwargs: dict,
304
306
  ) -> "NgffImage":
305
307
  """Derive a new image from the current image.
@@ -308,6 +310,10 @@ class NgffImage:
308
310
  store (StoreLike): The store to create the new image in.
309
311
  name (str): The name of the new image.
310
312
  overwrite (bool): Whether to overwrite the image if it exists
313
+ copy_labels (bool): Whether to copy the labels from the current image
314
+ to the new image.
315
+ copy_tables (bool): Whether to copy the tables from the current image
316
+ to the new image.
311
317
  **kwargs: Additional keyword arguments.
312
318
  Follow the same signature as `create_empty_ome_zarr_image`.
313
319
 
@@ -351,4 +357,31 @@ class NgffImage:
351
357
  create_empty_ome_zarr_image(
352
358
  **default_kwargs,
353
359
  )
354
- return NgffImage(store=store)
360
+
361
+ new_image = NgffImage(store=store)
362
+
363
+ if copy_tables:
364
+ # TODO: to be refactored when the table location is changed in the spec
365
+ source_tables_group = self.tables._table_group
366
+
367
+ if source_tables_group is None:
368
+ raise ValueError("No tables group found in the source image.")
369
+
370
+ zarr.copy(source=source_tables_group, dest=new_image.group)
371
+
372
+ # Reopen the image to get the new tables
373
+ new_image = NgffImage(store=store)
374
+
375
+ if copy_labels:
376
+ # TODO: to be refactored when the label location is changed in the spec
377
+ source_labels_group = self.labels._label_group
378
+
379
+ if source_labels_group is None:
380
+ raise ValueError("No labels group found in the source image.")
381
+
382
+ zarr.copy(source=source_labels_group, dest=new_image.group)
383
+
384
+ # Reopen the image to get the new labels
385
+ new_image = NgffImage(store=store)
386
+
387
+ return new_image
@@ -1,11 +1,12 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: ngio
3
- Version: 0.1.2
3
+ Version: 0.1.3
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
7
7
  Author-email: Lorenzo Cerrone <lorenzo.cerrone@uzh.ch>
8
8
  License: BSD-3-Clause
9
+ License-File: LICENSE
9
10
  Classifier: Development Status :: 3 - Alpha
10
11
  Classifier: License :: OSI Approved :: BSD License
11
12
  Classifier: Programming Language :: Python :: 3
@@ -4,7 +4,7 @@ ngio/core/dimensions.py,sha256=AyiXXwgfwe1LiJ7cNhefUVTG2GQqVzDiO0ge_KePf8Q,3722
4
4
  ngio/core/image_handler.py,sha256=2eiklMWCSZD9ajZHEwYJHB1WoQE92YTVOy7qslrtSaw,7569
5
5
  ngio/core/image_like_handler.py,sha256=_k1xs3Uct_FXKoyUDTfQwG755SmiMGlztGhsQW-OtOA,18821
6
6
  ngio/core/label_handler.py,sha256=yBWMQbhme0j4XhXcoWuNY0x3Kt_MH3aYTu6peOfWyTc,14102
7
- ngio/core/ngff_image.py,sha256=7gTPeU4cr51VTODeYEXAwsgXj8fW5NtWzNoLL5DUbSo,12491
7
+ ngio/core/ngff_image.py,sha256=3C4FE9Q-wtKwLn0Cdy7sCGIvFstgZbRWbUq-pUReOG4,13757
8
8
  ngio/core/roi.py,sha256=Vn9aKNxRvJs77ZfVFMAdjOzhy2I2ctpikLcbFP5aj74,2884
9
9
  ngio/core/utils.py,sha256=Z3_nI7nLtMZT2gHFgEFtAox6fcENiFuQA5n6UuK2uDo,10170
10
10
  ngio/io/__init__.py,sha256=g7KmkgRcVBTZbVkqstl_FldUFzz66R-b__HV9hsLvtc,400
@@ -38,7 +38,7 @@ ngio/utils/_common_types.py,sha256=ylo6RfCyKVyXPx1Mz7WAwFfz8F85R9yd2_TPlRGRUyo,1
38
38
  ngio/utils/_errors.py,sha256=rLy9LOFkaEmsSD0-nToKUrXY1ZuPfcpcGpmeHVSnTNg,583
39
39
  ngio/utils/_logger.py,sha256=zvFG-Ta3ZIJxTyY93zYoPGp2A6TTUf7mSO0zr_uFy4A,837
40
40
  ngio/utils/_pydantic_utils.py,sha256=uN5-76cjE3bvV8GvLX62fpxoRi8GOsZu6K5aynGH1bY,1711
41
- ngio-0.1.2.dist-info/METADATA,sha256=8F1QCxbL9n5L3KJ7CkhDEhd_3WPD16vTN4IEwLRdWyE,5683
42
- ngio-0.1.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
43
- ngio-0.1.2.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
44
- ngio-0.1.2.dist-info/RECORD,,
41
+ ngio-0.1.3.dist-info/METADATA,sha256=H75ePMg5vNzlZ2KGAmblELVRXevDwxOqMDwgJaIZpxU,5705
42
+ ngio-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ ngio-0.1.3.dist-info/licenses/LICENSE,sha256=UgN_a1QCeNh9rZWfz-wORQFxE3elQzLWPQaoK6N6fxQ,1502
44
+ ngio-0.1.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any