Hello,
How do I install macro tools from another plugin? Currently I am doing:- MacroInstaller installer = new ij.plugin.MacroInstaller(); installer.install(ROIBrush_.MACRO_CMD); //MACRO_CMD contains the macro definition as it would appear in a macro.txt file installer.install(LabelBrush_.MACRO_CMD); But only the last called macro tool appears in the toolbar. i.e. in this case the LabelBrush_ tool appears, but if I reversed the calling order then the ROIBrush would be the only one that appeared in the toolbar. Thanks Tom Larkworthy |
Hello,
I would guess that you can create two objects, one for each macro you want to install. Have you tried that? MacroInstaller installerRB = new ij.plugin.MacroInstaller(); MacroInstaller installerLB = new ij.plugin.MacroInstaller(); installerRB.install(ROIBrush_.MACRO_CMD); installerLB.install(LabelBrush_.MACRO_CMD); I hope it's this, Agnès On 28/06/06, Tom Larkworthy <[hidden email]> wrote: > > Hello, > > How do I install macro tools from another plugin? > Currently I am doing:- > > MacroInstaller installer = new ij.plugin.MacroInstaller(); > > installer.install(ROIBrush_.MACRO_CMD); //MACRO_CMD contains the > macro > definition as it would appear in a macro.txt file > installer.install(LabelBrush_.MACRO_CMD); > But only the last called macro tool appears in the toolbar. i.e. in this > case the LabelBrush_ tool appears, but if I reversed the calling order > then > the ROIBrush would be the only one that appeared in the toolbar. > > Thanks > > Tom Larkworthy > |
In reply to this post by Tom Larkworthy
Tom,
you could consider using the ActionBar plugin. With this plugin, you can design one or more custom buttton bar(s) from which you can easily run macro commands, macros files or install different macros sets or macrotools sets and switch from one set to another. You can see the ActionBar description at : http://rsb.info.nih.gov/ij/plugins/action-bar/ Jerome Quoting Tom Larkworthy <[hidden email]>: > Hello, > > How do I install macro tools from another plugin? > Currently I am doing:- > > MacroInstaller installer = new ij.plugin.MacroInstaller(); > > installer.install(ROIBrush_.MACRO_CMD); //MACRO_CMD contains the macro > definition as it would appear in a macro.txt file > installer.install(LabelBrush_.MACRO_CMD); > But only the last called macro tool appears in the toolbar. i.e. in this > case the LabelBrush_ tool appears, but if I reversed the calling order then > the ROIBrush would be the only one that appeared in the toolbar. > > Thanks > > Tom Larkworthy > |
In reply to this post by Agnès Sauleda Brossa
Unfortunatly it is not that. I originally programmed it like you suggested
until I had the inverse thought :-) On 6/28/06, Agnès Sauleda Brossa <[hidden email]> wrote: > > Hello, > > I would guess that you can create two objects, one for each macro you want > to install. Have you tried that? > > MacroInstaller installerRB = new ij.plugin.MacroInstaller(); > MacroInstaller installerLB = new ij.plugin.MacroInstaller(); > > installerRB.install(ROIBrush_.MACRO_CMD); > installerLB.install(LabelBrush_.MACRO_CMD); > > I hope it's this, > > Agnès > > On 28/06/06, Tom Larkworthy <[hidden email]> wrote: > > > > Hello, > > > > How do I install macro tools from another plugin? > > Currently I am doing:- > > > > MacroInstaller installer = new ij.plugin.MacroInstaller(); > > > > installer.install(ROIBrush_.MACRO_CMD); //MACRO_CMD contains the > > macro > > definition as it would appear in a macro.txt file > > installer.install(LabelBrush_.MACRO_CMD); > > But only the last called macro tool appears in the toolbar. i.e. in this > > case the LabelBrush_ tool appears, but if I reversed the calling order > > then > > the ROIBrush would be the only one that appeared in the toolbar. > > > > Thanks > > > > Tom Larkworthy > > > |
In reply to this post by Tom Larkworthy
Hi,
On Wed, 28 Jun 2006, Tom Larkworthy wrote: > How do I install macro tools from another plugin? > Currently I am doing:- > > MacroInstaller installer = new ij.plugin.MacroInstaller(); > > installer.install(ROIBrush_.MACRO_CMD); //MACRO_CMD contains the macro > definition as it would appear in a macro.txt file > installer.install(LabelBrush_.MACRO_CMD); > But only the last called macro tool appears in the toolbar. i.e. in this > case the LabelBrush_ tool appears, but if I reversed the calling order then > the ROIBrush would be the only one that appeared in the toolbar. The MacroInstaller seems to get confused when being called several times. However, you can do this: new MacroInstaller().install(ROIBrush_.MACRO_CMD + "\n" + LabelBrush_.MACRO_CMD); i.e. you can install more than one tool per call to MacroInstaller.install(); Hth, Dscho |
In reply to this post by Tom Larkworthy
Oh great. Thanks for your help
Tom On 6/28/06, Wayne Rasband <[hidden email]> wrote: > > > How do I install macro tools from another plugin? > > Currently I am doing:- > > > > MacroInstaller installer = new ij.plugin.MacroInstaller(); > > > > installer.install(ROIBrush_.MACRO_CMD); //MACRO_CMD contains the > > macro > > definition as it would appear in a macro.txt file > > installer.install(LabelBrush_.MACRO_CMD); > > But only the last called macro tool appears in the toolbar. i.e. in > > this > > case the LabelBrush_ tool appears, but if I reversed the calling > > order then > > the ROIBrush would be the only one that appeared in the toolbar. > > The MacroInstaller installs macro sets and each set you install > replaces the previous one. You can install both macros using > > installer.install(ROIBrush_.MACRO_CMD+LabelBrush_.MACRO_CMD); > > but you need to be using ImageJ 1.37d or later if the second macro uses > global variables. This is because earlier versions of ImageJ required > that global variables be defined at the beginning of the macro file. > > I posted the RoiBrush plugin at > <http://rsb.info.nih.gov/ij/plugins/roi-brush.html>. Let me know if > there are any changes you would like me to make to the Web page. > > By the way, I spent the morning figuring out why leaving out the braces > in > > if (flags&alt==0) { > call('ROI_Brush.label', x,y,z,flags, roiBrushWidth); > } else { > call('ROI_Brush.unlabel', x,y,z,flags, roiBrushWidth); > } > > caused a macro error. The fix will be in ImageJ 1.37j, which I plan to > release in the next day or two. > > -wayne > > |
Free forum by Nabble | Edit this page |