Posted by
Gabriel Landini on
Jul 30, 2005; 9:58am
URL: http://imagej.273.s1.nabble.com/HELP-Plugin-and-Macro-Development-Question-tp3705130p3705131.html
On Friday 29 July 2005 22:08, Michael Miller wrote:
> I call the series of plugins I've written with the following command in
> macro:
> run("Compile and Run...", "compile="+pluginPath+"My_First_Plugin.java");
> run("Compile and Run...", "compile="+pluginPath+"My_Second_Plugin.java");
> .. etc..
You should not call the plugin for *compilation* each time. Once you have the
class file, call it by its name (or use the macro/plugin recorder to see how
to pass the parameters if the plugin has a dialog).
> Some of these plugins require several seconds of intensive CPU
> calculations. I've noticed that they tend to run without allowing the first
> to finish, and this generates the "locked" errors.
Sure these are separate threads, I guess that one compilation may not be
finieshed by the time the next one is called. Just call the class files, not
the "compile & run" command.
So: compile the plugin, restart IJ, now you can call the class by its name.
> Also, in some of my plug-ins (implements PlugInFilter) for example:
> // I use the NewImage static method to create a new ImagePlus
> // and I put image stuff in it
> beforethinImp.show();
> // I make a copy of the image
> afterthinImp.show();
> // and this is what behaves strangely
> IJ.run("Skeletonize");
> And sometimes the beforethinImp is the image that ImageJ performs the
> Binary->Skeletonize command on instead of the afterthinImp!
The plugInFilter, acts on the file that was selected when you called (and
locks it). Implement the procedure as a PlugIn instead and use
IJ.selectWindow("my_image") befor calling the next command.
> In addition, at the end of all this I perform:
> finalImp.show();
> IJ.save("/home/whatever/somefile.tif");
>
> And finalImp is not always saved, but instead some other previous images
> is saved.
Same reason, I guess.
I hope it helps
Gabriel