Hi, i'm starting with ImageJ. I have done a plugin and I'm creating other one. I want to call from second plugin to first one.
The first plugin is in the Plugins folder. When I do "IJ.run("plugin1");" the ImageJ shows me the next error message: "Unrecognized command: plugin1". How can I do to call my plugin from other one? Thanks, Gadea Sorry by my English. |
Hi Gadea,
The way to call a plugin from another one is exactly as you are doing: "IJ.run(<your_first_plugin>)". Please, check upper and lower case. Otherwise, check that the plugin you are trying to call is in the plugins menu, otherwise it might not been accessing the plugins folder properly. Also, if you are running it from any IDE like Netbeans or Eclipse, then you need to specify the path to the plugins folder in "plugins.dir" property like: public class Main { static { System.setProperty("plugins.dir", "/home/juanjo/Desktop/ImageJ/plugins"); } public static void main(String args[]) { new ImageJ(); String filename = "/Volumes/Data/jvega/Desktop/RobertoSpada/BL6_NKp461-32.tif"; IJ.open(filename); } } Please, not that this is only useful for debugging, saving time copying plugin to imagej folder and so on. Don't forget to remove that when development is completed. I hope those ideas will be useful. Sincerely, Juanjo. On May 30, 2011, at 1:56 PM, gadea wrote: > Hi, i'm starting with ImageJ. I have done a plugin and I'm creating other > one. I want to call from second plugin to first one. > > The first plugin is in the Plugins folder. > > When I do "IJ.run("plugin1");" the ImageJ shows me the next error message: > "Unrecognized command: plugin1". > > How can I do to call my plugin from other one? > > Thanks, > > Gadea > > Sorry by my English. > > -- > View this message in context: http://imagej.588099.n2.nabble.com/call-to-my-plugin-from-other-one-tp6418716p6418716.html > Sent from the ImageJ mailing list archive at Nabble.com. ------------------------------------------------------------ Juanjo Vega ([hidden email]) Unidad de Biocomputación. Laboratorio B-13. Centro Nacional de Biotecnología. CNB-CSIC. C\ Darwin, 3. Campus de Cantoblanco. Universidad Autónoma de Madrid. 28049, Madrid, Spain. http://www.cnb.csic.es http://www.biocomp.cnb.csic.es +34 91 585 4510 "Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes. |
In reply to this post by gadea
Hi Gadea,
'IJ.run("plugin1");' will only work if your plugin1 is installed such that it is visible in the menus of ImageJ (e.g. if it is in a .jar file with appropriate plugins.config). Plugin .class files with an underscore in the name get installed on startup if they reside in the plugins folder or a subfolder thereof; then the underscore becomes a blank in the menu. E.g., if you have plugin_1.class, you need IJ.run ("plugin 1"). What will always work is calling a public method of your plugin1 from another plugin (if the two plugins have different 'package' statements, you have to specify the full name including the package). Michael ________________________________________________________________ On 30 May 2011, at 13:56, gadea wrote: > Hi, i'm starting with ImageJ. I have done a plugin and I'm creating > other > one. I want to call from second plugin to first one. > > The first plugin is in the Plugins folder. > > When I do "IJ.run("plugin1");" the ImageJ shows me the next error > message: > "Unrecognized command: plugin1". > > How can I do to call my plugin from other one? > > Thanks, > > Gadea |
In reply to this post by gadea
If you are designing both plugins, remember that it's always good to stay object-oriented :-)! Example from imageJ's EDM class: private MaximumFinder maxFinder = new MaximumFinder(); //we use only one MaximumFinder (nice progress bar) |
In reply to this post by gadea
Hi!
I've tried these solutions, but nothing. The first plugin saves in the plugin folder in ImageJ. The second plugin is this: public class Plugin_2 implements PlugIn { public void run (String arg){ IJ.run("Plugin_1"); } } I've tried with only name the plugin, with the path, ... I haven't more ideas! I'm trying with threads ande the command syncronized but I don't get anything. Could be that I can't call a plugin with the command "run" if the plugin is saved in the plugin folder? thanks for advanced, Gadea M.M. |
Gadea,
I'm not sure if this will fix the problem at last, but according to the sample code you are showing, you are not doing what Michael said: "f you have plugin_1.class, you need IJ.run("plugin 1")." I mean, you must replace the underscore by a blank space, it is: IJ.run("Plugin 1"); And plugins must be stored at the plugins folder. If you can see them at the plugins menu, then they are installed correctly. In fact, you should check that to discard installation errors. If you can invoke them from the menu, then you must be able to do the same from a plugin. Sincerely, Juanjo. On Jun 1, 2011, at 1:29 PM, gadea wrote: > Hi! > > I've tried these solutions, but nothing. > > The first plugin saves in the plugin folder in ImageJ. The second plugin is > this: > > public class Plugin_2 implements PlugIn { > > public void run (String arg){ > > IJ.run("Plugin_1"); > > } > } > > I've tried with only name the plugin, with the path, ... I haven't more > ideas! > I'm trying with threads ande the command syncronized but I don't get > anything. > > Could be that I can't call a plugin with the command "run" if the plugin is > saved in the plugin folder? > > thanks for advanced, > > Gadea M.M. > > > > > > > > -- > View this message in context: http://imagej.588099.n2.nabble.com/call-to-my-plugin-from-other-one-tp6418716p6426501.html > Sent from the ImageJ mailing list archive at Nabble.com. ------------------------------------------------------------ Juanjo Vega ([hidden email]) Unidad de Biocomputación. Laboratorio B-13. Centro Nacional de Biotecnología. CNB-CSIC. C\ Darwin, 3. Campus de Cantoblanco. Universidad Autónoma de Madrid. 28049, Madrid, Spain. http://www.cnb.csic.es http://www.biocomp.cnb.csic.es +34 91 585 4510 "Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes. |
Free forum by Nabble | Edit this page |