Hello all,
I have a plugin that needs to be used by people that aren't familiar with ImageJ where I work. I made an AutoRun macro that opens the plugin when ImageJ is first opened, but I would also like to somehow have the main ImageJ window disabled so only the plugin is visible and able to be interacted with. I have the ImageJ source code visible on Eclipse from following this <https://imagej.net/Developing_ImageJ_in_Eclipse> tutorial, but I don't have access to the other classes that are listed in the maven dependencies, such as the awt and swing classes. I think I need to use awt or swing to modify the UI, but honestly, I'm not sure where to look/what to do to move forward. I would really appreciate some advice on how I can progress on the project! -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
> On Jan 18, 2019, at 2:05 PM, Grayson Harrington <[hidden email]> wrote:
> > Hello all, > > I have a plugin that needs to be used by people that aren't familiar with > ImageJ where I work. I made an AutoRun macro that opens the plugin when > ImageJ is first opened, but I would also like to somehow have the main > ImageJ window disabled so only the plugin is visible and able to be > interacted with. You can hide the “ImageJ” window using this Java code IJ.getInstance().setVisible(false); or this macro code eval(“js”,”IJ.getInstance().setVisible(false)”); -wayne > I have the ImageJ source code visible on Eclipse from following this > <https://imagej.net/Developing_ImageJ_in_Eclipse> tutorial, but I don't > have access to the other classes that are listed in the maven dependencies, > such as the awt and swing classes. I think I need to use awt or swing to > modify the UI, but honestly, I'm not sure where to look/what to do to move > forward. > > I would really appreciate some advice on how I can progress on the project! -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Wayne,
Thank you for getting back to me with those tips. I tried using the macro code solution and inserted the method you should me into my AutoRun macro that's in the StartupMacros.txt file. Here is the macro that I have: macro "AutoRun" { eval(“js”,”IJ.getInstance().setVisible(false)”); run ("APC Rating"); } Where "APC Rating" is the plugin that I mentioned in my first post. Below is the Macro Error that shows up when I start ImageJ: [image: Macro Error.PNG] It appears to ot recognize "js". Do you know why this is happening? Thank you, Grayson On Fri, Jan 18, 2019 at 6:35 PM Wayne Rasband <[hidden email]> wrote: > > On Jan 18, 2019, at 2:05 PM, Grayson Harrington < > [hidden email]> wrote: > > > > Hello all, > > > > I have a plugin that needs to be used by people that aren't familiar with > > ImageJ where I work. I made an AutoRun macro that opens the plugin when > > ImageJ is first opened, but I would also like to somehow have the main > > ImageJ window disabled so only the plugin is visible and able to be > > interacted with. > > You can hide the “ImageJ” window using this Java code > > IJ.getInstance().setVisible(false); > > or this macro code > > eval(“js”,”IJ.getInstance().setVisible(false)”); > > -wayne > > > > I have the ImageJ source code visible on Eclipse from following this > > <https://imagej.net/Developing_ImageJ_in_Eclipse> tutorial, but I don't > > have access to the other classes that are listed in the maven > dependencies, > > such as the awt and swing classes. I think I need to use awt or swing to > > modify the UI, but honestly, I'm not sure where to look/what to do to > move > > forward. > > > > I would really appreciate some advice on how I can progress on the > project! > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ImageJ mailing list: http://imagej.nih.gov/ij/list.html Macro Error.PNG (13K) Download Attachment |
Hi Grayson,
probably you need to fix the double quotes. Some text editors change them into different ones, which are not understood by the macro interpreter. macro "AutoRun" { eval("js","IJ.getInstance().setVisible(false)"); run ("APC Rating"); } IHTH Giovanni -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Grayson Harrington Sent: Montag, 21. Januar 2019 14:59 To: [hidden email] Subject: Re: Attempting to modify the ImageJ user interface to create a "mini application" Hi Wayne, Thank you for getting back to me with those tips. I tried using the macro code solution and inserted the method you should me into my AutoRun macro that's in the StartupMacros.txt file. Here is the macro that I have: macro "AutoRun" { eval(“js”,”IJ.getInstance().setVisible(false)”); run ("APC Rating"); } Where "APC Rating" is the plugin that I mentioned in my first post. Below is the Macro Error that shows up when I start ImageJ: [image: Macro Error.PNG] It appears to ot recognize "js". Do you know why this is happening? Thank you, Grayson On Fri, Jan 18, 2019 at 6:35 PM Wayne Rasband <[hidden email]> wrote: > > On Jan 18, 2019, at 2:05 PM, Grayson Harrington < > [hidden email]> wrote: > > > > Hello all, > > > > I have a plugin that needs to be used by people that aren't familiar > > with ImageJ where I work. I made an AutoRun macro that opens the > > plugin when ImageJ is first opened, but I would also like to somehow > > have the main ImageJ window disabled so only the plugin is visible > > and able to be interacted with. > > You can hide the “ImageJ” window using this Java code > > IJ.getInstance().setVisible(false); > > or this macro code > > eval(“js”,”IJ.getInstance().setVisible(false)”); > > -wayne > > > > I have the ImageJ source code visible on Eclipse from following this > > <https://imagej.net/Developing_ImageJ_in_Eclipse> tutorial, but I > > don't have access to the other classes that are listed in the maven > dependencies, > > such as the awt and swing classes. I think I need to use awt or > > swing to modify the UI, but honestly, I'm not sure where to > > look/what to do to > move > > forward. > > > > I would really appreciate some advice on how I can progress on the > project! > > -- > 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 |
Thank you for the advice. I changed the double quotes and when I started
ImageJ the error from before was gone, but now I'm getting this ReferenceError: ReferenceError: "importPackage" is not defined in <eval> at line number 1 and the main ImageJ window is still visible. Has anyone seen this before or does anyone know about it? Thank you On Mon, Jan 21, 2019 at 8:08 AM Cardone, Giovanni <[hidden email]> wrote: > Hi Grayson, > > probably you need to fix the double quotes. Some text editors change them > into different ones, which are not understood by the macro interpreter. > > macro "AutoRun" { > eval("js","IJ.getInstance().setVisible(false)"); > run ("APC Rating"); > } > > IHTH > Giovanni > > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of > Grayson Harrington > Sent: Montag, 21. Januar 2019 14:59 > To: [hidden email] > Subject: Re: Attempting to modify the ImageJ user interface to create a > "mini application" > > Hi Wayne, > > Thank you for getting back to me with those tips. I tried using the macro > code solution and inserted the method you should me into my AutoRun macro > that's in the StartupMacros.txt file. > > Here is the macro that I have: > > macro "AutoRun" { > eval(“js”,”IJ.getInstance().setVisible(false)”); > run ("APC Rating"); > } > > Where "APC Rating" is the plugin that I mentioned in my first post. > > Below is the Macro Error that shows up when I start ImageJ: > [image: Macro Error.PNG] > > It appears to ot recognize "js". Do you know why this is happening? > > Thank you, > Grayson > > On Fri, Jan 18, 2019 at 6:35 PM Wayne Rasband <[hidden email]> wrote: > > > > On Jan 18, 2019, at 2:05 PM, Grayson Harrington < > > [hidden email]> wrote: > > > > > > Hello all, > > > > > > I have a plugin that needs to be used by people that aren't familiar > > > with ImageJ where I work. I made an AutoRun macro that opens the > > > plugin when ImageJ is first opened, but I would also like to somehow > > > have the main ImageJ window disabled so only the plugin is visible > > > and able to be interacted with. > > > > You can hide the “ImageJ” window using this Java code > > > > IJ.getInstance().setVisible(false); > > > > or this macro code > > > > eval(“js”,”IJ.getInstance().setVisible(false)”); > > > > -wayne > > > > > > > I have the ImageJ source code visible on Eclipse from following this > > > <https://imagej.net/Developing_ImageJ_in_Eclipse> tutorial, but I > > > don't have access to the other classes that are listed in the maven > > dependencies, > > > such as the awt and swing classes. I think I need to use awt or > > > swing to modify the UI, but honestly, I'm not sure where to > > > look/what to do to > > move > > > forward. > > > > > > I would really appreciate some advice on how I can progress on the > > project! > > > > -- > > 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 |
On 21.01.19 19:12, Grayson Harrington wrote:
> and the main ImageJ window is still visible. Has anyone seen this before or > does anyone know about it? It depends how far you want to take all this, but a cleaner solution would be to revert the hierarchy: rather than running your plugin under ImageJ, run ImageJ as library in your own app. The following class loads ImageJ and makes it available for image processing without ever showing the ImageJ window: import ij.IJ; import ij.ImageJ; import ij.ImagePlus; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class MyApp extends JFrame { private ImageJ ij; public MyApp() { super("My Application"); this.ij = new ImageJ(ImageJ.NO_SHOW); setSize(300, 300); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { ij.quit(); super.windowClosing(e); } }); JButton button = new JButton("Open Image..."); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ImagePlus imp = IJ.openImage(); imp.show(); } }); JPanel contentPane = new JPanel(new BorderLayout()); getContentPane().add(contentPane); contentPane.add(button, BorderLayout.NORTH); setVisible(true); } public static void main(String[] args) { new MyApp(); } } -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Grayson_Harrington
Hi Grayson,
You could also consider using an ActionBar that would expose only buttons useful for your user. It has a mini app mode using the <main> tag that hides the ImageJ tool bar. Here's an example code for a mini app. Save this in Plugins>ActionBar, and launch it at statup using run("mini app"); in Options>Startup... // Action Bar description file :mini_app run("Action Bar","/plugins/ActionBar/mini_app.ijm"); exit; <main> <DnDAction> file=getArgument(); open(file); run("8-bit"); </DnDAction> <line> <button> label=Toggle IJ icon=noicon arg=<hide> <button> label=hello icon=noicon arg=<macro> showMessage("hello"); </macro> </line> Jerome. Le ven. 18 janv. 2019 à 23:35, Grayson Harrington < [hidden email]> a écrit : > Hello all, > > I have a plugin that needs to be used by people that aren't familiar with > ImageJ where I work. I made an AutoRun macro that opens the plugin when > ImageJ is first opened, but I would also like to somehow have the main > ImageJ window disabled so only the plugin is visible and able to be > interacted with. > > I have the ImageJ source code visible on Eclipse from following this > <https://imagej.net/Developing_ImageJ_in_Eclipse> tutorial, but I don't > have access to the other classes that are listed in the maven dependencies, > such as the awt and swing classes. I think I need to use awt or swing to > modify the UI, but honestly, I'm not sure where to look/what to do to move > forward. > > I would really appreciate some advice on how I can progress on the project! > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thank you all for your help and advice. I used Jerome's advice to hide the
main ImageJ window from within the plugin with the <main> command, but on startup the main window still flashes briefly (which I don't think I will be able to avoid with this technique). This is a good "quick fix" to what I am working on and it will serve as something that can be used inside the company that I work for, but I also need to create a standalone application that runs the already developed plugin and can hide the plugin code. I tried to follow Peterbauer's example for a standalone app, but I haven't been able to get it to work yet. Now I'm dealing with this error: <http://imagej.1557.x6.nabble.com/file/t382212/Capture.png> Does anyone know what this is from? Is there a way to compile my working ImageJ plugin into a jar file that can be used more easily in eclipse? -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 2019-02-26 15:55, Grayson_Harrington wrote:
> Thank you all for your help and advice. I used Jerome's advice to hide the > main ImageJ window from within the plugin with the <main> command, but on > startup the main window still flashes briefly (which I don't think I will be > able to avoid with this technique). > > This is a good "quick fix" to what I am working on and it will serve as > something that can be used inside the company that I work for, but I also > need to create a standalone application that runs the already developed > plugin and can hide the plugin code. > > I tried to follow Peterbauer's example for a standalone app, but I haven't > been able to get it to work yet. Now I'm dealing with this error: > > <http://imagej.1557.x6.nabble.com/file/t382212/Capture.png> > > Does anyone know what this is from? These are errors caused by the module system introduced with JDK 9. Try to compile with JDK 8 (there are workarounds to get rid of them with JDK 9+. Drop a note if you want to know more.) Best, Thomas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I was using jdk11* and just downloaded and installed jdk1.8* and then set it
to be used in the project (see image), but the same error message was thrown. <http://imagej.1557.x6.nabble.com/file/t382212/capture.png> -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 26.02.19 19:14, Grayson_Harrington wrote:
> I was using jdk11* and just downloaded and installed jdk1.8* and then set it > to be used in the project (see image), but the same error message was > thrown. > > <http://imagej.1557.x6.nabble.com/file/t382212/capture.png> Check your project setup. Perhaps you are compiling with JDK 8, but still running with JDK 11. The second option is to try to get JDK 11 running. First of all, try to get ij.jar on the classpath while launching, not on the modulepath: java -classpath ij.jar <your-main-package.your-main-class> Running on the modulepath is more involved. I describe a solution in detail, because most likely more people will run into this problem in the near future. Error #1 ("Unable to derive module descriptor for ../ij.jar") unambiguously points to a modulepath problem. The most likely cause is a missing entry in META-INF\MANIFEST.MF. There should be one with the key "Automatic-Module-Name:" followed by a name. It's absent in ij.jar from imagej.nih.gov (at least it did when I fetched it two or three weeks ago). The Fiji people added the key for their Maven repo, but left the value blank (if someone from the Fiji community reads these lines: please add an automatic module name for modular applications!). One can patch ij.jar by opening it in an archive manager (rename to ij.zip if working with 7zip) and adding a name manually (I simply called it "ij"). Complete MANIFEST.MF: Manifest-Version: 1.0 Main-Class: ij.ImageJ Automatic-Module-Name: ij Error #2, "MacAdapter.class found in top level directory (unnamed module not allowed in module)": JDK 9+ seems to confuse this class in the root of ij.jar with a module-info.class (a class internally describing a JDK 9+ module). So far I found no other solution than removing it from ij.jar. It's required only for MacOS (should Wayne Rasband happen to read these lines: would it be possible to move it into a package?) I usually compile new versions from source, with a patched MANIFEST.MF and omitting the MacAdapter.class in my ant build, and can run ImageJ as a library successfully on Windows and Linux, with any of JDK 9 to 12ea. Good luck, Thomas -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Grayson_Harrington
Hi Thomas,
> The Fiji people added the key for their Maven repo, but left the value > blank (if someone from the Fiji community reads these lines: please > add an automatic module name for modular applications!). The SciJava build infrastructure supports Automatic-Module-Name, and many components already do define it. See this gist: https://gist.github.com/ctrueden/56d3f4fe2273d4a6437d8d593bf67c9f However, the net.imagej:ij component did not set the package-name property, and therefore the Automatic-Module-Name was not assigned accordingly. I have remedied this with https://github.com/imagej/ImageJA/commit/26e053ee, so the next ImageJ 1.x release will have the field set in the manifest. Regards, Curtis -- Curtis Rueden LOCI software architect - https://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden Have you tried the Image.sc Forum? https://forum.image.sc/ On Tue, Feb 26, 2019 at 3:09 PM Peterbauer Thomas < [hidden email]> wrote: > On 26.02.19 19:14, Grayson_Harrington wrote: > > I was using jdk11* and just downloaded and installed jdk1.8* and then > set it > > to be used in the project (see image), but the same error message was > > thrown. > > > > <http://imagej.1557.x6.nabble.com/file/t382212/capture.png> > > Check your project setup. Perhaps you are compiling with JDK 8, but > still running with JDK 11. > > The second option is to try to get JDK 11 running. First of all, try to > get ij.jar on the classpath while launching, not on the modulepath: > > java -classpath ij.jar <your-main-package.your-main-class> > > Running on the modulepath is more involved. I describe a solution in > detail, because most likely more people will run into this problem in > the near future. > > Error #1 ("Unable to derive module descriptor for ../ij.jar") > unambiguously points to a modulepath problem. The most likely cause is a > missing entry in META-INF\MANIFEST.MF. There should be one with the key > "Automatic-Module-Name:" followed by a name. It's absent in ij.jar from > imagej.nih.gov (at least it did when I fetched it two or three weeks > ago). The Fiji people added the key for their Maven repo, but left the > value blank (if someone from the Fiji community reads these lines: > please add an automatic module name for modular applications!). One can > patch ij.jar by opening it in an archive manager (rename to ij.zip if > working with 7zip) and adding a name manually (I simply called it "ij"). > Complete MANIFEST.MF: > > Manifest-Version: 1.0 > Main-Class: ij.ImageJ > Automatic-Module-Name: ij > > Error #2, "MacAdapter.class found in top level directory (unnamed module > not allowed in module)": JDK 9+ seems to confuse this class in the root > of ij.jar with a module-info.class (a class internally describing a JDK > 9+ module). So far I found no other solution than removing it from > ij.jar. It's required only for MacOS (should Wayne Rasband happen to > read these lines: would it be possible to move it into a package?) > > I usually compile new versions from source, with a patched MANIFEST.MF > and omitting the MacAdapter.class in my ant build, and can run ImageJ as > a library successfully on Windows and Linux, with any of JDK 9 to 12ea. > > Good luck, > > Thomas > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |