[Insight-users] Histogram calculation performance between ScalarImageToHistogramGenerator, ImageToHistogramFilter and vtkImageAccumulate

Arikan Mustafa Mustafa.Arikan at fh-wels.at
Thu May 16 05:16:42 EDT 2013


Hello Bradley,

yes the Min and Max is set this way:

       typedef itk::Statistics::ImageToHistogramFilter< InputImageType > ImageToHistogramFilterType;

       ImageToHistogramFilterType::HistogramType::MeasurementVectorType lowerBound(numberOfBins);
       lowerBound.Fill(min);
       ImageToHistogramFilterType::HistogramType::MeasurementVectorType upperBound(numberOfBins);
       upperBound.Fill(max) ;
       ImageToHistogramFilterType::HistogramType::SizeType size(1);
       size.Fill(numberOfBins);

       ImageToHistogramFilterType::Pointer imageToHistogramFilter = ImageToHistogramFilterType::New();
       imageToHistogramFilter->SetInput(image);
       imageToHistogramFilter->SetHistogramBinMinimum(lowerBound);
       imageToHistogramFilter->SetHistogramBinMaximum(upperBound);
       imageToHistogramFilter->SetHistogramSize(size);

And i looked at the task manager, and all 4 threads seem to work.


Von: Bradley Lowekamp [mailto:blowekamp at mail.nih.gov]
Gesendet: Mittwoch, 15. Mai 2013 19:21
An: Arikan Mustafa
Cc: insight-users at itk.org Users
Betreff: Re: [Insight-users] Histogram calculation performance between ScalarImageToHistogramGenerator, ImageToHistogramFilter and vtkImageAccumulate

Hello,

Are you manually setting the MinMax for the ImageToHistogramFilter?

Have you looked at threading?

How do these methods scale as the number of threads increase? You can just set the environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS for ITK. I am wondering if there is a concurrency issue in
ITK.


Brad

On May 15, 2013, at 12:50 PM, Arikan Mustafa <Mustafa.Arikan at fh-wels.at<mailto:Mustafa.Arikan at fh-wels.at>> wrote:


Thanks for the quick response.

This is done in release mode. Like this:

       int nTimeStart = GetMilliCount();
       imageAccumulate->Update();
       int nTimeElapsed = GetMilliSpan( nTimeStart );
                …
       int nTimeStart2 = GetMilliCount();
       imageToHistogramFilter->Update();
       int nTimeElapsed2 = GetMilliSpan( nTimeStart2 );
                …
       int nTimeStart3 = GetMilliCount();
       scalarImageToHistogramGenerator->Compute();
       int nTimeElapsed3 = GetMilliSpan( nTimeStart3 );



Von: David Cole [mailto:dlrdave at aol.com<http://aol.com>]
Gesendet: Mittwoch, 15. Mai 2013 17:31
An: insight-users at itk.org<mailto:insight-users at itk.org>; Arikan Mustafa
Betreff: Re: [Insight-users] Histogram calculation performance between ScalarImageToHistogramGenerator, ImageToHistogramFilter and vtkImageAccumulate

Is this on Windows, with a Debug build using the Microsoft compiler?

If so, re-do the timings with a Release build.

The Debug memory allocator has serious performance issues because of the tracking of allocations that they do in the runtime. Release builds are frequently 100x faster in scenarios with lots of small allocations.

If this is not MS Debug build on Windows, then just delete this message... &#128522;


D


_____________________________________
Powered by www.kitware.com<http://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/20130516/2c737193/attachment-0001.htm>


More information about the Insight-users mailing list