large-image-source-bioformats 1.32.4.dev5__tar.gz → 1.32.4.dev8__tar.gz

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.

Files changed (15) hide show
  1. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/PKG-INFO +3 -3
  2. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats/__init__.py +57 -50
  3. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats.egg-info/PKG-INFO +3 -3
  4. large_image_source_bioformats-1.32.4.dev8/large_image_source_bioformats.egg-info/requires.txt +5 -0
  5. large_image_source_bioformats-1.32.4.dev5/large_image_source_bioformats.egg-info/requires.txt +0 -5
  6. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/LICENSE +0 -0
  7. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/README.rst +0 -0
  8. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats/girder_source.py +0 -0
  9. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats.egg-info/SOURCES.txt +0 -0
  10. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats.egg-info/dependency_links.txt +0 -0
  11. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats.egg-info/entry_points.txt +0 -0
  12. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/large_image_source_bioformats.egg-info/top_level.txt +0 -0
  13. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/pyproject.toml +0 -0
  14. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/setup.cfg +0 -0
  15. {large_image_source_bioformats-1.32.4.dev5 → large_image_source_bioformats-1.32.4.dev8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: large-image-source-bioformats
3
- Version: 1.32.4.dev5
3
+ Version: 1.32.4.dev8
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.dev5
21
+ Requires-Dist: large-image>=1.32.4.dev8
22
22
  Requires-Dist: python-bioformats>=1.5.2
23
23
  Provides-Extra: girder
24
- Requires-Dist: girder-large-image>=1.32.4.dev5; extra == "girder"
24
+ Requires-Dist: girder-large-image>=1.32.4.dev8; extra == "girder"
25
25
  Dynamic: author
26
26
  Dynamic: author-email
27
27
  Dynamic: classifier
@@ -57,6 +57,7 @@ javabridge = None
57
57
 
58
58
  _javabridgeStarted = None
59
59
  _javabridgeStartLock = threading.Lock()
60
+ _javabridgeAttachLock = threading.Lock()
60
61
  _bioformatsVersion = None
61
62
  _openImages = []
62
63
 
@@ -72,7 +73,8 @@ def _monitor_thread():
72
73
  main_thread.join()
73
74
  if len(_openImages):
74
75
  try:
75
- javabridge.attach()
76
+ with _javabridgeAttachLock:
77
+ javabridge.attach()
76
78
  while len(_openImages):
77
79
  source = _openImages.pop()
78
80
  source = source()
@@ -87,8 +89,9 @@ def _monitor_thread():
87
89
  except Exception:
88
90
  pass
89
91
  finally:
90
- if javabridge.get_env():
91
- javabridge.detach()
92
+ with _javabridgeAttachLock:
93
+ if javabridge.get_env():
94
+ javabridge.detach()
92
95
  _stopJavabridge()
93
96
 
94
97
 
@@ -231,10 +234,9 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
231
234
  raise TileSourceError(msg)
232
235
  self.addKnownExtensions()
233
236
 
234
- self._tileLock = threading.RLock()
235
-
236
237
  try:
237
- javabridge.attach()
238
+ with _javabridgeAttachLock:
239
+ javabridge.attach()
238
240
  try:
239
241
  self._bioimage = bioformats.ImageReader(largeImagePath, perform_init=False)
240
242
  try:
@@ -313,8 +315,9 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
313
315
  msg = 'The bioformats reader threw an unhandled exception.'
314
316
  raise TileSourceError(msg)
315
317
  finally:
316
- if javabridge.get_env():
317
- javabridge.detach()
318
+ with _javabridgeAttachLock:
319
+ if javabridge.get_env():
320
+ javabridge.detach()
318
321
 
319
322
  if self.levels < 1:
320
323
  msg = 'Bioformats image must have at least one level.'
@@ -340,15 +343,17 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
340
343
  def __del__(self):
341
344
  if getattr(self, '_bioimage', None) is not None:
342
345
  try:
343
- javabridge.attach()
346
+ with _javabridgeAttachLock:
347
+ javabridge.attach()
344
348
  self._bioimage.close()
345
349
  del self._bioimage
346
350
  _openImages.remove(weakref.ref(self))
347
351
  except Exception:
348
352
  pass
349
353
  finally:
350
- if javabridge.get_env():
351
- javabridge.detach()
354
+ with _javabridgeAttachLock:
355
+ if javabridge.get_env():
356
+ javabridge.detach()
352
357
 
353
358
  def _metadataForCurrentSeries(self, rdr):
354
359
  self._metadata = getattr(self, '_metadata', {})
@@ -664,33 +669,34 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
664
669
  tile = large_image.tilesource.base._imageToNumpy(tile)[0]
665
670
  format = TILE_FORMAT_NUMPY
666
671
  else:
667
- with self._tileLock:
668
- try:
669
- javabridge.attach()
670
- if width > 0 and height > 0:
671
- tile = self._bioimage.read(
672
- c=fc, z=fz, t=ft, series=fseries['series'][seriesLevel],
673
- rescale=False, # return internal data types
674
- XYWH=(offsetx, offsety, width, height))
675
- else:
676
- # We need the same dtype, so read 1x1 at 0x0
677
- tile = self._bioimage.read(
678
- c=fc, z=fz, t=ft, series=fseries['series'][seriesLevel],
679
- rescale=False, # return internal data types
680
- XYWH=(0, 0, 1, 1))
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:
672
+ with _javabridgeAttachLock:
673
+ javabridge.attach()
674
+ try:
675
+ if width > 0 and height > 0:
676
+ tile = self._bioimage.read(
677
+ c=fc, z=fz, t=ft, series=fseries['series'][seriesLevel],
678
+ rescale=False, # return internal data types
679
+ XYWH=(offsetx, offsety, width, height))
680
+ else:
681
+ # We need the same dtype, so read 1x1 at 0x0
682
+ tile = self._bioimage.read(
683
+ c=fc, z=fz, t=ft, series=fseries['series'][seriesLevel],
684
+ rescale=False, # return internal data types
685
+ XYWH=(0, 0, 1, 1))
686
+ tile = np.zeros(tuple([0, 0] + list(tile.shape[2:])), dtype=tile.dtype)
687
+ format = TILE_FORMAT_NUMPY
688
+ except javabridge.JavaException as exc:
689
+ es = javabridge.to_string(exc.throwable)
690
+ self.logger.exception('Failed to getTile (%r)', es)
691
+ if getattr(self, '_lastGetTileException', None) == 'raise':
692
+ raise TileSourceError('Failed to get Bioformat region (%s, %r).' % (es, (
693
+ fc, fz, ft, fseries, self.sizeX, self.sizeY, offsetx,
694
+ offsety, width, height)))
695
+ self._lastGetTileException = repr(es)
696
+ tile = np.zeros((1, 1))
697
+ format = TILE_FORMAT_NUMPY
698
+ finally:
699
+ with _javabridgeAttachLock:
694
700
  if javabridge.get_env():
695
701
  javabridge.detach()
696
702
  if scale > 1:
@@ -733,18 +739,19 @@ class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
733
739
  if info is None:
734
740
  return None
735
741
  series = info['seriesNum']
736
- with self._tileLock:
737
- try:
738
- javabridge.attach()
739
- image = self._bioimage.read(
740
- series=series,
741
- rescale=False, # return internal data types
742
- XYWH=(0, 0, info['sizeX'], info['sizeY']))
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:
742
+ with _javabridgeAttachLock:
743
+ javabridge.attach()
744
+ try:
745
+ image = self._bioimage.read(
746
+ series=series,
747
+ rescale=False, # return internal data types
748
+ XYWH=(0, 0, info['sizeX'], info['sizeY']))
749
+ except javabridge.JavaException as exc:
750
+ es = javabridge.to_string(exc.throwable)
751
+ raise TileSourceError('Failed to get Bioformat series (%s, %r).' % (es, (
752
+ series, info['sizeX'], info['sizeY'])))
753
+ finally:
754
+ with _javabridgeAttachLock:
748
755
  if javabridge.get_env():
749
756
  javabridge.detach()
750
757
  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.dev5
3
+ Version: 1.32.4.dev8
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.dev5
21
+ Requires-Dist: large-image>=1.32.4.dev8
22
22
  Requires-Dist: python-bioformats>=1.5.2
23
23
  Provides-Extra: girder
24
- Requires-Dist: girder-large-image>=1.32.4.dev5; extra == "girder"
24
+ Requires-Dist: girder-large-image>=1.32.4.dev8; extra == "girder"
25
25
  Dynamic: author
26
26
  Dynamic: author-email
27
27
  Dynamic: classifier
@@ -0,0 +1,5 @@
1
+ large-image>=1.32.4.dev8
2
+ python-bioformats>=1.5.2
3
+
4
+ [girder]
5
+ girder-large-image>=1.32.4.dev8
@@ -1,5 +0,0 @@
1
- large-image>=1.32.4.dev5
2
- python-bioformats>=1.5.2
3
-
4
- [girder]
5
- girder-large-image>=1.32.4.dev5