Details on calling a plugin from another one
Posted by
Pablo Manuel Jais on
Apr 10, 2008; 8:12pm
URL: http://imagej.273.s1.nabble.com/Details-on-calling-a-plugin-from-another-one-tp3696579.html
Hi, I have a question on the details of calling a plugin's method from
another plugin. I've read this post (
https://list.nih.gov/cgi-bin/wa?A2=ind0306&L=IMAGEJ&D=0&I=-3&P=31044 )
dated 27 Jun 2003 in which Adrian explained how to use a plugin from
another by means of its public methods (see code below).
I tried someting similar with the Object_Counter3D plugin (
http://rsb.info.nih.gov/ij/plugins/track/objects.html ), since it is
prepared to be used that way. However, I am forced to place the file
MyPlugin.java and Object_Counter3D.java in the same folder. Otherwise, the
compiler gives an error ("Class ReUsable not found") Is there a way to put
each plugin in a different folder? Is it necessary to import
Object_Counter3D in my plugin?
Thank you in advance for your answer,
Pablo
Adrian proposed the following plugin structure:
public class ReUsable implements PlugIn {
run() {
GenericDialog gd = new GenericDialog("...");
...
initThings();
setParams(p1,p2,...);
process();
}
public initThings() {...}
public setParams() {...}
public process() {...}
}
And the code to use it:
public class MyPlugin implements PlugIn {
ReUsable pi = new ReUsable();
pi.initThings();
pi.setParams(...);
pi.process(...);
}