large-image-source-bioformats 1.26.3.dev14__tar.gz → 1.26.3.dev24__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.
Files changed (15) hide show
  1. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/PKG-INFO +1 -1
  2. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats/__init__.py +53 -24
  3. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats.egg-info/PKG-INFO +1 -1
  4. large-image-source-bioformats-1.26.3.dev24/large_image_source_bioformats.egg-info/requires.txt +5 -0
  5. large-image-source-bioformats-1.26.3.dev14/large_image_source_bioformats.egg-info/requires.txt +0 -5
  6. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/LICENSE +0 -0
  7. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/README.rst +0 -0
  8. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats/girder_source.py +0 -0
  9. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats.egg-info/SOURCES.txt +0 -0
  10. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats.egg-info/dependency_links.txt +0 -0
  11. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats.egg-info/entry_points.txt +0 -0
  12. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/large_image_source_bioformats.egg-info/top_level.txt +0 -0
  13. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/pyproject.toml +0 -0
  14. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/setup.cfg +0 -0
  15. {large-image-source-bioformats-1.26.3.dev14 → large-image-source-bioformats-1.26.3.dev24}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-bioformats
3
- Version: 1.26.3.dev14
3
+ Version: 1.26.3.dev24
4
4
  Summary: An bioformats tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -26,10 +26,12 @@ import atexit
26
26
  import logging
27
27
  import math
28
28
  import os
29
+ import pathlib
29
30
  import re
30
31
  import threading
31
32
  import types
32
33
  import weakref
34
+ import zipfile
33
35
  from importlib.metadata import PackageNotFoundError
34
36
  from importlib.metadata import version as _importlib_version
35
37
 
@@ -53,6 +55,8 @@ bioformats = None
53
55
  javabridge = None
54
56
 
55
57
  _javabridgeStarted = None
58
+ _javabridgeStartLock = threading.Lock()
59
+ _bioformatsVersion = None
56
60
  _openImages = []
57
61
 
58
62
 
@@ -87,7 +91,7 @@ def _monitor_thread():
87
91
 
88
92
 
89
93
  def _reduceLogging():
90
- # As of bioformat 4.0.0, org.apache.log4j isn't in the bundled
94
+ # As of python-bioformats 4.0.0, org.apache.log4j isn't in the bundled
91
95
  # jar file, so setting log levels just produces needless warnings.
92
96
  # bioformats.log4j.basic_config()
93
97
  # javabridge.JClassWrapper('loci.common.Log4jTools').setRootLevel(
@@ -110,30 +114,40 @@ def _reduceLogging():
110
114
 
111
115
 
112
116
  def _startJavabridge(logger):
113
- global _javabridgeStarted
117
+ global _javabridgeStarted, _bioformatsVersion
118
+
119
+ with _javabridgeStartLock:
120
+ if _javabridgeStarted is None:
121
+ # Only import these when first asked. They are slow to import.
122
+ global bioformats
123
+ global javabridge
124
+ if bioformats is None:
125
+ import bioformats
126
+ try:
127
+ _bioformatsVersion = zipfile.ZipFile(
128
+ pathlib.Path(bioformats.__file__).parent /
129
+ 'jars/bioformats_package.jar',
130
+ ).open('META-INF/MANIFEST.MF').read(8192).split(
131
+ b'Implementation-Version: ')[1].split()[0].decode()
132
+ logger.info('Bioformats.jar version: %s', _bioformatsVersion)
133
+ except Exception:
134
+ pass
135
+ if javabridge is None:
136
+ import javabridge
114
137
 
115
- if _javabridgeStarted is None:
116
- # Only import these when first asked. They are slow to import.
117
- global bioformats
118
- global javabridge
119
- if bioformats is None:
120
- import bioformats
121
- if javabridge is None:
122
- import javabridge
123
-
124
- # We need something to wake up at exit and shut things down
125
- monitor = threading.Thread(target=_monitor_thread)
126
- monitor.daemon = True
127
- monitor.start()
128
- try:
129
- javabridge.start_vm(class_path=bioformats.JARS, run_headless=True)
130
- _reduceLogging()
131
- atexit.register(_stopJavabridge)
132
- logger.info('Started JVM for Bioformats tile source.')
133
- _javabridgeStarted = True
134
- except RuntimeError:
135
- logger.exception('Cannot start JVM for Bioformats tile source.')
136
- _javabridgeStarted = False
138
+ # We need something to wake up at exit and shut things down
139
+ monitor = threading.Thread(target=_monitor_thread)
140
+ monitor.daemon = True
141
+ monitor.start()
142
+ try:
143
+ javabridge.start_vm(class_path=bioformats.JARS, run_headless=True)
144
+ _reduceLogging()
145
+ atexit.register(_stopJavabridge)
146
+ logger.info('Started JVM for Bioformats tile source.')
147
+ _javabridgeStarted = True
148
+ except RuntimeError:
149
+ logger.exception('Cannot start JVM for Bioformats tile source.')
150
+ _javabridgeStarted = False
137
151
  return _javabridgeStarted
138
152
 
139
153
 
@@ -145,6 +159,21 @@ def _stopJavabridge(*args, **kwargs):
145
159
  _javabridgeStarted = None
146
160
 
147
161
 
162
+ def _getBioformatsVersion():
163
+ """
164
+ Get the version of the jar file.
165
+
166
+ :returns: the version string if it is in the expected format, None
167
+ otherwise.
168
+ """
169
+ if _bioformatsVersion is None:
170
+ from large_image import config
171
+
172
+ logger = config.getLogger()
173
+ _startJavabridge(logger)
174
+ return _bioformatsVersion
175
+
176
+
148
177
  class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
149
178
  """
150
179
  Provides tile access to via Bioformats.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: large-image-source-bioformats
3
- Version: 1.26.3.dev14
3
+ Version: 1.26.3.dev24
4
4
  Summary: An bioformats tilesource for large_image.
5
5
  Home-page: https://github.com/girder/large_image
6
6
  Author: Kitware, Inc.
@@ -0,0 +1,5 @@
1
+ large-image>=1.26.3.dev24
2
+ python-bioformats>=1.5.2
3
+
4
+ [girder]
5
+ girder-large-image>=1.26.3.dev24
@@ -1,5 +0,0 @@
1
- large-image>=1.26.3.dev14
2
- python-bioformats>=1.5.2
3
-
4
- [girder]
5
- girder-large-image>=1.26.3.dev14