[Insight-users] SignedMaurerDistanceMapImageFilter performance

Sergio Vera sergio.vera at alma3d.com
Mon Jul 2 09:31:19 EDT 2012


Hello Bill,
I did... that was my first check... I've rechecked it.. It compiles against
ITK built in Release Mode...


Best regards

On Mon, Jul 2, 2012 at 1:48 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> Make sure your ITK is built with Release and not Debug.
>
> On Mon, Jul 2, 2012 at 5:55 AM, Sergio Vera <sergio.vera at alma3d.com>wrote:
>
>> 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
>>
>> _____________________________________
>> 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
>>
>>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
>


-- 
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/1d4337b8/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/1d4337b8/attachment.png>


More information about the Insight-users mailing list