Login  Register

Re: Can ImageJ GUI (not library) be embedded into C++ somehow without rewriting the GUI?

Posted by Curtis Rueden on May 23, 2018; 8:26pm
URL: http://imagej.273.s1.nabble.com/Can-ImageJ-GUI-not-library-be-embedded-into-C-somehow-without-rewriting-the-GUI-tp5020715p5020721.html

Hi Matti,

> GUI writing bugs me, because if it’s done once, then I find it waste
> of time having to basically rewrite nearly the same thing, just in a
> different framework.

That issue extends far beyond only GUIs. It is a quintessential frustration
of being a programmer, in my view.

Seriously, check out GraalVM. Here is an excerpt from their polyglot guide
[1]:

> Often developers have to make uncomfortable compromises that require them
to
> rewrite their software in other languages. For example:

> * “That library is not available in my language. I need to rewrite it.”
> * “That language would be the perfect fit for my problem, but we cannot
run
>   it in our environment.”
> * “That problem is already solved in my language, but the language is too
>   slow.”

> With GraalVM we aim to allow developers to freely choose the right
language
> for the task at hand without making compromises.

Regards,
Curtis

[1] https://www.graalvm.org/docs/reference-manual/polyglot/

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Wed, May 23, 2018 at 3:20 PM, Matti Viljamaa <[hidden email]>
wrote:

> Thank you.
>
> Well, because other libraries that I rely on require C++. It’s not even
> that I could use them as foreign functions in Java, but rather my program
> has to run as a C++ program.
>
> This has also got me thinking that ImageJ might not serve me that well.
> Unless I rewrite the GUI.
> But then I could use other libs as well, like OpenCV, ITK, …
>
> GUI writing bugs me, because if it’s done once, then I find it waste of
> time having to basically rewrite nearly the same thing, just in a different
> framework.
>
> BR, Matti
>
> > Curtis Rueden <[hidden email]> kirjoitti
> 23.5.2018 kello 23.05:
> >
> > Hi Matti,
> >
> >> What are my options?
> >
> > A. Link to libjvm from C++ and invoke Java code via the JNI Invocation
> API
> > [1]. Beware platform-specific issues such as starting AWT from the main
> > thread on macOS, though [2].
> >
> > B. GraalVM. See "Top 10 Things To Do With GraalVM" [3], particularly
> items
> > 3, 7 and 8.
> >
> > C. Spawn java as another process from C++ to run ImageJ.
> >
> > D. Use the ImageJ Server [4] to communicate with ImageJ from C++ via a
> REST
> > API.
> >
> > Why does your program have to be in C++?
> >
> > Regards,
> > Curtis
> >
> > [1] https://docs.oracle.com/javase/8/docs/technotes/
> > guides/jni/spec/invocation.html
> > [2] https://developer.apple.com/legacy/library/technotes/
> > tn2147/_index.html#//apple_ref/doc/uid/DTS10003827-CH1-
> THREADED_INVOCATION
> > [3] https://medium.com/graalvm/graalvm-ten-things-12d9111f307d
> > [4] https://imagej.net/Server
> >
> > --
> > Curtis Rueden
> > LOCI software architect - https://loci.wisc.edu/software
> > ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
> > Did you know ImageJ has a forum? http://forum.imagej.net/
> >
> >
> > On Wed, May 23, 2018 at 2:41 PM, Matti Viljamaa <
> [hidden email]>
> > wrote:
> >
> >> Hello,
> >>
> >> I want to use ImageJ in a C++ program. However, I found the GUI pretty
> >> useful as it is, but since it’s in Java, then I’m not sure, whether I
> can
> >> use it, because
> >> my program has to be in C++.
> >>
> >> And I don’t want to rewrite the GUI, since it’s done already.
> >>
> >> What are my options?
> >>
> >> BR, Matti
> >>
> >> Lähetetty Windows 10:n Sähköpostista
> >>
> >>
> >>
> >> ---
> >> This email has been checked for viruses by Avast antivirus software.
> >> https://www.avast.com/antivirus
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html