Skip to content

Make Matlab callable from inside ImageJ #1

Open

Description

@dscho

This is something that might be very tricky. A couple of hints that might lead to a workable solution:

Hopefully these pointers will help!

Activity

  1. hinerm commented on Jul 16, 2014

    @hinerm
    Member

    I'm working on an implementation with MatlabControl right now.. it seems to work very nicely. My only complaint is that only the 3.1.0 version is available via Maven right now, and it always needs to launch a new matlab instance.

    The 4.x release allows you to both launch Matlab silently and attach to existing Matlab instances, I believe. I would like to e-mail the author about deploying the 4.x line to maven central but all e-mail addresses that I can find are invalid...

  2. hinerm commented on Jul 16, 2014

    @hinerm
    Member

    @dscho after @ctrueden and I talked, I'm now under the impression that calling MATLAB form within ImageJ could be dangerous license grounds...? And we just want to use the JMI and make the MATLAB language non-functional if Fiji is spun up outside of a MATLAB instance.

  3. LeeKamentsky commented on Jul 16, 2014

    @LeeKamentsky
    Member

    So if you happen to launch Java with jmi.jar in the classpath as a user, does that violate any licenses (not a rhetorical question, I don't know)? I am hoping that you could reference the necessary classes (using reflection or scripting if you need the Jar for compilation to succeed) and only expose Matlab support if the class loader could find them. As it is, there are plugins that do not have GPL-compatible licenses so hopefully we have already crossed this bridge.

    I'd say it would be useful to provide support in that sort of fashion. I looked at this briefly for CellProfiler and my biggest concern was that the interface libraries were version-specific which would complicate the distribution - so you need directions for users that tell them how to launch Fiji / ImageJ / CellProfiler / Knime with the jmi.jar that came with their Matlab.

  4. hinerm commented on Jul 16, 2014

    @hinerm
    Member

    using reflection or scripting if you need the Jar for compilation to succeed

    This is what Curtis wrote ReflectedUniverse for I believe.

    Currently I've decided to go in a stubs direction instead: https://github.com/scijava/matlab-jmi-stubs

    I don't know that launching Java with jmi.jar on the classpath violates licensing.. @ctrueden explained it as if you make it possible for multiple users to connect to a single MATLAB instance running on a server, you can be subject to legal action. And I think MatlabControl might make that possible...

  5. dscho commented on Jul 16, 2014

    @dscho
    Author

    So if you happen to launch Java with jmi.jar in the classpath as a user, does that violate any licenses

    No, just having stuff with different licenses in your class path does not pose a problem. It is only when you make "derivative" work that licenses kick in. That is, if you require jmi.jar to be there, you are on shaky grounds.

  6. dscho commented on Jul 16, 2014

    @dscho
    Author

    I would like to e-mail the author about deploying the 4.x line to maven central but all e-mail addresses that I can find are invalid...

    @hinerm did you consider opening an issue on https://code.google.com/p/matlabcontrol/issues/list?

    @ctrueden explained it as if you make it possible for multiple users to connect to a single MATLAB instance running on a server, you can be subject to legal action. And I think MatlabControl might make that possible...

    That is easily addressed: we just need to write in our license that we only support legal use.

  7. tinevez commented on Jul 16, 2014

    @tinevez
    Member

    @dscho, I seem to remember that you and Jacques had some experience dealing with MATLAB licenses during your years at the IPF. Any recollection?

  8. hinerm commented on Jul 16, 2014

    @hinerm
    Member

    @hinerm did you consider opening an issue on https://code.google.com/p/matlabcontrol/issues/list?

    I did. The submission template is specific to reporting bugs so I decided against it.. I found another reference to the developer's username and was able to send an e-mail that wasn't rejected.

  9. dscho commented on Jul 16, 2014

    @dscho
    Author

    you and Jacques had some experience dealing with MATLAB licenses during your years at the IPF.

    Oh yes, the IPF. Where I got oh so much support by the institute's management. Not happy memories!

    Anyway, the problem we ran into were some obscure license restrictions of the Matlab Compiler Toolbox. Basically, you cannot distribute binaries built with said toolbox if you compete with Mathworks. While we were convinced that we were not competing with Mathworks, we were also convinced that they would see it differently, so we refrained from shipping such compile products.

    In many ways, this is not related at all to this project: this project requires a fully licensed Matlab copy. It simply won't work without. And it does not at all use the Matlab Compiler Toolbox, thus we do not have to abide by that Toolbox' license.

  10. tinevez commented on Jul 16, 2014

    @tinevez
    Member

    Ok got it.

  11. hinerm commented on Jul 16, 2014

    @hinerm
    Member

    For the record, development is back to a MatlabControl implementation. It's on the WIP branch. I believe the bindings are done, so I just have to figure out how to properly pass input through to MATLAB's eval and feval..

  12. hinerm commented on Jul 18, 2014

    @hinerm
    Member

    A quick update for those interested:

    The MATLAB scripting is working, both from without and within MATLAB. Script @Parameters and such are working, and complex java objects can be used when using scripts from within MATLAB.

    The only work remaining to merge this is to complete the pref_service branch (as of writing, I used a non-functional Prefs implementation to test... I'll just have to convert to a PrefsService, and then add a high priority implementation in Miji. This is to work around a known java.lang.preferences bug in MATLAB, and it's something we wanted to do anyway).

    So I will also have to merge and release my Miji branch.

    But, yeah, the actual MATLAB side of things is done now.

    I'll write a blog post detailing the script use and limitations after release.

  13. dscho commented on Jul 18, 2014

    @dscho
    Author

    @hinerm you rock!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions