large-image-source-bioformats 1.26.3__tar.gz → 1.26.3.dev4__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.
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/PKG-INFO +1 -1
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats/__init__.py +24 -53
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats.egg-info/PKG-INFO +1 -1
- large-image-source-bioformats-1.26.3.dev4/large_image_source_bioformats.egg-info/requires.txt +5 -0
- large-image-source-bioformats-1.26.3/large_image_source_bioformats.egg-info/requires.txt +0 -5
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/LICENSE +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/README.rst +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats/girder_source.py +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats.egg-info/SOURCES.txt +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats.egg-info/dependency_links.txt +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats.egg-info/entry_points.txt +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/large_image_source_bioformats.egg-info/top_level.txt +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/pyproject.toml +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/setup.cfg +0 -0
- {large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/setup.py +0 -0
|
@@ -26,12 +26,10 @@ import atexit
|
|
|
26
26
|
import logging
|
|
27
27
|
import math
|
|
28
28
|
import os
|
|
29
|
-
import pathlib
|
|
30
29
|
import re
|
|
31
30
|
import threading
|
|
32
31
|
import types
|
|
33
32
|
import weakref
|
|
34
|
-
import zipfile
|
|
35
33
|
from importlib.metadata import PackageNotFoundError
|
|
36
34
|
from importlib.metadata import version as _importlib_version
|
|
37
35
|
|
|
@@ -55,8 +53,6 @@ bioformats = None
|
|
|
55
53
|
javabridge = None
|
|
56
54
|
|
|
57
55
|
_javabridgeStarted = None
|
|
58
|
-
_javabridgeStartLock = threading.Lock()
|
|
59
|
-
_bioformatsVersion = None
|
|
60
56
|
_openImages = []
|
|
61
57
|
|
|
62
58
|
|
|
@@ -91,7 +87,7 @@ def _monitor_thread():
|
|
|
91
87
|
|
|
92
88
|
|
|
93
89
|
def _reduceLogging():
|
|
94
|
-
# As of
|
|
90
|
+
# As of bioformat 4.0.0, org.apache.log4j isn't in the bundled
|
|
95
91
|
# jar file, so setting log levels just produces needless warnings.
|
|
96
92
|
# bioformats.log4j.basic_config()
|
|
97
93
|
# javabridge.JClassWrapper('loci.common.Log4jTools').setRootLevel(
|
|
@@ -114,40 +110,30 @@ def _reduceLogging():
|
|
|
114
110
|
|
|
115
111
|
|
|
116
112
|
def _startJavabridge(logger):
|
|
117
|
-
global _javabridgeStarted
|
|
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
|
|
113
|
+
global _javabridgeStarted
|
|
137
114
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
|
151
137
|
return _javabridgeStarted
|
|
152
138
|
|
|
153
139
|
|
|
@@ -159,21 +145,6 @@ def _stopJavabridge(*args, **kwargs):
|
|
|
159
145
|
_javabridgeStarted = None
|
|
160
146
|
|
|
161
147
|
|
|
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
|
-
|
|
177
148
|
class BioformatsFileTileSource(FileTileSource, metaclass=LruCacheMetaclass):
|
|
178
149
|
"""
|
|
179
150
|
Provides tile access to via Bioformats.
|
|
File without changes
|
{large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/README.rst
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/pyproject.toml
RENAMED
|
File without changes
|
{large-image-source-bioformats-1.26.3 → large-image-source-bioformats-1.26.3.dev4}/setup.cfg
RENAMED
|
File without changes
|
|
File without changes
|