Giter Site home page Giter Site logo

imagej / imagej-matlab Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 6.0 147 KB

MATLAB integration with ImageJ data structures and runtime.

Home Page: https://imagej.net/scripting/matlab

License: BSD 2-Clause "Simplified" License

Java 91.50% MATLAB 8.25% M 0.26%

imagej-matlab's Introduction

ImageJ

ImageJ is public domain software for processing and analyzing scientific images.

It is written in Java, which allows it to run on many different platforms.

For further information, see:

Using ImageJ as a dependency

To use ImageJ as a library in your Maven project, add the dependency:

<dependency>
  <groupId>net.imagej</groupId>
  <artifactId>ij</artifactId>
  <version>1.53j</version>
</dependency>

Where 1.53j is the version of ImageJ you would like to use:

Building from source

With Ant

The Apache Ant utility will compile and run ImageJ using the build.xml file in this directory. There is a version of Ant at

https://imagej.nih.gov/ij/download/tools/ant/ant.zip

set up to use the JVM distributed with the Windows version of ImageJ. The README included in the ZIP archive has more information.

With Maven

You can compile and run ImageJ using the Maven build tool:

Command Action
mvn Compile and package ImageJ into a JAR file in the target directory.
mvn -Pexec Compile and then run ImageJ.
mvn javadoc:javadoc Generate the project Javadoc in the target/apidocs directory.

imagej-matlab's People

Contributors

bastelflp avatar ctrueden avatar hinerm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imagej-matlab's Issues

Decode array output

Currently MATLAB numeric arrays get translated to 1-D arrays always. We should wrap them in something, like an ArrayImg or custom RandomAccessibleInterval, so they display with proper dimensionality

ImageJ.m without opening imagej does not work

>> ImageJ(false);
No method 'start' with matching signature found for class 'net.imagej.matlab.ImageJMATLAB'.

Error in ImageJ (line 45)
        ImageJMATLAB.start('--headless');

I believe the line should be

ImageJMATLAB.start(verbose,'--headless');

Failed using ImageJ-Matlab to start ImageJ in headless mode

Hi, I am using ImageJ-Matlab to start ImageJ2 from matlab by the matlab code

open_imageJ = false; % = true works and shows a Fiji panel, but false does not work
ImageJ(open_imageJ)

The non-headless mode runs OK when open_imageJ = true. .Although it shows a message box saying “cannot find java script engine”, the Fiji panel shows afterwards.

But if change open_imageJ to false, it shows the error after the same message box was shown :

[ERROR] Cannot create plugin: org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage

Error using ImageJ2 (line 99)
Java exception occurred:
java.lang.NullPointerException

	at net.imagej.matlab.ImageJMATLAB.disableIJExit(ImageJMATLAB.java:247)

	at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:156)

	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
 
log4j:WARN No appenders could be found for logger (loci.formats.ClassList).
log4j:WARN Please initialize the log4j system properly.

Handling of a multi-dimensional image by IJM.show()

Following discussion in here, I'd like to raise an issue aboutIJM.show().

IJM.show('I') or net.imagej.matlab.ImageJMATLABCommands.show('I') is a great way to transfer array data from MATLAB workspace to ImageJ, thanks to ImageJ-MATLAB.

However, I’ve noticed that this method does not really support multi-dimensional or multi-channel images well. Whatever the dimensions are, all the channels are always treated as a stack of single-channel images.

It would be much nicer if one specifies a rule about which dimension of input MATLAB array represent what (X, Y, Z, channel, time etc) and IJM.show() handle it internally to prepare an appropriate object in ImageJ.

This issue is also related, but more specifically about X and Y axes.

#16

Cannot run ImageJ.m from MATLAB with Java 1.8

About two months ago, I was able to run ImageJ.m successfully on MATLAB R2017b. Now I cannot do the same on R2018a. I've seen this issue reported here, but because the JAVA version is already 1.8, the same solution would not work for me.

 >> javaclasspath

		DYNAMIC JAVA PATH
        ...
	D:\Fiji.app\jars\imagej-matlab-0.7.2.jar                                 
        ...
	D:\Fiji.app\jars\scripting-matlab-0.5.1.jar                              
        ...


>> version -java
ans =
    'Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode'


>> ImageJ
Undefined variable "ImageJMATLAB" or class "ImageJMATLAB.start".
Error in ImageJ (line 42)
        ImageJMATLAB.start(); 
42          ImageJMATLAB.start();

When I look at the source code of ImageJ.m , I found an alarming comment.

    %% Maybe open the ImageJ window
    import net.imagej.matlab.*;
    if open_imagej
        ImageJMATLAB.start();
    else
        % initialize ImageJ with the headless flag
        ImageJMATLAB.start('--headless');
    end

    % Make sure that the scripts are found.
    % Unfortunately, this causes a nasty bug with MATLAB: calling this
    % static method modifies the static MATLAB java path, which is
    % normally forbidden. The consequences of that are nasty: adding a
    % class to the dynamic class path can be refused, because it would be
    % falsy recorded in the static path. On top of that, the static
    % path is fsck in a weird way, with file separator from Unix, causing a
    % mess on Windows platform.
    % So we give it up as now.
    % %    imagej.User_Plugins.installScripts();

What does this mean? ImageJ.m won't work now? Or am I doing something wrong?

When should MATLAB variables be cleared?

Currently, we never explicitly clear MATLAB workspace variables before executing a script. This could lead to stale variables interfering with script execution.

I think we should probably never clear variables when running from within MATLAB, as MATLAB is the host environment and ImageJ.

When running from within ImageJ and calling MATLAB remotely, I think we may not want to clear variables if the UI is visible (as the user may want to inspect and modify things manually in this case). If the UI is hidden, I think there is a valid argument for wanting to clear the workspace.

That said, I do think clearing the workspace is putting a burden on the user to design a single script that "does everything" - the expectation being that MATLAB acts like a fully functional language. Until ImageJ-MATLAB can handle both script and function paradigms I think we may just want to accept that there are side-effects.

Multiple #@matrix parameters not supported

In a Matlab script started from ImageJ's script editor, a single #@matrix parameter works as expected and takes the current active image from ImageJ.

In analogy to #@ Dataset, I'd expect to get dropdown choice widgets for my parameters if I have more than one of them:

#@ matrix input1
#@ matrix input2

Instead, this show an error that a MatlabNumericArray is required but none is available.


While MATLABNumericArrayPreprocessor (extends SingleInputPreprocessor) deals with the former case, the latter currently doesn't work presumably because there is no direct conversion support for ImagePlus -> MatlabNumericArray.

We could add support for all the common image-type objects (e.g. ImagePlus, Img, Dataset) by chained conversion using a delegate converter, but is this repository the right place to e.g. also contain the legacy ij.ImagePlus <-> matlabcontrol.extensions.MatlabNumericArray? @ctrueden?


As an aside: the #@matrix script parameter alias is added in scripting-matlab by DefaultMATLABService

Should the MATLAB GUI be displayed by default?

It needs to be decided whether or not the MATLAB GUI is displayed by default.

On one hand, if the GUI isn't displayed then any state is lost after the MATLAB script ends. So if something does not return as intended there is no way to go back and play with the intermediate outputs of a script.

On the other hand, displaying the GUI takes extra time.

A user can always toggle this via the MATLABOptions but may not know this configuration is available.

A potential compromise might be to treat Options classes kind of like Apps, so the first time you run when you have a new set of options to configure it automatically launches to let the user know what's available.

Starting ImageJ from Matlab: Java Swing Look and Feel service error

Hello all,
I am facing a problem in launching ImageJ from Matlab using IJM. I am getting the following errors on invoking ImageJ with window pop up as false and true respctively.

addpath('/home/wolfgang/Downloads/fiji-linux64/Fiji.app/scripts/');
javaaddpath('/home/wolfgang/Downloads/fiji-linux64/Fiji.app/jars/ij-1.53t.jar');
ImageJ(false);
Error using ImageJ
Java exception occurred:
java.lang.NullPointerException
at net.imagej.matlab.ImageJMATLAB.disableIJExit(ImageJMATLAB.java:247)
at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:156)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)

ImageJ(true);
Error using ImageJ
Java exception occurred:
java.lang.IllegalArgumentException: Invalid look and feel:
at org.scijava.ui.swing.laf.SwingLookAndFeelService.setLookAndFeel(SwingLookAndFeelService.java:124)
at org.scijava.ui.swing.laf.SwingLookAndFeelService.initLookAndFeel(SwingLookAndFeelService.java:85)
at net.imagej.legacy.IJ1Helper.setVisible(IJ1Helper.java:324)
at net.imagej.legacy.ui.LegacyUI.show(LegacyUI.java:132)
at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:166)
at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:151)
at org.scijava.AbstractGateway.launch(AbstractGateway.java:110)
at net.imagej.Main.launch(Main.java:47)
at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at javax.swing.SwingUtilities.loadSystemClass(SwingUtilities.java:1879)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:582)
at org.scijava.ui.swing.laf.SwingLookAndFeelService.setLookAndFeel(SwingLookAndFeelService.java:118)
... 10 more

I updated the ImageJ plugins URLs. I also referenced matlab and ImageJ to same java versions (1.8.0_202 and 1.8.0_322). I’m using Matlab version 2022b and ImageJ 1.53t on Ubuntu 22.04.1 LTS.

Any kind of help in fixing this is really appreciated. Please let me know if you need any further information.

Thanks!

Add an exit/shutdown method

There should be a way to shut down the context from IJM. I'm not sure if it should actually be in the IJM object or if there should be a more universal method (e.g. static method?) since the IJM instance itself is intended to be just one plugin in a collection of utilities..

Handling of X and Y axes of an image by IJM.show()

Following discussion in here, I'd like to raise an issue about IJM.show().

IJM.show('I') or net.imagej.matlab.ImageJMATLABCommands.show('I') is a great way to transfer array data from MATLAB workspace to ImageJ, thanks to ImageJ-MATLAB.

However, I’ve noticed that X and Y of axes of images are flipped over between MATLAB and ImageJ, which is not smart at all.

MATLAB's permute can manipulate data to avoid this problem. But, because it apparently needs to copy data internally, it requires double memory, which is not ideal. An imglib2 /ImageJ2 -style permute (which re-indexes but does not copy) might be a better solution.

This issue is also related, but more specifically about multidimensional images.

#17

Octave compatibility with ImageJ-Matlab

Hi, I made some progress getting ImageJ-Matlab to run in Octave, and my version now opens in Octave...

The one problem is, when ImageJ is launched in Octave, it then launches its own instance of Matlab! (I have both programs). Can anyone advise where this launch of Matlab might be coming from, and if so I can take a look and see if this can be made compatible with being called from an Octave instance? Thanks!

FIJI from MATLAB (2013a) - Close Result Window on Exit

Hi, great tool! When I finished image processing and return all data I need to MATLAB, I say (in MATLAB) MIJ.run('Clear Results'); MIJ.run('Close All'); MIJ.exit
This leaves the Result Window open and requires to restart MATLAB to get rid of it. Is there any trick to close the results window? I run batches and these windows accumulate...
Thanks!

MATLAB window closes on quit

When exiting Fiji, the MATLAB window closes too (although it doesn't System.exit). You can still press cmd+Q to terminate. It would be nice to just close Fiji and to be able to re-launch via the Miji command later.

Current head won't build

Hi, I'd like to work on a clone of this code to try to resolve some issues. It fails to run for one reason or another on R2014a (on Windows in my desktop) and R2015a and R2016b (on my laptop) and also Gnu Octave 4.3. The reasons are different for each. I am happy to contribute. Unfortunately the current head does not build. I get the error:

[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-rules) @ imagej-matlab ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.131 s
[INFO] Finished at: 2017-02-22T15:44:01+01:00
[INFO] Final Memory: 22M/602M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-rules) on project imagej-matlab: Execution enforce-rules of goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce failed: For artifact {null:null:null:jar}: The groupId cannot be empty. -> [Help 1]

I even purged the gov branch of my maven repo to ensure it wasn't (I don't think) on my end. Is anyone else getting this error. If so, could anyone please tell me the last commit of the code that builds successfully, and I will start from there. Thank you.

Cannot run ImageJ.m from MATLAB.

One cannot run ImageJ.m from MATLAB, after following the installation instructions. The following command

>> ImageJ

yields

Undefined function 'start' for input arguments of type 'net.imagej.matlab.ImageJMATLAB'.

Error in ImageJ (line 42)
        ImageJMATLAB.start();

Tested with MATLAB R2016a and R2016b, on Windows 10 and on MacOSX El Capitan.

ImageJ cannot load the scripts

Hi

When launching ImageJ from MATLAB I get the errors bellow telling me that some scripts cannot be loaded. However I checked the paths and the files are there.
Tjh IJM and MIJ objects are created though and they work.

I have the following setup:
OsX sierra
Java 1.8.0_40-b25 (as mentioned in the wiki)
MATLAB 2016b

>> ImageJ
[ERROR] Cannot create plugin: class='org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage', name='JavaScript', priority=0.0, enabled=true, pluginType=ScriptLanguage
java.lang.IllegalArgumentException: No such script engine: javascript
	at org.scijava.script.AdaptedScriptLanguage.findFactory(AdaptedScriptLanguage.java:151)
	at org.scijava.script.AdaptedScriptLanguage.<init>(AdaptedScriptLanguage.java:73)
	at org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage.<init>(JavaScriptScriptLanguage.java:59)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at java.lang.Class.newInstance(Class.java:442)
	at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:304)
	at org.scijava.plugin.DefaultPluginService.createInstance(DefaultPluginService.java:236)
	at org.scijava.plugin.DefaultPluginService.createInstances(DefaultPluginService.java:225)
	at org.scijava.plugin.DefaultPluginService.createInstancesOfType(DefaultPluginService.java:216)
	at org.scijava.plugin.AbstractSingletonService.initInstances(AbstractSingletonService.java:92)
	at org.scijava.plugin.AbstractSingletonService.getInstances(AbstractSingletonService.java:75)
	at org.scijava.script.DefaultScriptService.initScriptLanguageIndex(DefaultScriptService.java:273)
	at org.scijava.script.DefaultScriptService.scriptLanguageIndex(DefaultScriptService.java:238)
	at org.scijava.script.DefaultScriptService.getIndex(DefaultScriptService.java:118)
	at org.scijava.script.ScriptService.canHandleFile(ScriptService.java:314)
	at org.scijava.script.ScriptFinder.createInfos(ScriptFinder.java:165)
	at org.scijava.script.ScriptFinder.scanResources(ScriptFinder.java:133)
	at org.scijava.script.ScriptFinder.findScripts(ScriptFinder.java:109)
	at org.scijava.script.DefaultScriptService.initScripts(DefaultScriptService.java:314)
	at org.scijava.script.DefaultScriptService.scripts(DefaultScriptService.java:256)
	at org.scijava.script.DefaultScriptService.getScripts(DefaultScriptService.java:153)
	at net.imagej.legacy.LegacyService.getScriptsAndNonLegacyCommands(LegacyService.java:628)
	at net.imagej.legacy.IJ1Helper.addMenuItems(IJ1Helper.java:744)
	at net.imagej.legacy.LegacyService.initialize(LegacyService.java:488)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:353)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
	at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
	at org.scijava.Context.<init>(Context.java:278)
	at org.scijava.Context.<init>(Context.java:234)
	at org.scijava.Context.<init>(Context.java:174)
	at org.scijava.Context.<init>(Context.java:160)
	at net.imagej.ImageJ.<init>(ImageJ.java:77)
	at net.imagej.Main.launch(Main.java:61)
	at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:81)
[ERROR] Invalid script URL: file:/Users/turf/Applications/Fiji.app/plugins/Scripts/File/Open_Samples/Comparing_Lengths.ijm
java.io.FileNotFoundException: /Users/turf/Applications/Fiji.app/plugins/Scripts/File/Open_Samples/Comparing_Lengths.ijm (Too many open files)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
	at java.net.URL.openStream(URL.java:1038)
	at org.scijava.script.ScriptInfo.<init>(ScriptInfo.java:139)
	at org.scijava.script.ScriptFinder.createInfos(ScriptFinder.java:193)
	at org.scijava.script.ScriptFinder.scanDirectory(ScriptFinder.java:152)
	at org.scijava.script.ScriptFinder.findScripts(ScriptFinder.java:115)
	at org.scijava.script.DefaultScriptService.initScripts(DefaultScriptService.java:314)
	at org.scijava.script.DefaultScriptService.scripts(DefaultScriptService.java:256)
	at org.scijava.script.DefaultScriptService.getScripts(DefaultScriptService.java:153)
	at net.imagej.legacy.LegacyService.getScriptsAndNonLegacyCommands(LegacyService.java:628)
	at net.imagej.legacy.IJ1Helper.addMenuItems(IJ1Helper.java:744)
	at net.imagej.legacy.LegacyService.initialize(LegacyService.java:488)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:353)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
	at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
	at org.scijava.Context.<init>(Context.java:278)
	at org.scijava.Context.<init>(Context.java:234)
	at org.scijava.Context.<init>(Context.java:174)
	at org.scijava.Context.<init>(Context.java:160)
	at net.imagej.ImageJ.<init>(ImageJ.java:77)
	at net.imagej.Main.launch(Main.java:61)
	at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:81)
[ERROR] Invalid script URL: file:/Users/turf/Applications/Fiji.app/plugins/Scripts/Image/Color/Set_Color_By_Wavelength.ijm
java.io.FileNotFoundException: /Users/turf/Applications/Fiji.app/plugins/Scripts/Image/Color/Set_Color_By_Wavelength.ijm (Too many open files)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
	at java.net.URL.openStream(URL.java:1038)
	at org.scijava.script.ScriptInfo.<init>(ScriptInfo.java:139)
	at org.scijava.script.ScriptFinder.createInfos(ScriptFinder.java:193)
	at org.scijava.script.ScriptFinder.scanDirectory(ScriptFinder.java:152)
	at org.scijava.script.ScriptFinder.findScripts(ScriptFinder.java:115)
	at org.scijava.script.DefaultScriptService.initScripts(DefaultScriptService.java:314)
	at org.scijava.script.DefaultScriptService.scripts(DefaultScriptService.java:256)
	at org.scijava.script.DefaultScriptService.getScripts(DefaultScriptService.java:153)
	at net.imagej.legacy.LegacyService.getScriptsAndNonLegacyCommands(LegacyService.java:628)
	at net.imagej.legacy.IJ1Helper.addMenuItems(IJ1Helper.java:744)
	at net.imagej.legacy.LegacyService.initialize(LegacyService.java:488)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:353)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
	at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
	at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
	at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
	at org.scijava.Context.<init>(Context.java:278)
	at org.scijava.Context.<init>(Context.java:234)
	at org.scijava.Context.<init>(Context.java:174)
	at org.scijava.Context.<init>(Context.java:160)
	at net.imagej.ImageJ.<init>(ImageJ.java:77)
	at net.imagej.Main.launch(Main.java:61)
	at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
	at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:81)

Limited IJM commands

Greetings, I am trying to run ImageJ/Fiji JavaScripts from within MATLAB. It seems that the transition to Java 8 is a rocky road. I was able to follow all the helpful instructions to get ImageJ running within MATLAB. But I'd prefer to have the custom JavaScript scripts or even stock Fiji scripts run without interfacing with the ImageJ GUI and that is where I am running into problems. When I list the available commands using IJM.help, I only see 4 commands. Does this mean that even built-in Fiji plugins are not able to be executed via ImageJ running in MATLAB?

Below is what the startup looks like. I get the reported "log4j" and "No such script engine: javascript." I suspect the latter is one of the reasons that I am having issues.

I am running Java 8, MATLAB2017a, and the latest Fiji installation. Any insight is very much appreciated.

ImageJ
java.lang.IllegalArgumentException: Cannot handle app name in ij.gui.YesNoCancelDialog's public (java.awt.Frame parent, java.lang.String title, java.lang.String msg)
at net.imagej.patcher.CodeHacker.replaceAppNameInCall(CodeHacker.java:446)
at net.imagej.patcher.LegacyExtensions.insertAppNameHooks(LegacyExtensions.java:419)
at net.imagej.patcher.LegacyExtensions.injectHooks(LegacyExtensions.java:291)
at net.imagej.patcher.LegacyInjector.inject(LegacyInjector.java:308)
at net.imagej.patcher.LegacyInjector.injectHooks(LegacyInjector.java:109)
at net.imagej.patcher.LegacyEnvironment.initialize(LegacyEnvironment.java:101)
at net.imagej.patcher.LegacyEnvironment.applyPatches(LegacyEnvironment.java:495)
at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:397)
at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:376)
at net.imagej.legacy.LegacyService.(LegacyService.java:134)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:302)
at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
at org.scijava.Context.(Context.java:278)
at org.scijava.Context.(Context.java:234)
at org.scijava.Context.(Context.java:174)
at org.scijava.Context.(Context.java:160)
at net.imagej.ImageJ.(ImageJ.java:77)
at net.imagej.Main.launch(Main.java:61)
at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:81)
Caused by: javassist.CannotCompileException: No code replaced!
at net.imagej.patcher.CodeHacker$EagerExprEditor.instrument(CodeHacker.java:1280)
at net.imagej.patcher.CodeHacker.replaceAppNameInCall(CodeHacker.java:443)
... 32 more
[ERROR] Cannot create plugin: class='org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage', name='JavaScript', priority=0.0, enabled=true, pluginType=ScriptLanguage
java.lang.IllegalArgumentException: No such script engine: javascript
at org.scijava.script.AdaptedScriptLanguage.findFactory(AdaptedScriptLanguage.java:151)
at org.scijava.script.AdaptedScriptLanguage.(AdaptedScriptLanguage.java:73)
at org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage.(JavaScriptScriptLanguage.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:304)
at org.scijava.plugin.DefaultPluginService.createInstance(DefaultPluginService.java:236)
at org.scijava.plugin.DefaultPluginService.createInstances(DefaultPluginService.java:225)
at org.scijava.plugin.DefaultPluginService.createInstancesOfType(DefaultPluginService.java:216)
at org.scijava.plugin.AbstractSingletonService.initInstances(AbstractSingletonService.java:92)
at org.scijava.plugin.AbstractSingletonService.getInstances(AbstractSingletonService.java:75)
at org.scijava.script.DefaultScriptService.initScriptLanguageIndex(DefaultScriptService.java:273)
at org.scijava.script.DefaultScriptService.scriptLanguageIndex(DefaultScriptService.java:238)
at org.scijava.script.DefaultScriptService.getIndex(DefaultScriptService.java:118)
at org.scijava.script.ScriptService.canHandleFile(ScriptService.java:314)
at org.scijava.script.ScriptFinder.createInfos(ScriptFinder.java:165)
at org.scijava.script.ScriptFinder.scanResources(ScriptFinder.java:133)
at org.scijava.script.ScriptFinder.findScripts(ScriptFinder.java:109)
at org.scijava.script.DefaultScriptService.initScripts(DefaultScriptService.java:314)
at org.scijava.script.DefaultScriptService.scripts(DefaultScriptService.java:256)
at org.scijava.script.DefaultScriptService.getScripts(DefaultScriptService.java:153)
at net.imagej.legacy.LegacyService.getScriptsAndNonLegacyCommands(LegacyService.java:628)
at net.imagej.legacy.IJ1Helper.addMenuItems(IJ1Helper.java:744)
at net.imagej.legacy.LegacyService.initialize(LegacyService.java:488)
at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:353)
at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
at org.scijava.Context.(Context.java:278)
at org.scijava.Context.(Context.java:234)
at org.scijava.Context.(Context.java:174)
at org.scijava.Context.(Context.java:160)
at net.imagej.ImageJ.(ImageJ.java:77)
at net.imagej.Main.launch(Main.java:61)
at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:81)


ImageJ-MATLAB 0.7.2: MATLAB to ImageJ Interface

JVM> Version: 1.8.0_131
JVM> Total amount of memory: 178176 Kb
JVM> Amount of free memory: 53601 Kb

-- Welcome to ImageJ-MATLAB --
ImageJ-MATLAB consists of an extensible set of commands for passing information between ImageJ and MATLAB.
See the individual sections below for a list of available commands.

For more information and examples see:
http://imagej.net/MATLAB-Scripting

--- MATLAB Command Plugins ---

-- ImageJ MATLAB commands --

Usage: IJM.[command]
help - prints a brief description of available commands
getDataset - creates a MATLAB matrix from the active ImageJ image
getDatasetAs(name) - creates a MATLAB matrix from the active ImageJ image, and assigns it to the specified variable name
show(name) - takes the MATLAB matrix with the specified name and displays it as an image


Status> ImageJ is running.

log4j:WARN No appenders could be found for logger (loci.formats.ClassList).
log4j:WARN Please initialize the log4j system properly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.