Re: Call multithreaded plugin from another plugin

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

Michael, Wayne, Ignacio, Albert

I fixed my code with a combination of your suggestions, and following
the Fiji design guidelines,

http://pacific.mpi-cbg.de/wiki/index.php/PlugIn_Design_Guidelines

Mike

Michael Schmid wrote:

> 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
>>    


--
Dr Michael Doube  BPhil BVSc PhD MRCVS
Research Associate
Department of Bioengineering
Imperial College London
South Kensington Campus
London  SW7 2AZ
United Kingdom