Matlab figures from ImageJ crash ImageJ

The most recent version of Matlab, 2016b, contains a new Engine API for Java, which is a significant simplification over previous methods for accomplishing this.

I’ve been experimenting with using it to access Matlab from an ImageJ plugin. I’ve uploaded some sample code to a gist. I can set and get Matlab variables and call Matlab functions successfully. However, if I try to open a new window (for example on line 42, where I call Matlab’s “figure” function) ImageJ crashes. When I try debugging it in Visual Studio, it reports:

Unhandled exception at 0x000000005ED04F44 (jvm.dll) in ImageJ.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

This looks like Java’s version of a null pointer exception.

It’s entirely possibly I’m doing something wrong on my end. But that call to figure works just fine when I try it in Matlab’s demo code. Is ImageJ doing anything that would prevent an external process from cereating a window?

Dear @waltman,
have you tried to use Miji?
I used it sometimes and it works quite good.



http://bigwww.epfl.ch/sage/soft/mij/

Actually, it is suggested this one:

but I’ve never tried it by now.

Have a nice day,
Emanuele