[ImageJ-devel] jython scripting, No compatible service: io.scif.SCIFIOService
Harri Jäälinoja
harri.jaalinoja at helsinki.fi
Fri Feb 21 05:25:14 CST 2014
Hi,
I started to learn about ImgLib2 for the purpose of creating scripts I
can run headlessly. I would like to use jython since I already used that
with ImageJ1. First I downloaded a recent Fiji version. My idea was that
this would be the easiest way to get the dependencies (scifio, imglib2
etc.) right.
mkdir fiji-20140219
cd fiji-20140219/
wget
http://jenkins.imagej.net/job/Stable-Fiji/lastSuccessfulBuild/artifact/fiji-linux64.tar.gz
tar xf fiji-linux64.tar.gz
Then I just put all the jar files in the Fiji distribution in one long
variable and gave that as the classpath for Jython
CP=`find /home/hajaalin/Software/fiji-20140219/Fiji.app/jars -name
'*.jar' |sed ':a;N;$!ba;s/\n/:/g'`
Here's my test script:
----- imglib0.py ------
import sys
#from io.scif.config import SCIFIOConfig
from io.scif.config import *
from io.scif.img import ImgIOException,ImgOpener
from java.io import File
from net.imglib2.img import Img
from net.imglib2.img.display.imagej import ImageJFunctions
from net.imglib2.type import NativeType
from net.imglib2.type.numeric import RealType
filename = sys.argv[1]
io = ImgOpener()
config = SCIFIOConfig()
config.imgOpenerSetImgModes( SCIFIOConfig.ImgMode.CELL )
img = io.openImg(filename)
ImageJFunctions.show( img )
---------------------------
When I run it, I get an error I've seen on the list before:
hajaalin at biotek973:~/Software/fiji-20140219/Fiji.app$ jython
-Dpython.path=$CP macros/imglib0.py
/home/hajaalin/Data/Misha/composite1.ome.tif
[WARNING] Class pool is empty: forgot to call Thread#setClassLoader?
Traceback (most recent call last):
File "macros/imglib0.py", line 16, in <module>
io = ImgOpener()
at
org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:218)
at
org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:172)
at
org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:149)
at org.scijava.Context.<init>(Context.java:179)
at org.scijava.Context.<init>(Context.java:121)
at org.scijava.Context.<init>(Context.java:109)
at
io.scif.img.AbstractImgIOComponent.<init>(AbstractImgIOComponent.java:59)
at io.scif.img.ImgOpener.<init>(ImgOpener.java:94)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:163)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException:
No compatible service: io.scif.SCIFIOService
If I try to run the script via Fiji, I don't get even that far:
hajaalin at biotek973:~/Software/fiji-20140219/Fiji.app$ ./ImageJ-linux64
macros/imglib0.py /home/hajaalin/Data/Misha/composite1.ome.tif
Traceback (most recent call last):
File "macros/imglib0.py", line 4, in <module>
from io.scif.config import *
ImportError: No module named io
So now my questions are:
1. Is there a better way to get all the dependency jars?
2. Is there something wrong with my general setup (jython + script +
required jars)?
Thanks, best regards,
Harri
--
__________________________________________________
Harri Jäälinoja
Light Microscopy Unit
Institute of Biotechnology, University of Helsinki
http://www.biocenter.helsinki.fi/bi/lmu/
+358 9 191 59370 fax +358 9 191 59366
More information about the ImageJ-devel
mailing list