Skip to content

Commit b157aae

Browse files
author
Lee Kamentsky
committed
The demo takes an optional image name on the command line and displays the image using pylab if it's installed
1 parent 67133c7 commit b157aae

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

demo/demo.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,26 @@
44
import javabridge
55
import bioformats
66
from bioformats import log4j
7+
import sys
78

89
javabridge.start_vm(class_path=bioformats.JARS,
910
run_headless=True)
1011
try:
1112
log4j.basic_config()
12-
image_path = os.path.join(os.path.dirname(bioformats.__file__), 'tests',
13-
'Channel1-01-A-01.tif')
13+
if len(sys.argv) < 2:
14+
image_path = os.path.join(os.path.dirname(bioformats.__file__), 'tests',
15+
'Channel1-01-A-01.tif')
16+
else:
17+
image_path = sys.argv[1]
1418
image, scale = bioformats.load_image(image_path, rescale=False,
1519
wants_max_intensity=True)
16-
print image.shape
20+
try:
21+
import pylab
22+
23+
pylab.imshow(image)
24+
pylab.gca().set_title(image_path)
25+
pylab.show()
26+
except:
27+
print image.shape
1728
finally:
1829
javabridge.kill_vm()

0 commit comments

Comments
 (0)