<font><font face="verdana,sans-serif">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.<br>

</font></font><br><div class="gmail_quote">On Mon, Jul 2, 2012 at 5:38 PM, Sergio Vera <span dir="ltr">&lt;<a href="mailto:sergio.vera@alma3d.com" target="_blank">sergio.vera@alma3d.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello Bradley<div><br></div><div>Thanks for your script</div><div><br></div><div>I&#39;ve tried your script and the timings are coherent with yours (although my desktop is slower than your laptop :) )</div>
<div><br></div><div><div>The average time it took to execute SignedMaurerDistanceMap was 5.3353600223 seconds. </div><div>The average time it took to execute SignedMaurerDistanceMap was 6.62535580948 seconds. </div><div>



The average time it took to execute SignedMaurerDistanceMap was 6.90300935124 seconds. </div>
<div><br></div><div>I&#39;ve modified it to read my image (it&#39;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&#39;s ITK....</div>



<div><br></div><div><div>The average time it took to execute SignedMaurerDistanceMap was 8.87152283895 seconds. </div><div>The average time it took to execute SignedMaurerDistanceMap was 9.38857726434 seconds. </div><div>



The average time it took to execute SignedMaurerDistanceMap was 9.54250972999 seconds. </div></div><div><br></div><div>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&#39;m not sure why it tools so long to compute the distance map..</div>


<div><br></div><div>Thanks</div><div><div class="h5">
<br><div class="gmail_quote">On Mon, Jul 2, 2012 at 4:07 PM, Bradley Lowekamp <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hello Sergio,<br>
<br>
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.<br>





<br>
I wrote the following little SimpleITK python script, which uses the latest ITK 4.2rc04:<br>
<br>
import SimpleITK as sitk<br>
import os<br>
from timeit import Timer<br>
<br>
repeat = 10<br>
<br>
img = sitk.Image( [512,512,110], sitk.sitkUInt8 )<br>
img[255,255,55 ] = 1<br>
<br>
filter = sitk.SignedMaurerDistanceMapImageFilter()<br>
<br>
print &quot;Defaults:&quot;<br>
print filter<br>
<br>
t = Timer( lambda: filter.Execute( img ) )<br>
<br>
print &quot;The average time it took to execute&quot;, filter.GetName(), &quot;was&quot;,  min(t.repeat( repeat=repeat,number=1 )), &quot;seconds. &quot;<br>
<br>
filter.InsideIsPositiveOff()<br>
filter.SquaredDistanceOff()<br>
filter.UseImageSpacingOn();<br>
<br>
t = Timer( lambda: filter.Execute( img ) )<br>
<br>
print &quot;The average time it took to execute&quot;, filter.GetName(), &quot;was&quot;,  min(t.repeat( repeat=repeat,number=1 )), &quot;seconds. &quot;<br>
<br>
t = Timer( lambda: filter.Execute( ~img ) )<br>
<br>
print &quot;The average time it took to execute&quot;, filter.GetName(), &quot;was&quot;,  min(t.repeat( repeat=repeat,number=1 )), &quot;seconds. &quot;<br>
<br>
Your large image didn&#39;t come attached, so I just created a trivial on to run performance. This is my results in my i7 laptop:<br>
<br>
Defaults:<br>
itk::simple::SignedMaurerDistanceMapImageFilter<br>
  InsideIsPositive: 0<br>
  SquaredDistance: 1<br>
  UseImageSpacing: 0<br>
<br>
The average time it took to execute SignedMaurerDistanceMap was 2.05940294266 seconds.<br>
The average time it took to execute SignedMaurerDistanceMap was 2.61217999458 seconds.<br>
The average time it took to execute SignedMaurerDistanceMap was 2.7291328907 seconds.<br>
<br>
<br>
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&#39;s TuboBoost.<br>
<br>
Additionally, it&#39;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:<br>
<br>
The average time it took to execute SignedMaurerDistanceMap was 8.77108097076 seconds.<br>
The average time it took to execute SignedMaurerDistanceMap was 9.40146708488 seconds.<br>
The average time it took to execute SignedMaurerDistanceMap was 9.63690400124 seconds.<br>
<br>
I tend to agree with Bill, there is something funny about how you compiled it.<br>
<br>
Brad<br>
<br>
</div></div><div><div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><div class="im">-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. <a href="tel:%28%2B34%29%20932%20380%20592" value="+34932380592" target="_blank">(+34) 932 380 592</a><br>



 <a href="http://www.alma3d.com" target="_blank">www.alma3d.com</a><br>

</div></div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>