ClearVolume / imglib2-clearvolume

11 stars 3 forks source link

ClearVolume + MATLAB #14

Open ctrueden opened 6 years ago

ctrueden commented 6 years ago

From Andres Barragan via the ImageJ mailing list:

ClearVolume appears now in the plugins but I am getting an exception. Any ideas? For some reason I do not get this exception when simply running the executable of ImageJ.

(Fiji Is Just) ImageJ 2.0.0-rc-68/1.52e; Java 1.8.0_144 [64-bit]; Windows 10 10.0; 320MB of 1910MB (16%)

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
  at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:303)
  at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:163)
  at ij.IJ.runPlugIn(IJ.java)
  at ij.Executer.runCommand(Executer.java:137)
  at ij.Executer.run(Executer.java:66)
  at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
  at java.util.concurrent.FutureTask.report(FutureTask.java:122)
  at java.util.concurrent.FutureTask.get(FutureTask.java:192)
  at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:299)
  ... 5 more
Caused by: java.lang.NullPointerException
  at de.mpicbg.jug.clearvolume.ImgLib2ClearVolume.initClearVolumeUnsignedShortArrayImg(ImgLib2ClearVolume.java:284)
  at de.mpicbg.jug.clearvolume.ImgLib2ClearVolume.initRealImgs(ImgLib2ClearVolume.java:511)
  at de.mpicbg.jug.clearvolume.gui.ClearVolumeManager.run(ClearVolumeManager.java:182)
  at de.mpicbg.jug.clearvolume.gui.GenericClearVolumeGui.launchClearVolumeManager(GenericClearVolumeGui.java:306)
  at de.mpicbg.jug.clearvolume.gui.GenericClearVolumeGui.<init>(GenericClearVolumeGui.java:163)
  at de.mpicbg.jug.plugins.ClearVolumePlugin.run(ClearVolumePlugin.java:90)
  at org.scijava.command.CommandModule.run(CommandModule.java:199)
  at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
  at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
  at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
  at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  ... 1 more

I investigated a little, and based on the relevant code, I guess that ClearVolumeRendererFactory.newBestRenderer and/or ClearVolumeRendererFactory.newOpenCLRenderer must be returning null. But more investigation required to discern why that would be the case from a MATLAB environment.

royerloic commented 6 years ago

You should be using the main branch (master) instead of a deprecated branch (your link points to very very old code...)

ctrueden commented 6 years ago

(your link points to very very old code...)

Dude, it is the latest tag. And the last commit to touch that source file is the same on master still. I never post links to master because it will change out from under you over time, invalidating the link.

royerloic commented 6 years ago

Oh I see, I saw some cuda flags and assumed it was very old code. I would test in FiJi first and see how it goes, my guess is that there is a GPU, GPU driver problem, or the native libs of JOCL are missing...

ctrueden commented 6 years ago

I am guessing this is a MATLAB-specific issue; from the original thread, it sounds like the plugin works when launched from Fiji normally.

I was thinking it might be some subtle thing with MATLAB's JRE, but upon reflection, perhaps it is as simple as the JARs from the jars/<platform> folder not being added to MATLAB's classpath.

I do not have time to test it, but Andreas, if you are reading this: you could try:

javaaddpath 'C:\Users\andreas\Fiji.app\jars\win64'

Where C:\Uesrs\andreas\Fiji.app is the location of your Fiji installation.

And see if that makes a difference. See the javaaddpath documentation for details.

mynameisandres commented 6 years ago

ctrueden, I attempted your solution.

I did

javaaddpath 'C:\Users\Swag\Documents\4D-SoftwareChet\ae4d-master\Fiji.app\jars\win64'

My MatLab Execution is attached and so is the ImageJ execution error. MATLAB.txt ImageJ.txt

mynameisandres commented 6 years ago

I attempted a clean installation of Fiji, the newest version available. Opened my MatLab version that is running: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

Added to my path

'C:\Users\Swag\Documents\4D-SoftwareChet\ae4d-master\Fiji.app\scripts'

Than by suggestion from ctrueden did

'javaaddpath 'C:\Users\Swag\Documents\4D-SoftwareChet\ae4d-master\Fiji.app\jars\win64'

Getting the same error as mentioned before. It is possible that clearVolume does not work with Imagej-MatLab