large-image-source-tifffile 1.28.2__py3-none-any.whl → 1.28.2.dev2__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.

@@ -474,12 +474,19 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
474
474
  sidx = frame // self._basis['P'][0]
475
475
  else:
476
476
  sidx = 0
477
+ series = self._tf.series[self._series[sidx]]
477
478
  nonempty = [None] * self.levels
478
479
  nonempty[self.levels - 1] = True
479
- series = self._tf.series[self._series[sidx]]
480
- za, hasgbs = self._getZarrArray(series, sidx)
481
480
  xidx = series.axes.index('X')
482
481
  yidx = series.axes.index('Y')
482
+ with self._zarrlock:
483
+ if sidx not in self._zarrcache:
484
+ if len(self._zarrcache) > 10:
485
+ self._zarrcache = {}
486
+ za = zarr.open(series.aszarr(), mode='r')
487
+ hasgbs = hasattr(za[0], 'get_basic_selection')
488
+ self._zarrcache[sidx] = (za, hasgbs)
489
+ za, hasgbs = self._zarrcache[sidx]
483
490
  for ll in range(1, len(series.levels)):
484
491
  scale = round(math.log(max(za[0].shape[xidx] / za[ll].shape[xidx],
485
492
  za[0].shape[yidx] / za[ll].shape[yidx])) / math.log(2))
@@ -490,19 +497,6 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
490
497
  self._nonempty_levels_list[frame] = nonempty
491
498
  return nonempty
492
499
 
493
- def _getZarrArray(self, series, sidx):
494
- with self._zarrlock:
495
- if sidx not in self._zarrcache:
496
- if len(self._zarrcache) > 10:
497
- self._zarrcache = {}
498
- za = zarr.open(series.aszarr(), mode='r')
499
- hasgbs = hasattr(za[0], 'get_basic_selection')
500
- if not hasgbs and math.prod(series.shape) < 256 * 1024 ** 2:
501
- za = series.asarray()
502
- self._zarrcache[sidx] = (za, hasgbs)
503
- za, hasgbs = self._zarrcache[sidx]
504
- return za, hasgbs
505
-
506
500
  @methodcache()
507
501
  def getTile(self, x, y, z, pilImageAllowed=False, numpyAllowed=False, **kwargs):
508
502
  frame = self._getFrame(**kwargs)
@@ -513,7 +507,14 @@ class TifffileFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
513
507
  else:
514
508
  sidx = 0
515
509
  series = self._tf.series[self._series[sidx]]
516
- za, hasgbs = self._getZarrArray(series, sidx)
510
+ with self._zarrlock:
511
+ if sidx not in self._zarrcache:
512
+ if len(self._zarrcache) > 10:
513
+ self._zarrcache = {}
514
+ za = zarr.open(series.aszarr(), mode='r')
515
+ hasgbs = hasattr(za[0], 'get_basic_selection')
516
+ self._zarrcache[sidx] = (za, hasgbs)
517
+ za, hasgbs = self._zarrcache[sidx]
517
518
  xidx = series.axes.index('X')
518
519
  yidx = series.axes.index('Y')
519
520
  if hasgbs:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-tifffile
3
- Version: 1.28.2
3
+ Version: 1.28.2.dev2
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.28.2
20
+ Requires-Dist: large-image >=1.28.2.dev2
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.28.2 ; extra == 'girder'
25
+ Requires-Dist: girder-large-image >=1.28.2.dev2 ; 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=mcVIBs3uhBpDHavAGEKH2G2ikuBgVW99LpPhnmf6V2c,25085
2
+ large_image_source_tifffile/girder_source.py,sha256=8YsxpSK_UzbAcpjn6fIMlgKye2FchkB8_HTSQV0FpRA,1064
3
+ large_image_source_tifffile-1.28.2.dev2.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
+ large_image_source_tifffile-1.28.2.dev2.dist-info/METADATA,sha256=yhWuJaNIFpRrZTCbjv369CmX90hEmQPvbkj5LpdTBZI,1061
5
+ large_image_source_tifffile-1.28.2.dev2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ large_image_source_tifffile-1.28.2.dev2.dist-info/entry_points.txt,sha256=aILCN5f7-Zj8-WRXcABxCQvqJv9VLTvqRhZ_7HEyokc,190
7
+ large_image_source_tifffile-1.28.2.dev2.dist-info/top_level.txt,sha256=feOAsix2Rzy6mjy2Ua-N0-L6tlKsgvLdRhO6Hd8_ZFs,28
8
+ large_image_source_tifffile-1.28.2.dev2.dist-info/RECORD,,
@@ -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.28.2.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
- large_image_source_tifffile-1.28.2.dist-info/METADATA,sha256=XltUBgjPNYqA5LFH3bgzxaUMUoNN3pSR2rppfryIwEs,1046
5
- large_image_source_tifffile-1.28.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- large_image_source_tifffile-1.28.2.dist-info/entry_points.txt,sha256=aILCN5f7-Zj8-WRXcABxCQvqJv9VLTvqRhZ_7HEyokc,190
7
- large_image_source_tifffile-1.28.2.dist-info/top_level.txt,sha256=feOAsix2Rzy6mjy2Ua-N0-L6tlKsgvLdRhO6Hd8_ZFs,28
8
- large_image_source_tifffile-1.28.2.dist-info/RECORD,,