Hello everyone! I am developing a plugin for ImageJ and I would like to know if anyone knows how to incorporate an already existent plugin inside my code, like using a method. Is that possible? Best wishes, João Silva -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
This is very possible, but the implementation depends on how you like to develop your ImageJ plugins. Personally I use Eclipse and follow a procedure similar to: http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:the_imagej_eclipse_howto If I wanted to add plugins that are .class files, I can right click on my plugin project, click "Java Build Path" and in the Libraries tab, click Add Class Folder...
Not only does this make the other plugins accessible, but it helps with figuring out what methods are available from the other plugin (since I can use Eclipse's package explorer to navigate the class files). If I have .java files, I can just add them directly to my project. If you're using ImageJ's Plugin->New Plugin menu option, you just need to have the other plugin already installed and know what methods you are trying to access (static ones can be called just by the plugin name, public ones just require an instance of the other plugin, default ones require you to be in the same package as the other plugin, protected ones require you to extend the other plugins, and private ones take some hacking/reflection). You can see the available plugin methods by dragging your class file into a test project in an IDE like Eclipse. Let me know the approach you're trying to take and I (or others on this list) can give you more directed advice. -Justin Senseney ________________________________________ From: João Silva [[hidden email]] Sent: Thursday, April 25, 2013 1:45 PM To: List IMAGEJ Subject: FW: Plugin Development Hello everyone! I am developing a plugin for ImageJ and I would like to know if anyone knows how to incorporate an already existent plugin inside my code, like using a method. Is that possible? Best wishes, João Silva -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by João Silva
On Apr 25, 2013, at 1:45 PM, João Silva wrote:
> Hello everyone! > > I am developing a plugin for ImageJ and I would like to know if anyone knows how to incorporate an already existent plugin inside my code, like using a method. Is that possible? What you can do is run the command or plugin with the recorder (Plugins>Macros>Record) running. This is the code generated by the recorder when I run the Gray Morphology plugin: IJ.run(imp, "Gray Morphology", "radius=2 type=circle operator=erode"); Use string concatenation to pass variables. For example, to pass the radius as a variable, use: int r = 3; IJ.run(imp, "Gray Morphology", "radius="+r+" type=circle operator=erode"); -wayne -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Wayne and Justin,
Thanks for all your support. For now I'll try first what Wayne suggested. If that doesn't work I'll try what you said Justin. Thank you very much! João Silva ________________________________________ De: ImageJ Interest Group [[hidden email]] em nome de Rasband, Wayne (NIH/NIMH) [E] [[hidden email]] Enviado: quinta-feira, 25 de Abril de 2013 23:40 Para: [hidden email] Assunto: Re: Plugin Development On Apr 25, 2013, at 1:45 PM, João Silva wrote: > Hello everyone! > > I am developing a plugin for ImageJ and I would like to know if anyone knows how to incorporate an already existent plugin inside my code, like using a method. Is that possible? What you can do is run the command or plugin with the recorder (Plugins>Macros>Record) running. This is the code generated by the recorder when I run the Gray Morphology plugin: IJ.run(imp, "Gray Morphology", "radius=2 type=circle operator=erode"); Use string concatenation to pass variables. For example, to pass the radius as a variable, use: int r = 3; IJ.run(imp, "Gray Morphology", "radius="+r+" type=circle operator=erode"); -wayne -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Wayne,
I have not tried your option since it isn't a valid one after all. The help you gave me it was to use a plugin in a Macro. I was trying to follow Justin's idea but I cannot procede, since I've already searched for the methods of the plug-in, but can't really understand how to use them... Best Regards, João Silva ________________________________________ De: ImageJ Interest Group [[hidden email]] em nome de João Silva [[hidden email]] Enviado: sexta-feira, 26 de Abril de 2013 13:26 Para: [hidden email] Assunto: Re: Plugin Development Dear Wayne and Justin, Thanks for all your support. For now I'll try first what Wayne suggested. If that doesn't work I'll try what you said Justin. Thank you very much! João Silva ________________________________________ De: ImageJ Interest Group [[hidden email]] em nome de Rasband, Wayne (NIH/NIMH) [E] [[hidden email]] Enviado: quinta-feira, 25 de Abril de 2013 23:40 Para: [hidden email] Assunto: Re: Plugin Development On Apr 25, 2013, at 1:45 PM, João Silva wrote: > Hello everyone! > > I am developing a plugin for ImageJ and I would like to know if anyone knows how to incorporate an already existent plugin inside my code, like using a method. Is that possible? What you can do is run the command or plugin with the recorder (Plugins>Macros>Record) running. This is the code generated by the recorder when I run the Gray Morphology plugin: IJ.run(imp, "Gray Morphology", "radius=2 type=circle operator=erode"); Use string concatenation to pass variables. For example, to pass the radius as a variable, use: int r = 3; IJ.run(imp, "Gray Morphology", "radius="+r+" type=circle operator=erode"); -wayne -- 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 |
Free forum by Nabble | Edit this page |