[Insight-users] An informal comparison between itk::BinaryDilateImageFilter and Matlab's imdilate()

Richard Beare richard.beare at gmail.com
Tue Aug 16 23:26:28 EDT 2011


Hi,

Can you post your desired test image somewhere?

There are a few other issues to clarify before you can really nail
down the best way to go. Notably, the precise choice of structuring
element shape and the range of sizes you are going to be interested
in.

There are a range of optimized ITK filters for specific shapes that
can be orders of magnitude faster than naive implementations,
especially for large structuring elements. In some cases you are
actually better off using the general purpose operations, rather than
the binary, because of these optimizations.

imdilate in matlab uses some of these - if, for example, you are
interested in a rectangular structuring element you'll see a big
speedup over the naive implementation, which may be what you are
getting at present.

2011/8/16 Bradley Lowekamp <blowekamp at mail.nih.gov>:
> Hello Casero,
>
>
> Thank you for the interesting study. I have just 2 comments. You didn't say what compiler you used. Certain optimizing compilers can produce code that is 10-20% faster then gcc and I have even seem upto 30% when targeted for your particular CPU. So I think the two versions are relatively close. Additionally, ITK is open source so if you see room for improvement in ITK's implementaion you are able to improve the performance ITK, or specialize the choices or assumptions is makes for your data.
>
> Brad
>
> On Aug 15, 2011, at 6:46 AM, Ramón Casero Cañas wrote:
>
>>
>> Hi all,
>>
>> After writing a program to run filters derived from
>> itk::ImageToImageFilter in Matlab [1], I though to make an informal
>> comparison between ITK and Matlab's 3D binary dilation.
>>
>> I run both on a 574x532x1024 uint8 binary image with 3.8% of voxels ==
>> 1, a couple of times, on linux 64-bit, with a 3-voxel radius.
>>
>>
>> itk::BinaryDilateImageFilter (from ITK v3.20) took between 87 and 88 sec.
>>
>> Matlab's imdilate()  (from Matlab R2010b) took between 76 and 79 sec.
>>
>>
>>
>> My program uses itk::ImportImageFilter to run the filter directly on the
>> Matlab buffer, and also uses a Matlab buffer for the filter output
>> (using mummification).
>>
>> The Matlab function invokes a MEX file, so in both cases we are running
>> C++ compiled code on the same data.
>>
>>
>> So, the conclusion of this informal comparison would be that Matlab's
>> implementation of binary dilation seems 12% faster than ITK's.
>>
>>
>>
>> [1]
>> http://code.google.com/p/gerardus/source/browse/tags/release-0.6.0/matlab/ItkToolbox/ItkImFilter.cpp
>>
>>
>>
>> Best regards,
>>
>> Ramon.
>>
>> --
>> Dr. Ramón Casero Cañas
>>
>> Computational Biology
>> Department of Computer Science
>> University of Oxford
>> Wolfson Building, Parks Rd
>> Oxford OX1 3QD
>>
>> tlf     +44 (0) 1865 610737
>> web     http://web.comlab.ox.ac.uk/people/Ramon.CaseroCanas
>> photos  http://www.flickr.com/photos/rcasero/
>> _____________________________________
>> 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.html
>>
>> 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
>
> _____________________________________
> 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.html
>
> 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
>


More information about the Insight-users mailing list