[ImageJ-devel] What do I need to add to my NetBeans ImgLib2 project to open a TIFF file

Michael Ellis michael.ellis at dsuk.biz
Fri Dec 5 06:07:17 CST 2014


I have followed the advice offered by Curtis regarding adding the io.scif: scifio dependency to my POM

The dependency part of my POM looks like this:

    <dependencies>
        <dependency>
            <groupId>net.imglib2</groupId>
            <artifactId>imglib2</artifactId>
            <version>2.2.1-SNAPSHOT</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>io.scif</groupId>
            <artifactId>scifio</artifactId>
            <version>0.17.1</version>
            <type>jar</type>
        </dependency>
    </dependencies>

I am using NetBeans IDE, configured for use with maven project (I am slo using Java 8 and JavaFX)

However when I attempt to Build (or Build with Dependencies)  within NetBeans, I get the following error message:
============================================================

cd /Users/michaelellis/Documents/Development/MavenImgLib2FX; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.app/Contents/Resources/NetBeans/java/maven/bin/mvn" install
Scanning for projects...
                                                                        
------------------------------------------------------------------------
Building MavenImgLib2FX 1.0-SNAPSHOT
------------------------------------------------------------------------
The POM for io.scif:scifio:jar:0.17.1 is missing, no dependency information available
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.341s
Finished at: Fri Dec 05 10:34:41 GMT 2014
Final Memory: 7M/245M
------------------------------------------------------------------------
Failed to execute goal on project MavenImgLib2FX: Could not resolve dependencies for project biz.dsuk:MavenImgLib2FX:jar:1.0-SNAPSHOT: Failure to find io.scif:scifio:jar:0.17.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

============================================================

If I open a terminal window and cd into the project directory and:

	mvn clean package

It succeeds.

However, when I then attempt to run the project with:

	java -cp MavenImgLib2FX-1.0-SNAPSHOT.jar biz.dsuk.mavenimglib2fx.MainApp

The application starts to execute but throws “No compatible service: io.scif.SCIFIOService” exception.
============================================================

img1=CellImg [20x30]
BufferedImage=BufferedImage at 3137c585: type = 10 ColorModel: #pixelBits = 8 numComponents = 1 color space = java.awt.color.ICC_ColorSpace at 134d9d5f transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 707 height = 699 #numDataElements 1 dataOff[0] = 0
Loading image...
Exception in Application start method
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:363)
	at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$150(LauncherImpl.java:157)
	at com.sun.javafx.application.LauncherImpl$$Lambda$50/553264065.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: No compatible service: io.scif.SCIFIOService
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:243)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
	at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:170)
	at org.scijava.Context.<init>(Context.java:244)
	at org.scijava.Context.<init>(Context.java:203)
	at org.scijava.Context.<init>(Context.java:142)
	at org.scijava.Context.<init>(Context.java:128)
	at io.scif.SCIFIO.<init>(SCIFIO.java:81)
	at biz.dsuk.mavenimglib2fx.MainApp.start(MainApp.java:38)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$156(LauncherImpl.java:821)
	at com.sun.javafx.application.LauncherImpl$$Lambda$53/681110827.run(Unknown Source)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$169(PlatformImpl.java:326)
	at com.sun.javafx.application.PlatformImpl$$Lambda$47/693632176.run(Unknown Source)
	at com.sun.javafx.application.PlatformImpl.lambda$null$167(PlatformImpl.java:295)
	at com.sun.javafx.application.PlatformImpl$$Lambda$49/1260282780.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$168(PlatformImpl.java:294)
	at com.sun.javafx.application.PlatformImpl$$Lambda$48/1364335809.run(Unknown Source)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Exception running application biz.dsuk.mavenimglib2fx.MainApp
============================================================

If I remove the calls to the SCIO code and build and run from the command line, all works well.

The SCIO source code that I am using is lifted/amended from one of the tutorials and is as follows:

============================================================
            imagePath = "8bit-signed&pixelType=int8&lengths=50,50,3,5,7&axes=X,Y,Z,Channel,Time.fake";
            System.out.println("Loading image... '" + imagePath + "'");
            SCIFIO scifio = new SCIFIO();
            final Reader reader = scifio.initializer().initializeReader(imagePath);
============================================================

This source code works file in the SCIFIO tutorial.

Any help gratefully appreciated!!!!!

— Michael Ellis




On 3 Dec 2014, at 19:31, Curtis Rueden <ctrueden at WISC.EDU> wrote:

> Hi Michael,
> 
> > How do I establish what Maven projects I need to include? 
> 
> One way to check is using the dependency-maven-plugin like so:
> 
>     mvn dependency:analyze
> 
> This will tell you:
> 
> A) Dependencies you declared but do not actually use; and
> B) Dependencies you did not declare directly, but actually need.
> 
> Note that this will only work if your project compiles successfully. In other words, it is easier to start with "too many" dependencies and pare down, rather than trying to "build up" from zero.
> 
> So in your case, you can start with the ImgLib2 Examples dependencies block, run dependency:analyze, and adjust the POM according to its recommendations.
> 
> > When I go to my NetBeans project dependence, select Add dependency,
> > then type SCIF to the query text box, I get a huge list of
> > possibilities.
> 
> The dependency you probably want is io.scif:scifio (i.e.: a groupId of io.scif, and an artifactId of scifio). Presumably at the latest version. You can search for that here:
> 
>    http://maven.imagej.net/index.html#nexus-search;gav~io.scif~scifio~~~
> 
> So your dependency block in this case would be:
> 
>     <dependency>
>       <groupId>io.scif</groupId>
>       <artifactId>scifio</artifactId>
>       <version>0.17.1</version>
>     </dependency>
> 
> Note that that block of XML is available for copy-pasting from the link above.
> 
> > I am completely new to maven
> 
> For more information, see:
>     http://imagej.net/Maven
> 
> Regards,
> Curtis
> 
> On Tue, Dec 2, 2014 at 6:05 PM, Michael Ellis <michael.ellis at dsuk.biz> wrote:
> I am investigating the using ImgLib2 for a project.
> 
> I am using NetBeans and have managed to create a NetBeans Mavern project and have  added a dependency for ImgLib2 Core Library and that seems to be working OK.
> 
> I now want to add the least possible requirements for the purpose of opening some image files.
> 
> How do I establish what Maven projects I need to include? 
> 
> I have cloned  the ImgLib2 Examples project and got that working but that seems to include all manner of things that I suspect I do not need.
> 
> When I go to my NetBeans project dependence, select Add dependency, then type SCIF to the query text box, I get a huge list of possibilities.
> 
> I am completely new to maven and so do not know what I am doing with it!
> 
> — Michael Ellis
> Digital Scientific UK Ltd.
> 
> 
> 
> 
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20141205/ca8e5fb4/attachment-0001.html>


More information about the ImageJ-devel mailing list