[Insight-users] SignedMaurerDistanceMapImageFilter performance
Dženan Zukić
dzenanz at gmail.com
Mon Jul 2 11:46:27 EDT 2012
Maybe you are running the release version under debugger (F5 in VS). Try
running it without debugger (Ctrl+F5 in VisualStudio). It makes a slight
difference, but probably not enough to explain yours.
On Mon, Jul 2, 2012 at 5:38 PM, Sergio Vera <sergio.vera at alma3d.com> wrote:
> Hello Bradley
>
> Thanks for your script
>
> I've tried your script and the timings are coherent with yours (although
> my desktop is slower than your laptop :) )
>
> The average time it took to execute SignedMaurerDistanceMap was
> 5.3353600223 seconds.
> The average time it took to execute SignedMaurerDistanceMap was
> 6.62535580948 seconds.
> The average time it took to execute SignedMaurerDistanceMap was
> 6.90300935124 seconds.
>
> I've modified it to read my image (it's only 300k but it seems too big for
> the list) and the results are definitely lower than 13 seconds, closer to
> the 7 seconds from Mevislab's ITK....
>
> The average time it took to execute SignedMaurerDistanceMap was
> 8.87152283895 seconds.
> The average time it took to execute SignedMaurerDistanceMap was
> 9.38857726434 seconds.
> The average time it took to execute SignedMaurerDistanceMap was
> 9.54250972999 seconds.
>
> Indeed it is strange that my code runs slower :( My executable being
> compiled in release mode, compiler flags are /02 and Visual studio is
> clearly put in release. Also, when I launch the debug version the distance
> map time is 114 seconds. However I'm not sure why it tools so long to
> compute the distance map..
>
> Thanks
>
> On Mon, Jul 2, 2012 at 4:07 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:
>
>> Hello Sergio,
>>
>> But are you compiling your program also in release mode? The filter is
>> not part of the ITK code in the library, because it is a templated filter,
>> it will be compiled in your application, so that is where it matters if you
>> are in Release or debug mode.
>>
>> I wrote the following little SimpleITK python script, which uses the
>> latest ITK 4.2rc04:
>>
>> import SimpleITK as sitk
>> import os
>> from timeit import Timer
>>
>> repeat = 10
>>
>> img = sitk.Image( [512,512,110], sitk.sitkUInt8 )
>> img[255,255,55 ] = 1
>>
>> filter = sitk.SignedMaurerDistanceMapImageFilter()
>>
>> print "Defaults:"
>> print filter
>>
>> t = Timer( lambda: filter.Execute( img ) )
>>
>> print "The average time it took to execute", filter.GetName(), "was",
>> min(t.repeat( repeat=repeat,number=1 )), "seconds. "
>>
>> filter.InsideIsPositiveOff()
>> filter.SquaredDistanceOff()
>> filter.UseImageSpacingOn();
>>
>> t = Timer( lambda: filter.Execute( img ) )
>>
>> print "The average time it took to execute", filter.GetName(), "was",
>> min(t.repeat( repeat=repeat,number=1 )), "seconds. "
>>
>> t = Timer( lambda: filter.Execute( ~img ) )
>>
>> print "The average time it took to execute", filter.GetName(), "was",
>> min(t.repeat( repeat=repeat,number=1 )), "seconds. "
>>
>> Your large image didn't come attached, so I just created a trivial on to
>> run performance. This is my results in my i7 laptop:
>>
>> Defaults:
>> itk::simple::SignedMaurerDistanceMapImageFilter
>> InsideIsPositive: 0
>> SquaredDistance: 1
>> UseImageSpacing: 0
>>
>> The average time it took to execute SignedMaurerDistanceMap was
>> 2.05940294266 seconds.
>> The average time it took to execute SignedMaurerDistanceMap was
>> 2.61217999458 seconds.
>> The average time it took to execute SignedMaurerDistanceMap was
>> 2.7291328907 seconds.
>>
>>
>> As I was running this multiple times, I appear to be getting a variation
>> of ~.5 seconds due to what I am assuming is the temperature of my CPU, and
>> intel's TuboBoost.
>>
>> Additionally, it's not clear which timings are using only one thread and
>> which are using more. So I also ran the test with only one thread:
>>
>> The average time it took to execute SignedMaurerDistanceMap was
>> 8.77108097076 seconds.
>> The average time it took to execute SignedMaurerDistanceMap was
>> 9.40146708488 seconds.
>> The average time it took to execute SignedMaurerDistanceMap was
>> 9.63690400124 seconds.
>>
>> I tend to agree with Bill, there is something funny about how you
>> compiled it.
>>
>> Brad
>>
>> _____________________________________
>> 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
>>
>
>
>
> --
> Sergio Vera
>
> Alma IT Systems
> C/ Vilana, 4B, 4º 1ª
> 08022 Barcelona
> T. (+34) 932 380 592
> www.alma3d.com
>
> _____________________________________
> 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/20120702/f00cd865/attachment.htm>
More information about the Insight-users
mailing list