[Insight-users] ITKImageRegionIterator with OpenMP

Vikash Gupta vikash.gupta at inria.fr
Thu Aug 23 12:03:37 EDT 2012


Hello Bradley, 
Thanks for the email, I particularly like the idea of parallelizing over the slices, in association with OpenMP. I think it might work. I looked into the ThreadGeneratedData and how to make itkImageFilters, but it looks complicated to me at the moment :( 


So, just posting it for a later date, no other reason. 


Thanks 
Vikash 

----- Original Message -----


From: "Bradley Lowekamp" <blowekamp at mail.nih.gov> 
To: "Vikash Gupta" <vikash.gupta at inria.fr> 
Cc: "itk" <insight-users at itk.org> 
Sent: Thursday, August 23, 2012 5:48:18 PM 
Subject: Re: [Insight-users] ITKImageRegionIterator with OpenMP 

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: 

<blockquote>


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 




</blockquote>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120823/775c02bb/attachment.htm>


More information about the Insight-users mailing list