[Insight-users] itk::MultiThreader
Luis Ibanez
luis.ibanez at kitware.com
Mon Dec 13 11:01:00 EST 2010
Hi Murmur,
I see, that makes sense.
You may still be able to draw inspiration (e.g. copy and modify)
from the methods in itkImageSource.txx lines 229-256:
(summarized below:)
ImageSource< TOutputImage >::GenerateData()
{
this->AllocateOutputs();
this->BeforeThreadedGenerateData();
ThreadStruct str;
str.Filter = this;
this->GetMultiThreader()->SetNumberOfThreads( this->GetNumberOfThreads() );
this->GetMultiThreader()->SetSingleMethod(this->ThreaderCallback, &str);
this->GetMultiThreader()->SingleMethodExecute();
this->AfterThreadedGenerateData();
}
The "AfterThreadedGenerateData()" method is the
place where we usually harmonize or consolidate
the output computed by each one of the individual
threads.
You may want to follow a similar approach in your code.
Luis
---------------------------------------------
On Mon, Dec 13, 2010 at 10:03 AM, murmur <pneher at gmx.de> wrote:
>
> Hi Luis,
> thanks for your reply. The reason I don't use these methods is that I don't
> use an image to image filter which provides these methods.
>
>
>
> Luis Ibanez wrote:
>>
>> Hi Murmur,
>>
>> Any reason for not using the standard ITK methods:
>>
>> * BeforeThreadedGenerateData()
>> * ThreadedGenerateData()
>> * AfterThreadedGenerateData()
>>
>> ??
>>
>>
>>
>> You may find useful the following tutorials:
>>
>> http://www.na-mic.org/Wiki/images/b/bc/Insight-Writing-a-New-Filter.ppt
>> http://www.na-mic.org/Wiki/images/2/24/Insight-MultiThreading.ppt
>>
>>
>> Regards
>>
>>
>> Luis
>>
>
> --
> View this message in context: http://old.nabble.com/itk%3A%3AMultiThreader-tp30438781p30445994.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list