[Insight-users] SignedMaurerDistanceMapImageFilter performance
Sergio Vera
sergio.vera at alma3d.com
Mon Jul 2 05:55:09 EDT 2012
Hello itkusers
I've having some performance issues related with the calculation of
distance maps through ITK's SignedMaurerDistanceMapImageFilter.
My execution times were a bit high so I've setup the following test:
a 512x512x110 binary image
Matlab's bwdist (uses Maurer method, but does not generates a signed map)
is the fastest one.
Matlab Code:
tic, d1 = bwdist(i); toc
Elapsed time is 2.415929 seconds.
tic, d2 = bwdist(~i); toc
Elapsed time is 2.509455 seconds.
The dmap is computed for the image and the negated image, to compensate
that bwdist does only "half" of the distance map. Total time is about 5
seconds.
Now, I load the same image in Mevislab Using ITK filters and compute the
signedMaurer distance with this pipeline:
[image: Inline image 1]
Mevislab Reports execution times in the range of 6.4 to 7.2
seconds which is comparable to Matlab's 5 seconds
However, my code runs in 15 seconds, (13 if I enable 2 threads into
SignedMaurer). I've checked that I use Release version of ITK (3.20)
C++ Code:
itk::TimeProbe timer;
timer.Start();
typedef itk::SignedMaurerDistanceMapImageFilter <seg::ITKImgLabelType,
F1d3ITKImgType> DistanceMapper;
DistanceMapper::Pointer distanceMapper = DistanceMapper::New();
distanceMapper->ReleaseDataFlagOn();
distanceMapper->SetUseImageSpacing(true);
distanceMapper->SetSquaredDistance(false);
distanceMapper->SetInsideIsPositive(false);
distanceMapper->SetInput(&a_segmentedImgIn);
distanceMapper->SetNumberOfThreads(2);
distanceMapper->Update();
timer.Stop();
SpyITK::OutputTimeToComplete(std::cout, __FUNCTION__, timer);
The image is already readed.
I've included the image that I use to benchmark the filter... It is strange
that I'm having such a different result between Mevislab and my Own ITK
code. The setup of the filter is similar (the only activated flag is the
UseImageSpacingFlag).
Perhaps is some flag that has to be used when compiling ITK? Any further
tips on how to speed the distance map calculation?
I can provide the file to used to test the performance if needed.
Thanks in advance
--
Sergio Vera
Alma IT Systems
C/ Vilana, 4B, 4º 1ª
08022 Barcelona
T. (+34) 932 380 592
www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120702/820abeec/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 48967 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120702/820abeec/attachment.png>
More information about the Insight-users
mailing list