oct-to-tiff 0.6.0__py3-none-any.whl → 0.6.1__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.
oct_to_tiff/cli.py CHANGED
@@ -52,12 +52,47 @@ def reshape_volume(
52
52
  return volume
53
53
 
54
54
 
55
+ def volume_metadata(
56
+ pixel_size_x: float | None,
57
+ pixel_size_y: float | None,
58
+ pixel_size_z: float | None,
59
+ ) -> dict[str, Any]:
60
+ """Build a dictionary of metadata.
61
+
62
+ Parameters
63
+ ----------
64
+ pixel_size_x : float | None
65
+ The pixel (voxel) width in mm.
66
+ pixel_size_y : float | None
67
+ The pixel (voxel) height in mm.
68
+ pixel_size_z : float | None
69
+ The pixel (voxel) depth in mm.
70
+
71
+ Returns
72
+ -------
73
+ metadata : dict[str, Any]
74
+ A dictionary of metadata.
75
+
76
+ """
77
+ metadata: dict[str, Any] = {"axes": "ZYX"}
78
+ if pixel_size_x is not None:
79
+ metadata["PhysicalSizeX"] = pixel_size_x
80
+ metadata["PhysicalSizeXUnit"] = "mm"
81
+ if pixel_size_y is not None:
82
+ metadata["PhysicalSizeY"] = pixel_size_y
83
+ metadata["PhysicalSizeYUnit"] = "mm"
84
+ if pixel_size_z is not None:
85
+ metadata["PhysicalSizeZ"] = pixel_size_z
86
+ metadata["PhysicalSizeZUnit"] = "mm"
87
+ return metadata
88
+
89
+
55
90
  def write_volume(
56
91
  output_path: Path,
57
92
  volume: npt.NDArray[Any],
58
- pixel_size_x: float,
59
- pixel_size_y: float,
60
- pixel_size_z: float,
93
+ pixel_size_x: float | None,
94
+ pixel_size_y: float | None,
95
+ pixel_size_z: float | None,
61
96
  ) -> None:
62
97
  """Write a 3-dimensional array to the output path as an OME-TIFF file, including voxel size in the metadata.
63
98
 
@@ -79,15 +114,7 @@ def write_volume(
79
114
  output_path,
80
115
  volume,
81
116
  photometric="minisblack",
82
- metadata={
83
- "axes": "ZYX",
84
- "PhysicalSizeX": pixel_size_x,
85
- "PhysicalSizeXUnit": "mm",
86
- "PhysicalSizeY": pixel_size_y,
87
- "PhysicalSizeYUnit": "mm",
88
- "PhysicalSizeZ": pixel_size_z,
89
- "PhysicalSizeZUnit": "mm",
90
- },
117
+ metadata=volume_metadata(pixel_size_x, pixel_size_y, pixel_size_z),
91
118
  )
92
119
 
93
120
 
@@ -245,7 +272,7 @@ def main() -> None:
245
272
  xy_scan_length = int(len(volume) ** 0.5)
246
273
  pixel_size_x = args.size / oct_window_height
247
274
  pixel_size_y = args.size / xy_scan_length
248
- pixel_size_z = 1
275
+ pixel_size_z = None
249
276
  elif args.seg_curve:
250
277
  volume = np.frombuffer(f.read(), dtype=np.single)
251
278
  if len(volume) == 1280000 or len(volume) == 1120000:
@@ -256,9 +283,9 @@ def main() -> None:
256
283
  oct_window_height = 304
257
284
  total_data_groups = 1
258
285
  xy_scan_length = len(volume) // (frames_per_data_group * oct_window_height)
259
- pixel_size_x = 1
260
- pixel_size_y = 1
261
- pixel_size_z = 1
286
+ pixel_size_x = None
287
+ pixel_size_y = None
288
+ pixel_size_z = None
262
289
  elif "3D Cornea" in file_name:
263
290
  volume = np.frombuffer(f.read(), dtype=np.single)
264
291
  frames_per_data_group = 106
@@ -338,7 +365,7 @@ def main() -> None:
338
365
  xy_scan_length = 1020
339
366
  pixel_size_x = 0.002941
340
367
  pixel_size_y = 0.003071
341
- pixel_size_z = 1
368
+ pixel_size_z = None
342
369
  elif "Cornea Cross Line" in file_name:
343
370
  volume = np.frombuffer(f.read(), dtype=np.single)
344
371
  frames_per_data_group = 2
@@ -347,7 +374,7 @@ def main() -> None:
347
374
  xy_scan_length = 941
348
375
  pixel_size_x = 0.008502
349
376
  pixel_size_y = 0.003071
350
- pixel_size_z = 1
377
+ pixel_size_z = None
351
378
  elif "Cornea Line" in file_name:
352
379
  volume = np.frombuffer(f.read(), dtype=np.single)
353
380
  frames_per_data_group = 1
@@ -356,7 +383,7 @@ def main() -> None:
356
383
  xy_scan_length = 1020
357
384
  pixel_size_x = 0.007843
358
385
  pixel_size_y = 0.003071
359
- pixel_size_z = 1
386
+ pixel_size_z = None
360
387
  elif "Cross Line" in file_name:
361
388
  volume = np.frombuffer(f.read(), dtype=np.single)
362
389
  frames_per_data_group = 2
@@ -365,7 +392,7 @@ def main() -> None:
365
392
  xy_scan_length = 1020
366
393
  pixel_size_x = 0.009804
367
394
  pixel_size_y = 0.003071
368
- pixel_size_z = 1
395
+ pixel_size_z = None
369
396
  elif "Enhanced HD Line" in file_name:
370
397
  volume = np.frombuffer(f.read(), dtype=np.single)
371
398
  frames_per_data_group = 1
@@ -374,7 +401,7 @@ def main() -> None:
374
401
  xy_scan_length = 998
375
402
  pixel_size_x = 0.012024
376
403
  pixel_size_y = 0.003071
377
- pixel_size_z = 1
404
+ pixel_size_z = None
378
405
  elif "GCC" in file_name:
379
406
  volume = np.frombuffer(f.read(), dtype=np.single)
380
407
  frames_per_data_group = 16
@@ -383,7 +410,7 @@ def main() -> None:
383
410
  xy_scan_length = 933
384
411
  pixel_size_x = 0.007503
385
412
  pixel_size_y = 0.003071
386
- pixel_size_z = 1
413
+ pixel_size_z = None
387
414
  elif "Grid" in file_name:
388
415
  volume = np.frombuffer(f.read(), dtype=np.single)
389
416
  frames_per_data_group = 10
@@ -392,7 +419,7 @@ def main() -> None:
392
419
  xy_scan_length = 1020
393
420
  pixel_size_x = 0.005882
394
421
  pixel_size_y = 0.003071
395
- pixel_size_z = 1
422
+ pixel_size_z = None
396
423
  elif "HD Angio Disc" in file_name:
397
424
  volume = np.frombuffer(f.read(), dtype=np.single)
398
425
  frames_per_data_group = 400
@@ -446,7 +473,7 @@ def main() -> None:
446
473
  xy_scan_length = 1024
447
474
  pixel_size_x = 0.009766
448
475
  pixel_size_y = 0.003071
449
- pixel_size_z = 1
476
+ pixel_size_z = None
450
477
  elif "Line" in file_name:
451
478
  volume = np.frombuffer(f.read(), dtype=np.single)
452
479
  frames_per_data_group = 1
@@ -455,7 +482,7 @@ def main() -> None:
455
482
  xy_scan_length = 1020
456
483
  pixel_size_x = 0.008824
457
484
  pixel_size_y = 0.003071
458
- pixel_size_z = 1
485
+ pixel_size_z = None
459
486
  elif "ONH" in file_name:
460
487
  volume = np.frombuffer(f.read(), dtype=np.single, count=2223360)
461
488
  frames_per_data_group = 3
@@ -464,7 +491,7 @@ def main() -> None:
464
491
  xy_scan_length = 965
465
492
  pixel_size_x = 0.015952
466
493
  pixel_size_y = 0.003071
467
- pixel_size_z = 1
494
+ pixel_size_z = None
468
495
  elif "PachymetryWide" in file_name:
469
496
  volume = np.frombuffer(f.read(), dtype=np.single)
470
497
  frames_per_data_group = 16
@@ -473,7 +500,7 @@ def main() -> None:
473
500
  xy_scan_length = 1536
474
501
  pixel_size_x = 0.005859
475
502
  pixel_size_y = 0.003071
476
- pixel_size_z = 1
503
+ pixel_size_z = None
477
504
  elif "Raster" in file_name:
478
505
  volume = np.frombuffer(f.read(), dtype=np.single)
479
506
  frames_per_data_group = 21
@@ -482,7 +509,7 @@ def main() -> None:
482
509
  xy_scan_length = 1020
483
510
  pixel_size_x = 0.011765
484
511
  pixel_size_y = 0.003071
485
- pixel_size_z = 1
512
+ pixel_size_z = None
486
513
  elif "Retina Map" in file_name:
487
514
  volume = np.frombuffer(f.read(), dtype=np.single, count=6680960)
488
515
  frames_per_data_group = 13
@@ -491,7 +518,7 @@ def main() -> None:
491
518
  xy_scan_length = 803
492
519
  pixel_size_x = 0.007472
493
520
  pixel_size_y = 0.003071
494
- pixel_size_z = 1
521
+ pixel_size_z = None
495
522
 
496
523
  volume = reshape_volume(
497
524
  volume,
@@ -1,14 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oct-to-tiff
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: A command line tool for converting optical coherence tomography angiography (OCTA) data.
5
+ Keywords: angiography,cli,oct,octa
6
+ Author: Cameron Lloyd
5
7
  Author-email: Cameron Lloyd <lloyd@med.unideb.hu>
6
- Maintainer-email: Cameron Lloyd <lloyd@med.unideb.hu>
7
8
  License-Expression: BSD-3-Clause
8
- Project-URL: Homepage, https://github.com/camlloyd/oct-to-tiff
9
- Project-URL: Bug Tracker, https://github.com/camlloyd/oct-to-tiff/issues
10
- Project-URL: Changelog, https://github.com/camlloyd/oct-to-tiff/blob/main/CHANGELOG.md
11
- Keywords: angiography,cli,oct,octa
9
+ License-File: LICENSE.txt
12
10
  Classifier: Development Status :: 3 - Alpha
13
11
  Classifier: Intended Audience :: Science/Research
14
12
  Classifier: Natural Language :: English
@@ -18,18 +16,21 @@ Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
17
  Classifier: Programming Language :: Python :: 3.13
20
18
  Classifier: Programming Language :: Python :: 3.14
21
- Requires-Python: >=3.11
22
- Description-Content-Type: text/markdown
23
- License-File: LICENSE.txt
24
19
  Requires-Dist: defusedxml
25
20
  Requires-Dist: numpy
26
21
  Requires-Dist: roifile
27
22
  Requires-Dist: tifffile
23
+ Requires-Dist: mypy ; extra == 'dev'
24
+ Requires-Dist: ruff ; extra == 'dev'
25
+ Requires-Dist: types-defusedxml ; extra == 'dev'
26
+ Maintainer: Cameron Lloyd
27
+ Maintainer-email: Cameron Lloyd <lloyd@med.unideb.hu>
28
+ Requires-Python: >=3.11
29
+ Project-URL: Homepage, https://github.com/camlloyd/oct-to-tiff
30
+ Project-URL: Bug Tracker, https://github.com/camlloyd/oct-to-tiff/issues
31
+ Project-URL: Changelog, https://github.com/camlloyd/oct-to-tiff/blob/main/CHANGELOG.md
28
32
  Provides-Extra: dev
29
- Requires-Dist: mypy; extra == "dev"
30
- Requires-Dist: ruff; extra == "dev"
31
- Requires-Dist: types-defusedxml; extra == "dev"
32
- Dynamic: license-file
33
+ Description-Content-Type: text/markdown
33
34
 
34
35
  # oct-to-tiff
35
36
 
@@ -46,9 +47,9 @@ via pip:
46
47
 
47
48
  pip install oct-to-tiff
48
49
 
49
- via mamba:
50
+ via conda:
50
51
 
51
- mamba install -c conda-forge oct-to-tiff
52
+ conda install conda-forge::oct-to-tiff
52
53
 
53
54
  ## Getting started
54
55
  oct-to-tiff /path/to/image.OCT
@@ -186,4 +187,4 @@ This project uses [Ruff](https://github.com/astral-sh/ruff) for linting and form
186
187
 
187
188
  ## Requirements
188
189
 
189
- Requires Python 3.11 or higher.
190
+ Requires Python 3.11 or higher.
@@ -0,0 +1,7 @@
1
+ oct_to_tiff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ oct_to_tiff/cli.py,sha256=zocMW8eg3CG1Xx_gLHac8Qxb1jY4TFlSaVMJFhFK1gU,18047
3
+ oct_to_tiff-0.6.1.dist-info/licenses/LICENSE.txt,sha256=8KO0dluzLStmIF0HM18BOP9T2miIcX8q-GOfMOw6Ngk,1521
4
+ oct_to_tiff-0.6.1.dist-info/WHEEL,sha256=5DEXXimM34_d4Gx1AuF9ysMr1_maoEtGKjaILM3s4w4,80
5
+ oct_to_tiff-0.6.1.dist-info/entry_points.txt,sha256=7kgVLpDuqbX5H38msz7NjYjUXQzmk4PW0TXc_FRz2uA,54
6
+ oct_to_tiff-0.6.1.dist-info/METADATA,sha256=9OtspNGKdjnlwP5Pe2CpYRbzqyS91y5gbT0CgcaeymU,4939
7
+ oct_to_tiff-0.6.1.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: uv 0.9.29
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  oct-to-tiff = oct_to_tiff.cli:main
3
+
@@ -1,8 +0,0 @@
1
- oct_to_tiff/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- oct_to_tiff/cli.py,sha256=GmIMXLuNfAEZaijX2_93XB95V0Mdr1yb73Q_j8eBiEI,17232
3
- oct_to_tiff-0.6.0.dist-info/licenses/LICENSE.txt,sha256=8KO0dluzLStmIF0HM18BOP9T2miIcX8q-GOfMOw6Ngk,1521
4
- oct_to_tiff-0.6.0.dist-info/METADATA,sha256=7atS8U7OhVhVpU48NjbGzqMtbGhlA_l4Dh6jZUiu010,4913
5
- oct_to_tiff-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- oct_to_tiff-0.6.0.dist-info/entry_points.txt,sha256=mKWNdkTThZm2JKtLwp4PGMpXkvAWk-xnQDAOyRsCo9Y,53
7
- oct_to_tiff-0.6.0.dist-info/top_level.txt,sha256=_ovqm7f48yb_IAiVqWzB3VPnHXwzkkEqQQ_ZJz_McSY,12
8
- oct_to_tiff-0.6.0.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- oct_to_tiff