Re: Call multithreaded plugin from another plugin

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Call-multithreaded-plugin-from-another-plugin-tp3691048p3691049.html

Hi Michael,

it seems that you are using global variables (class variables) that  
are not set if you don't call showDialog. E.g., getChunkRanges uses  
slicesPerChunk; but there are more.

Michael
________________________________________________________________

On 22 Sep 2009, at 11:33, Michael Doube wrote:

> Hi all
>
> I have a plugin that I've multithreaded (Purify) that I'd like to  
> call from another plugin.  I've already reduced the code in  
> Purify's run() method to a call to show a dialog ( showDialog() )  
> and a call to a method, purify(), that calls the rest of the plugin  
> using the variables returned by showDialog().  Purify works fine  
> when I run it directly from the Plugins menu, but when I call it  
> from another plugin, e.g.
>
> Purify p = new Purify();
> p.purify(important, variables).show(); //p.purify returns an ImagePlus
>
> It hangs in the middle of part of Purify that is multithreaded.  It  
> runs properly when I run it with only 1 chunk (i.e. not  
> multithreaded).
>
> The multithreading is done in a subclass, as in Bob Dougherty's  
> LocalThickness, and I wonder if there is something important that I  
> am missing when making the call to Purify's methods from another  
> class.
>
> The code is here:
> http://github.com/mdoube/BoneJ/blob/master/src/org/doube/bonej/ 
> Purify.java
>
> Cheers
>
> Mike