large-image-source-tifffile 1.29.2.dev25__py3-none-any.whl → 1.29.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.

Potentially problematic release.


This version of large-image-source-tifffile might be problematic. Click here for more details.

@@ -7,7 +7,6 @@ from importlib.metadata import PackageNotFoundError
7
7
  from importlib.metadata import version as _importlib_version
8
8
 
9
9
  import numpy as np
10
- import zarr
11
10
 
12
11
  import large_image
13
12
  from large_image.cache_util import LruCacheMetaclass, methodcache
@@ -16,6 +15,7 @@ from large_image.exceptions import TileSourceError, TileSourceFileNotFoundError
16
15
  from large_image.tilesource import FileTileSource
17
16
 
18
17
  tifffile = None
18
+ zarr = None
19
19
 
20
20
  try:
21
21
  __version__ = _importlib_version(__name__)
@@ -37,6 +37,7 @@ def _lazyImport():
37
37
  module initialization because it is slow.
38
38
  """
39
39
  global tifffile
40
+ global zarr
40
41
 
41
42
  if tifffile is None:
42
43
  try:
@@ -55,6 +56,8 @@ def _lazyImport():
55
56
  logging.getLogger('tifffile.tifffile').addHandler(checkForMissingDataHandler())
56
57
  logging.getLogger('tifffile').setLevel(logging.WARNING)
57
58
  logging.getLogger('tifffile').addHandler(checkForMissingDataHandler())
59
+ if zarr is None:
60
+ import zarr
58
61
 
59
62
 
60
63
  def et_findall(tag, text):
@@ -351,6 +354,63 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
351
354
  except Exception:
352
355
  pass
353
356
 
357
+ def _handle_ome(self):
358
+ """
359
+ For OME Tiff, if we didn't parse the mangification elsewhere, try to
360
+ parse it here.
361
+ """
362
+ import xml.etree.ElementTree
363
+
364
+ import large_image.tilesource.utilities
365
+
366
+ _omeUnitsToMeters = {
367
+ 'Ym': 1e24,
368
+ 'Zm': 1e21,
369
+ 'Em': 1e18,
370
+ 'Pm': 1e15,
371
+ 'Tm': 1e12,
372
+ 'Gm': 1e9,
373
+ 'Mm': 1e6,
374
+ 'km': 1e3,
375
+ 'hm': 1e2,
376
+ 'dam': 1e1,
377
+ 'm': 1,
378
+ 'dm': 1e-1,
379
+ 'cm': 1e-2,
380
+ 'mm': 1e-3,
381
+ '\u00b5m': 1e-6,
382
+ 'nm': 1e-9,
383
+ 'pm': 1e-12,
384
+ 'fm': 1e-15,
385
+ 'am': 1e-18,
386
+ 'zm': 1e-21,
387
+ 'ym': 1e-24,
388
+ '\u00c5': 1e-10,
389
+ }
390
+
391
+ try:
392
+ root = xml.etree.ElementTree.fromstring(self._tf.pages[0].description)
393
+ self._xml = large_image.tilesource.utilities.etreeToDict(root)
394
+ except Exception:
395
+ return
396
+ try:
397
+ try:
398
+ base = self._xml['OME']['Image'][0]['Pixels']
399
+ except Exception:
400
+ base = self._xml['OME']['Image']['Pixels']
401
+ if self._mm_x is None and 'PhysicalSizeX' in base:
402
+ self._mm_x = (
403
+ float(base['PhysicalSizeX']) * 1e3 *
404
+ _omeUnitsToMeters[base.get('PhysicalSizeXUnit', '\u00b5m')])
405
+ if self._mm_y is None and 'PhysicalSizeY' in base:
406
+ self._mm_y = (
407
+ float(base['PhysicalSizeY']) * 1e3 *
408
+ _omeUnitsToMeters[base.get('PhysicalSizeYUnit', '\u00b5m')])
409
+ self._mm_x = self._mm_x or self._mm_y
410
+ self._mm_y = self._mm_y or self._mm_x
411
+ except Exception:
412
+ pass
413
+
354
414
  def getNativeMagnification(self):
355
415
  """
356
416
  Get the magnification at a particular level.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-tifffile
3
- Version: 1.29.2.dev25
3
+ Version: 1.29.3
4
4
  Summary: A tifffile tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -17,12 +17,12 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Requires-Python: >=3.8
19
19
  License-File: LICENSE
20
- Requires-Dist: large-image >=1.29.2.dev25
20
+ Requires-Dist: large-image >=1.29.3
21
21
  Requires-Dist: dask[array]
22
22
  Requires-Dist: tifffile[all]
23
23
  Requires-Dist: zarr
24
24
  Provides-Extra: girder
25
- Requires-Dist: girder-large-image >=1.29.2.dev25 ; extra == 'girder'
25
+ Requires-Dist: girder-large-image >=1.29.3 ; extra == 'girder'
26
26
 
27
27
  A tifffile tilesource for large_image.
28
28
 
@@ -0,0 +1,8 @@
1
+ large_image_source_tifffile/__init__.py,sha256=f7U3_Fkaqy8G6kJL1i4sC45RhQBbpQ3JLGLIJutoWgM,26877
2
+ large_image_source_tifffile/girder_source.py,sha256=8YsxpSK_UzbAcpjn6fIMlgKye2FchkB8_HTSQV0FpRA,1064
3
+ large_image_source_tifffile-1.29.3.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
+ large_image_source_tifffile-1.29.3.dist-info/METADATA,sha256=fqEjj7z0QqVbkpBOoN2aYROtliv3Pk-QVaVhTWbJ3SQ,1046
5
+ large_image_source_tifffile-1.29.3.dist-info/WHEEL,sha256=-oYQCr74JF3a37z2nRlQays_SX2MqOANoqVjBBAP2yE,91
6
+ large_image_source_tifffile-1.29.3.dist-info/entry_points.txt,sha256=aILCN5f7-Zj8-WRXcABxCQvqJv9VLTvqRhZ_7HEyokc,190
7
+ large_image_source_tifffile-1.29.3.dist-info/top_level.txt,sha256=feOAsix2Rzy6mjy2Ua-N0-L6tlKsgvLdRhO6Hd8_ZFs,28
8
+ large_image_source_tifffile-1.29.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.3.0)
2
+ Generator: setuptools (71.0.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,8 +0,0 @@
1
- large_image_source_tifffile/__init__.py,sha256=7hREWGbhyYOcz94l_vxMAOTUSJKtJY37TEIZdkvamNw,25001
2
- large_image_source_tifffile/girder_source.py,sha256=8YsxpSK_UzbAcpjn6fIMlgKye2FchkB8_HTSQV0FpRA,1064
3
- large_image_source_tifffile-1.29.2.dev25.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
- large_image_source_tifffile-1.29.2.dev25.dist-info/METADATA,sha256=V5mA4EXX-iIJBLr7wVJ_EXkwxoALYZuj2QBRaqdIw4Y,1064
5
- large_image_source_tifffile-1.29.2.dev25.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
6
- large_image_source_tifffile-1.29.2.dev25.dist-info/entry_points.txt,sha256=aILCN5f7-Zj8-WRXcABxCQvqJv9VLTvqRhZ_7HEyokc,190
7
- large_image_source_tifffile-1.29.2.dev25.dist-info/top_level.txt,sha256=feOAsix2Rzy6mjy2Ua-N0-L6tlKsgvLdRhO6Hd8_ZFs,28
8
- large_image_source_tifffile-1.29.2.dev25.dist-info/RECORD,,