Hello
I have recorded a macro and am trying to convert it to a plugin. The goal is to take a scanned image that has some light coloured parts on a black background and determine the total area and average size. The variable that we are trying to monitor changes through the process. The macro runs perfectly but I cannot get it converted to a macro. I am not a Java programmer and so have no idea what is wrong. Can someone please help. The macro thresholds an image and then the image is analysed and the area that has been differentiated by thresholding is then put in the results table. The macro looks like this. setAutoThreshold(); //run("Threshold..."); setThreshold(0, 140); setThreshold(0, 140); run("Threshold", "thresholded remaining black"); setAutoThreshold(); run("Set Scale...", "distance=11.860 known=1 pixel=1 unit=mm global"); run("Analyze Particles...", "minimum=10 maximum=999999 bins=20 show=Nothing display exclude clear"); The .java file looks like this: import ij.*; import ij.process.*; import ij.gui.*; import java.awt.*; import ij.plugin.*; public class Stickies_ implements PlugIn { public void run(String arg) { IJ.setAutoThreshold(); IJ.run("Threshold..."); IJ.setThreshold(0, 140); IJ.setThreshold(0, 140); IJ.run("Threshold", "thresholded remaining black"); IJ.setAutoThreshold(); IJ.run("Set Scale...", "distance=11.86 known=1 pixel=1 unit=mm global"); IJ.run("Set Measurements...", "area redirect=None decimal=3"); IJ.run("Analyze Particles...", "minimum=10 maximum=999999 bins=20 show=Nothing display exclude clear"); } } And these are the errors: :\Program Files\ImageJ\plugins\Stickies_.java:10: Method setAutoThreshold() not found in class ij.IJ. IJ.setAutoThreshold(); Kind regards Geoff Nelson |
On Tuesday 13 September 2005 14:46, Geoff Nelson wrote:
> I have recorded a macro and am trying to convert it to a plugin. The goal > is to take a scanned image that has some light coloured parts on a black > background and determine the total area and average size. The variable that > we are trying to monitor changes through the process. The macro runs > perfectly but I cannot get it converted to a macro. I am not a Java > programmer and so have no idea what is wrong. Can someone please help. Perhaps this is not what you want to hear, but if it runs fine and quick enough, why don't you just run it as a plugin? Why do you need a plugin instead of a macro? Cheers, Gabriel |
Hi
I want it as a plugin so that it will be available when ImageJ is started up. Macro's have to be installed each time you start up. I am also going to distribute this to a number of people who are not computer literate to the same extent that I am and installing a macro each time will not make life easy. Kind regards Geoff Nelson Buckman Laboratories South Africa Cell +27 (0)82 654 4093 Phone +27 (0)31 736 8827 Fax +27 (0)31 736 1010 ----- Original Message ----- From: "Gabriel Landini" <[hidden email]> To: <[hidden email]> Sent: Tuesday, September 13, 2005 5:24 PM Subject: Re: Problems converting macro to plugin > On Tuesday 13 September 2005 14:46, Geoff Nelson wrote: >> I have recorded a macro and am trying to convert it to a plugin. The goal >> is to take a scanned image that has some light coloured parts on a black >> background and determine the total area and average size. The variable >> that >> we are trying to monitor changes through the process. The macro runs >> perfectly but I cannot get it converted to a macro. I am not a Java >> programmer and so have no idea what is wrong. Can someone please help. > > Perhaps this is not what you want to hear, but if it runs fine and quick > enough, why don't you just run it as a plugin? > Why do you need a plugin instead of a macro? > > Cheers, > > Gabriel |
On Wednesday 14 September 2005 06:50, Geoff Nelson wrote:
> I want it as a plugin so that it will be available when ImageJ is started > up. Macro's have to be installed each time you start up. I am also going to > distribute this to a number of people who are not computer literate to the > same extent that I am and installing a macro each time will not make life > easy. You do not need that. If you put a "_" in the name of the macro (e.g. "My_macro.txt", and move it to the plugins folder (or 1 subfolder down), it will be available in the Plugins menu, just like any other plugin. You can also call it from another macro. I hope it helps. G. |
Thank you Gabriel
I did not realise that renaming the macro will make ImageJ see it as a plugin. The whole thing works and I will be able to streamline the process. Thank you very much, not to mention now my colleagues think I am very much more intelligent ;-). Kind regards Geoff Nelson Buckman Laboratories South Africa Cell +27 (0)82 654 4093 Phone +27 (0)31 736 8827 Fax +27 (0)31 736 1010 ----- Original Message ----- From: "Gabriel Landini" <[hidden email]> To: <[hidden email]> Sent: Wednesday, September 14, 2005 11:18 AM Subject: Re: Problems converting macro to plugin > On Wednesday 14 September 2005 06:50, Geoff Nelson wrote: >> I want it as a plugin so that it will be available when ImageJ is started >> up. Macro's have to be installed each time you start up. I am also going >> to >> distribute this to a number of people who are not computer literate to >> the >> same extent that I am and installing a macro each time will not make life >> easy. > > You do not need that. If you put a "_" in the name of the macro (e.g. > "My_macro.txt", and move it to the plugins folder (or 1 subfolder down), > it > will be available in the Plugins menu, just like any other plugin. > > You can also call it from another macro. > I hope it helps. > G. |
In reply to this post by Geoff Nelson
> I want it as a plugin so that it will be available when
> ImageJ is started up. Macro's have to be installed each time > you start up. I am also going to distribute this to a number > of people who are not computer literate to the same extent > that I am and installing a macro each time will not make > life easy. Macros contained in a file named "StartupMacros.txt" in the macros folder are automatically installed when ImageJ starts up. In addition, macros in the plugins folder, or subfolder, with an "_" in their name are treated like plugins and are also installed when ImageJ starts up. More information about macros is available at "http://rsb.info.nih.gov/ij/developer/macro/macros.html". -wayne > Kind regards > > Geoff Nelson > > Buckman Laboratories > South Africa > Cell +27 (0)82 654 4093 > Phone +27 (0)31 736 8827 > Fax +27 (0)31 736 1010 > ----- Original Message ----- > From: "Gabriel Landini" <[hidden email]> > To: <[hidden email]> > Sent: Tuesday, September 13, 2005 5:24 PM > Subject: Re: Problems converting macro to plugin > > > > On Tuesday 13 September 2005 14:46, Geoff Nelson wrote: > >> I have recorded a macro and am trying to convert it to a plugin. > The goal > >> is to take a scanned image that has some light coloured parts on a > black > >> background and determine the total area and average size. The > variable > >> that > >> we are trying to monitor changes through the process. The macro runs > >> perfectly but I cannot get it converted to a macro. I am not a Java > >> programmer and so have no idea what is wrong. Can someone please > help. > > > > Perhaps this is not what you want to hear, but if it runs fine and > quick > > enough, why don't you just run it as a plugin? > > Why do you need a plugin instead of a macro? > > > > Cheers, > > > > Gabriel |
Free forum by Nabble | Edit this page |