[Insight-users] ITKImageRegionIterator with OpenMP

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Aug 23 11:48:18 EDT 2012


Hello,

OpenMP can't auto parallelize that type of loop.

Have you looked into the standard ITK image filter's ThreadedGenerateData methods? Is there any particular reason you are looking into this approach vs the the standard ITK one?

Here is the basic example of how to write a multi-threaded filter:

http://www.vtk.org/Wiki/ITK/Examples/Developer/MultiThreadedImageFilter


For your specific question, I would try creating a outter loop of an integer type to iterate over the slices in the image, which should able to be parallelized by OpenMP. Then create utilize a Slicer iterator.

Hope that works for you,
Brad

On Aug 23, 2012, at 6:25 AM, Vikash Gupta <vikash.gupta at inria.fr> wrote:

> Hello everyone, 
> 
> Is it possible to use itk::ImageRegionIterator with OpenMP for ITK 3.2 
> I want to have something like this
>  #pragma omp parallel for
> IteratorType it(Image, Image->GetLargestPossibleRegion() )
> for(it.GoToBegin(); !it.IsAtEnd(); ++it)
> {
> it->compute();
> }
> If not can anyone suggest a good alternative.
> Thanks
> Vikash
> _____________________________________
> 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/20120823/3818897d/attachment.htm>


More information about the Insight-users mailing list