[ImageJ-devel] jython scripting, No compatible service: io.scif.SCIFIOService

Harri Jäälinoja harri.jaalinoja at helsinki.fi
Mon Feb 24 04:34:12 CST 2014


Hi again,

here's my second try: I made a pom.xml (attached) and retrieved 
dependency jar files with:

mvn dependency:copy-dependencies


But I still get the same error as before:

CP=`find /home/hajaalin/Software/mvn-IJ2/target/dependency -name '*.jar' 
|sed ':a;N;$!ba;s/\n/:/g'`
jython -Dpython.path=$CP 
/home/hajaalin/Software/fiji-20140219/Fiji.app/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 
"/home/hajaalin/Software/fiji-20140219/Fiji.app/macros/imglib0.py", line 
16, in <module>
     io = ImgOpener()
     at 
org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:218)
...
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: 
No compatible service: io.scif.SCIFIOService


Now it's maybe only a matter of getting the versions for pom-scijava and 
ij-app right. How can I find out which version to use?

Thanks,
Harri


On 21/02/14 13:25, Harri Jäälinoja wrote:
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pom.xml
Type: text/xml
Size: 940 bytes
Desc: not available
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20140224/d7831e01/attachment.xml>


More information about the ImageJ-devel mailing list