[Insight-users] how to use multithreading
Karthik Krishnan
karthik.krishnan at kitware.com
Sun Jul 10 23:42:34 EDT 2011
Take a look at the many imaging filters in ITK/BasicFilters that do
this. You should be looking for the methods ThreadedRequestData, which
is called once by each thread. If needed you may also need to override
the methods BeforeThreadedGenerateData and/or
AfterThreadedGenerateData which are called once by the main thread if
you need any setting up/ finalising as part of your filter.
-karhik
On 7/9/11, silentboom <mat_ri at ymail.com> wrote:
> Hello everyone!
>
> I want to use multi-threading for an complex method.
> In order to keep things simple the code below is reduced to a simple and
> minimal example.
>
> Lets consider the following code fragment:
>
> ...
> typedef itk::ImageRegionIterator< ImageType > IteratorType;
> IteratorType it(image,image->GetLargestPossibleRegion());
> while(!it.IsAtEnd())
> {
> it.Set(it.Get()+1);
> ++it;
> }
> ...
>
> One could split the entire region into several parts, and each is then
> processed by single thread.
> But I have no idea how to do this.
>
> Thanks for interest and any hints in advance.
>
> --
> View this message in context:
> http://itk-insight-users.2283740.n2.nabble.com/how-to-use-multithreading-tp6565802p6565802.html
> Sent from the ITK Insight 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