[Insight-users] Performance issues for single slices: Sigmoid
filter
Luis Ibanez
luis . ibanez at kitware . com
Fri, 20 Jun 2003 09:53:24 -0400
Hi Nils,
Thanks for reporting the new timings.
Considering your image size, 3 seconds for
running the GradientMagnitudeRecusiveGaussian
sounds like a reasonable timing.
I'm affraid that your measurement for the
Sigmoid image filter is incorrect. I just
tried the example in
Insight/Examples/SigmoidImageFilter.cxx
compiled in 'release' mode. Used as input
an image of 512x512 pixels and took 0.02
seconds. Note that this includes the time
for reading the input file and writing the
output file !
Since the Sigmoid is a pixel-wise filter,
its time is O(n) with n = number of pixels.
Henceforth,
your image should take only 0.155 seconds.
Actually much less since here I'm still
counting the read/write times.
These times are for a Pentium 4 - 2GHz
running windows XP.
Regards,
Luis
---------------------
Nils Hanssen wrote:
> Hi Luis,
>
>
> I am using Windows and all the measurements were done in 'release'.
>
> When I use the GradientMagnitudeRecursiveGaussianImageFilter, it takes only
> 3 seconds now (with a sigma of 1.0f) for the 1984x1024 slice in 2
> dimensions. That's fine.
>
> The Sigmoid on the same slice takes about 19 seconds. Isn't that far too
> slow? Maybe something is wrong with the pipeline?!
>
>
> Regards,
> Nils
>
>
>
>>Hi Nils,
>>
>>29 seconds for this image size seems to be pretty slow.
>>You can certainly get better timing.
>>
>>Note that the GradientMagnitude filters applies the
>>equivalent of convolution. Depending on the sigma
>>value, you may get better performance with the filter:
>>
>> GradientMagnitudeRecursiveGaussianImageFilter.
>>
>>http://www . itk . org/Insight/Doxygen/html/classitk_1_1GradientMa
>
> gnitudeRecursiveGaussianImageFilter.html
>
>>The RecursiveGaussian is better when using large sigma values.
>>
>>----
>>
>>Also, make sure that you compile your code for 'release'
>>(are your using Windows ? or Unix ?). On Unix you can select
>>this from CMake. On Window you simply select the build
>>configuration from VisualStudio IDE.
>>
>>-----
>>
>>ITK filters should only be profiled in 'release' since
>>in debug they are not taking advantage of the possibilities
>>for inlining templated code.
>>
>>----
>>
>>BTW for profiling code, ITK offers the convenience classes
>>
>>itk::TimeProbe and itk::TimeProbesCollector
>>
>>http://www . itk . org/Insight/Doxygen/html/classitk_1_1TimeProbe . html
>>http://www . itk . org/Insight/Doxygen/html/classitk_1_1TimeProbes
>
> CollectorBase.html
>
> They make very easy the task of computing time consumed
> by a block of lines of code. Time is reported in 'seconds'.
>
>
>
> Regards,
>
>
> Luis
>
>
> ----------------------
> Nils Hanssen wrote:
>
>>Hi Luis,
>>
>>thanks for the detailed answer. Sounds very plausible :)
>>
>>I changed the pipeline to use 2D-images and the calculation time for the
>>gradient magnitude reduced to 29 sec (before: 39 sec) for the 1984x1024
>>float image.
>>
>>Is that the typical computation time for images of that size?
>>
>>
>>Regards,
>>Nils
>>
>>
>
>
>
>