large-image-source-bioformats 1.32.4__py3-none-any.whl → 1.32.4a124__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-bioformats might be problematic. Click here for more details.

@@ -57,7 +57,6 @@ javabridge = None
57
57
 
58
58
  _javabridgeStarted = None
59
59
  _javabridgeStartLock = threading.Lock()
60
- _javabridgeAttachLock = threading.Lock()
61
60
  _bioformatsVersion = None
62
61
  _openImages = []
63
62
 
@@ -73,8 +72,7 @@ def _monitor_thread():
73
72
  main_thread.join()
74
73
  if len(_openImages):
75
74
  try:
76
- with _javabridgeAttachLock:
77
- javabridge.attach()
75
+ javabridge.attach()
78
76
  while len(_openImages):
79
77
  source = _openImages.pop()
80
78
  source = source()
@@ -89,9 +87,8 @@ def _monitor_thread():
89
87
  except Exception:
90
88
  pass
91
89
  finally:
92
- with _javabridgeAttachLock:
93
- if javabridge.get_env():
94
- javabridge.detach()
90
+ if javabridge.get_env():
91
+ javabridge.detach()
95
92
  _stopJavabridge()
96
93
 
97
94
 
@@ -237,8 +234,7 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
237
234
  self._tileLock = threading.RLock()
238
235
 
239
236
  try:
240
- with _javabridgeAttachLock:
241
- javabridge.attach()
237
+ javabridge.attach()
242
238
  try:
243
239
  self._bioimage = bioformats.ImageReader(largeImagePath, perform_init=False)
244
240
  try:
@@ -317,9 +313,8 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
317
313
  msg = 'The bioformats reader threw an unhandled exception.'
318
314
  raise TileSourceError(msg)
319
315
  finally:
320
- with _javabridgeAttachLock:
321
- if javabridge.get_env():
322
- javabridge.detach()
316
+ if javabridge.get_env():
317
+ javabridge.detach()
323
318
 
324
319
  if self.levels < 1:
325
320
  msg = 'Bioformats image must have at least one level.'
@@ -345,17 +340,15 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
345
340
  def __del__(self):
346
341
  if getattr(self, '_bioimage', None) is not None:
347
342
  try:
348
- with _javabridgeAttachLock:
349
- javabridge.attach()
343
+ javabridge.attach()
350
344
  self._bioimage.close()
351
345
  del self._bioimage
352
346
  _openImages.remove(weakref.ref(self))
353
347
  except Exception:
354
348
  pass
355
349
  finally:
356
- with _javabridgeAttachLock:
357
- if javabridge.get_env():
358
- javabridge.detach()
350
+ if javabridge.get_env():
351
+ javabridge.detach()
359
352
 
360
353
  def _metadataForCurrentSeries(self, rdr):
361
354
  self._metadata = getattr(self, '_metadata', {})
@@ -671,37 +664,33 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
671
664
  tile = large_image.tilesource.base._imageToNumpy(tile)[0]
672
665
  format = TILE_FORMAT_NUMPY
673
666
  else:
674
- with _javabridgeAttachLock:
675
- javabridge.attach()
676
- try:
677
- if width > 0 and height > 0:
678
- with self._tileLock:
667
+ with self._tileLock:
668
+ try:
669
+ javabridge.attach()
670
+ if width > 0 and height > 0:
679
671
  tile = self._bioimage.read(
680
- c=fc, z=fz, t=ft,
681
- series=fseries['series'][seriesLevel],
672
+ c=fc, z=fz, t=ft, series=fseries['series'][seriesLevel],
682
673
  rescale=False, # return internal data types
683
674
  XYWH=(offsetx, offsety, width, height))
684
- else:
685
- # We need the same dtype, so read 1x1 at 0x0
686
- with self._tileLock:
675
+ else:
676
+ # We need the same dtype, so read 1x1 at 0x0
687
677
  tile = self._bioimage.read(
688
678
  c=fc, z=fz, t=ft, series=fseries['series'][seriesLevel],
689
679
  rescale=False, # return internal data types
690
680
  XYWH=(0, 0, 1, 1))
691
- tile = np.zeros(tuple([0, 0] + list(tile.shape[2:])), dtype=tile.dtype)
692
- format = TILE_FORMAT_NUMPY
693
- except javabridge.JavaException as exc:
694
- es = javabridge.to_string(exc.throwable)
695
- self.logger.exception('Failed to getTile (%r)', es)
696
- if getattr(self, '_lastGetTileException', None) == 'raise':
697
- raise TileSourceError('Failed to get Bioformat region (%s, %r).' % (es, (
698
- fc, fz, ft, fseries, self.sizeX, self.sizeY, offsetx,
699
- offsety, width, height)))
700
- self._lastGetTileException = repr(es)
701
- tile = np.zeros((1, 1))
702
- format = TILE_FORMAT_NUMPY
703
- finally:
704
- with _javabridgeAttachLock:
681
+ tile = np.zeros(tuple([0, 0] + list(tile.shape[2:])), dtype=tile.dtype)
682
+ format = TILE_FORMAT_NUMPY
683
+ except javabridge.JavaException as exc:
684
+ es = javabridge.to_string(exc.throwable)
685
+ self.logger.exception('Failed to getTile (%r)', es)
686
+ if getattr(self, '_lastGetTileException', None) == 'raise':
687
+ raise TileSourceError('Failed to get Bioformat region (%s, %r).' % (es, (
688
+ fc, fz, ft, fseries, self.sizeX, self.sizeY, offsetx,
689
+ offsety, width, height)))
690
+ self._lastGetTileException = repr(es)
691
+ tile = np.zeros((1, 1))
692
+ format = TILE_FORMAT_NUMPY
693
+ finally:
705
694
  if javabridge.get_env():
706
695
  javabridge.detach()
707
696
  if scale > 1:
@@ -744,20 +733,18 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
744
733
  if info is None:
745
734
  return None
746
735
  series = info['seriesNum']
747
- with _javabridgeAttachLock:
748
- javabridge.attach()
749
- try:
750
- with self._tileLock:
736
+ with self._tileLock:
737
+ try:
738
+ javabridge.attach()
751
739
  image = self._bioimage.read(
752
740
  series=series,
753
741
  rescale=False, # return internal data types
754
742
  XYWH=(0, 0, info['sizeX'], info['sizeY']))
755
- except javabridge.JavaException as exc:
756
- es = javabridge.to_string(exc.throwable)
757
- raise TileSourceError('Failed to get Bioformat series (%s, %r).' % (es, (
758
- series, info['sizeX'], info['sizeY'])))
759
- finally:
760
- with _javabridgeAttachLock:
743
+ except javabridge.JavaException as exc:
744
+ es = javabridge.to_string(exc.throwable)
745
+ raise TileSourceError('Failed to get Bioformat series (%s, %r).' % (es, (
746
+ series, info['sizeX'], info['sizeY'])))
747
+ finally:
761
748
  if javabridge.get_env():
762
749
  javabridge.detach()
763
750
  return large_image.tilesource.base._imageToPIL(image)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: large-image-source-bioformats
3
- Version: 1.32.4
3
+ Version: 1.32.4a124
4
4
  Summary: An bioformats tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -18,10 +18,10 @@ Classifier: Programming Language :: Python :: 3.13
18
18
  Requires-Python: >=3.8
19
19
  Description-Content-Type: text/x-rst
20
20
  License-File: LICENSE
21
- Requires-Dist: large-image>=1.32.4
21
+ Requires-Dist: large-image>=1.32.4.a124
22
22
  Requires-Dist: python-bioformats>=1.5.2
23
23
  Provides-Extra: girder
24
- Requires-Dist: girder-large-image>=1.32.4; extra == "girder"
24
+ Requires-Dist: girder-large-image>=1.32.4.a124; extra == "girder"
25
25
  Dynamic: author
26
26
  Dynamic: author-email
27
27
  Dynamic: classifier
@@ -0,0 +1,8 @@
1
+ large_image_source_bioformats/__init__.py,sha256=Mq4JqX1NF5rnYa125tG2uS519LlR6c2mmPs-AHOJcy8,34420
2
+ large_image_source_bioformats/girder_source.py,sha256=t0X1P0m4qMsRklpdxoPH-yqgHByMvQIzFJ4qRIUykVI,1355
3
+ large_image_source_bioformats-1.32.4a124.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
+ large_image_source_bioformats-1.32.4a124.dist-info/METADATA,sha256=PYLgA05faHT08ivRlH-lzG7W6hBsLhe6f547tm-gEAE,1315
5
+ large_image_source_bioformats-1.32.4a124.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
6
+ large_image_source_bioformats-1.32.4a124.dist-info/entry_points.txt,sha256=xgIbKr53QhQkyRFkr87fkagfPWweeqhHHekUEMrcpF8,202
7
+ large_image_source_bioformats-1.32.4a124.dist-info/top_level.txt,sha256=e0enjlcFXwPi638IhE71Rk5-eeriA7W3M3IsQ6yH3RI,30
8
+ large_image_source_bioformats-1.32.4a124.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- large_image_source_bioformats/__init__.py,sha256=mO0uF67YoJSjzdvmdnzlw259FU7M6g7s-Iuj9X2QNdA,34886
2
- large_image_source_bioformats/girder_source.py,sha256=t0X1P0m4qMsRklpdxoPH-yqgHByMvQIzFJ4qRIUykVI,1355
3
- large_image_source_bioformats-1.32.4.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
4
- large_image_source_bioformats-1.32.4.dist-info/METADATA,sha256=x9Eh3xlY3P4iOOyO9nqADA2B_BmGeLSPXaBniGkWWkM,1301
5
- large_image_source_bioformats-1.32.4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
6
- large_image_source_bioformats-1.32.4.dist-info/entry_points.txt,sha256=xgIbKr53QhQkyRFkr87fkagfPWweeqhHHekUEMrcpF8,202
7
- large_image_source_bioformats-1.32.4.dist-info/top_level.txt,sha256=e0enjlcFXwPi638IhE71Rk5-eeriA7W3M3IsQ6yH3RI,30
8
- large_image_source_bioformats-1.32.4.dist-info/RECORD,,