[Insight-users] Multitreading in ITK classes

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Oct 10 09:12:17 EDT 2012


Hello, 

If you want to implement a single threaded ImageFilter you over-ride the GenerateData() method, if you want to implement a multi-threaded filter you over-ride the ThreadedGenerateData() method and optionally the  BeforeThreadedGenerateData,() or the AfterThreadedGenerateData() methods. The ImageSource class over-rides the GenerateData() method to split the image and multi-thread the processing:

https://github.com/Kitware/ITK/blob/master/Modules/Core/Common/include/itkImageSource.hxx#L251

For multi-threaded filters this ThreadedGenerateData() methods should produce the output region that is passed as a parameter, which the single threaded GenerateData() method should produce the output image(s)' requested regions.

The general guideline is to file an image filter which does a similar operation and use it as a model for implementing your own filter.

Brad

On Oct 10, 2012, at 6:09 AM, Dženan Zukić <dzenanz at gmail.com> wrote:

> Take a look at these simple examples:
> http://www.itk.org/Wiki/ITK/Examples/Developer/MultiThreadedImageFilter
> http://www.itk.org/Wiki/ITK/Examples/Developer/OilPaintingImageFilter
> 
> 
> On Wed, Oct 10, 2012 at 7:40 AM, Ashwath Hegde, ERS-HCLTech <Ashwathh at hcl.com> wrote:
> Hi All,
> 
>  
> 
> I am new to ITK.I have written some image processing algorithms like binarization,contrast enchancement etc  in C.
> 
> I want to apply threading concept on the algorithms which I have written in C so that they execute faster.
> 
> So I wanted to know how multithreading is applied on various filters in ITK,so that I can apply the same concept on my C algorithms.
> 
> I debugged the example “FlipImageFilter.cxx” to see if it was multithreaded but could find out much.
> 
>  
> 
> Kindly help me in this.
> 
>  
> 
> Regards,
> 
> Ashwath
> 
>  
> 
>  
> 
> 
> 
> ::DISCLAIMER::
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
> E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, 
> lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents 
> (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. 
> Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the 
> views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, 
> distribution and / or publication of this message without the prior written consent of authorized representative of 
> HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. 
> Before opening any email and/or attachments, please check them for viruses and other defects.
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> 
> _____________________________________
> 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.php
> 
> 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
> 
> 
> _____________________________________
> 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.php
> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121010/0dbfc1d3/attachment.htm>


More information about the Insight-users mailing list