Skip to content

Commit a1cac35

Browse files
committed
Use the class_path keyword argument to start_vm.
See CellProfiler/python-javabridge@0977f26
1 parent 9b4bc16 commit a1cac35

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

bioformats/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020
from . import formatwriter as _formatwriter
2121

2222
_jars_dir = os.path.join(os.path.dirname(__file__), 'jars')
23+
2324
JARS = javabridge.JARS + [os.path.realpath(os.path.join(_jars_dir, name + '.jar'))
2425
for name in ['loci_tools']]
26+
"""List of directories, jar files, and zip files that should be added
27+
to the Java virtual machine's class path."""
2528

2629
# See http://www.loci.wisc.edu/software/bio-formats
2730
READABLE_FORMATS = ('al3d', 'am', 'amiramesh', 'apl', 'arf', 'avi', 'bmp',

demo/demo.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
import bioformats
66
from bioformats import log4j
77

8-
class_path = os.pathsep.join(bioformats.JARS + javabridge.JARS)
9-
javabridge.start_vm(['-Djava.class.path=' + class_path],
8+
javabridge.start_vm(class_path=bioformats.JARS,
109
run_headless=True)
1110
try:
1211
log4j.basic_config()
1312
image_path = os.path.join(os.path.dirname(bioformats.__file__), 'tests',
1413
'Channel1-01-A-01.tif')
15-
image, scale = bioformats.load_using_bioformats(image_path, rescale=False,
16-
wants_max_intensity=True)
14+
image, scale = bioformats.load_image(image_path, rescale=False,
15+
wants_max_intensity=True)
1716
print image.shape
1817
finally:
1918
javabridge.kill_vm()

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,4 @@
249249

250250

251251
# Example configuration for intersphinx: refer to the Python standard library.
252-
intersphinx_mapping = {'http://docs.python.org/': None}
252+
intersphinx_mapping = {'javabridge': ('http://pythonhosted.org/javabridge/', None)}

docs/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ Running the unit tests requires Nose.
3737
python setup.py nosetests
3838

3939

40+
Starting the JVM
41+
================
42+
43+
When starting the Java virtual machine with python-javabridge's
44+
:py:func:`javabridge.start_vm`, you must add the contents of
45+
:py:data:`bioformats.JARS` to the class path. Example:
46+
47+
>>> import javabridge
48+
>>> import bioformats
49+
>>> javabridge.start_vm(class_path=bioformats.JARS)
50+
51+
.. autodata:: bioformats.JARS
52+
:annotation: list of strings
53+
54+
4055
Reading images
4156
==============
4257

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
it. Python-bioformats was developed for and is used by the cell
1414
image analysis software CellProfiler (cellprofiler.org).''',
1515
url="http://github.com/CellProfiler/python-bioformats/",
16+
bugtrack_url="http://github.com/CellProfiler/python-bioformats/issues",
1617
packages=['bioformats'],
1718
classifiers=['Development Status :: 5 - Production/Stable',
1819
'License :: OSI Approved :: BSD License',
@@ -22,7 +23,7 @@
2223
],
2324
license='BSD License',
2425
package_data={'bioformats': ['jars/*.jar']},
25-
26+
install_requires=['javabridge>=1.0'],
2627
tests_require='nose',
2728
entry_points={'nose.plugins.0.10': [
2829
'javabridge = javabridge.noseplugin:JavabridgePlugin',

0 commit comments

Comments
 (0)