[ITK-users] multithreaded programming of itkScalarImageToHistogramGenerator

Bradley Lowekamp blowekamp at mail.nih.gov
Sat Jun 7 09:20:17 EDT 2014


Hello,

The ScalarImageToHistogramGenerator is derived from Object not a ProcessObject so it's actually not a filter per-se.

The ImageToHistogramFilter is the filter version of this algorithm which is multi-threaded on a per image basis. This improve performance with larger image. However this does not help much with improving doing a large number of images at the same time.

There many potential issue with getting good performance in converting so many images into histograms. Such as IO bottle necks. And depending on what you want to do with the histograms afterwards and how to efficiently would help guide the choice.

Here are some option that come to mind:

1) Just write a program which reads an image an writes a histogram to disk. Then just run this program concurrently on your OS to get multi-process parallelization.
2) You could use a multi-threading library such as OpenMP or Threading building blocks to parallelize a for loop so that you are running multiple Histogram Generators concurrently.
3) Use ITK's DomainThreader or MultiThreader to spawn some threads and divide up the work.



On Jun 7, 2014, at 4:28 AM, 冯婷婷 <fttfzzx227 at 126.com> wrote:

> Hi,
>      I used itkScalarImageToHistogramGenerator to calculate the histogram of about 8000 2D images .But the speed is very slow ,I learned that ITK can support multithreaded programming. Then I have three questions :1) Only filters that have the function ThreadedGenerateData() defined can support multithreaded programming? 2) If filters doesn't have this function,such as  itkScalarImageToHistogramGenerator,can I just write one for it ?3) If can't ,then what can I do to increase the speed of the calculation of the histograms of  a large number of  images?
> 
>      Any help would be appreciated ,thanks!
> 
> Best regards!
> 
> Tina
> 
> 
> 
> _____________________________________
> 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/20140607/8a3402dd/attachment.html>


More information about the Insight-users mailing list