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

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Fri Aug 19 08:42:49 EDT 2011


Hi,

The current implementation of the binary dilation/erosion is highly  
dependent on the content of the image, so doing a direct comparison is  
not as simple as expected.
Also, for small kernels, the current implementation might be less  
efficient than the brute force implementation.

I already have a FFT based binary erosion/dilation ready and I think  
I'll reintroduce the brute force implementation in ITK while reviewing  
the morphology classes for ITK v4. As for grayscale operations, a meta  
class will be in charge of dispatching the processing to one algorithm  
or the other based on a few heuristics.
That way the user can almost always get the best of the implementation.

Regards,

Gaëtan


Le 17 août 11 à 05:26, Richard Beare a écrit :

> 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
>>
> _____________________________________
> 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

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://mima2.jouy.inra.fr  http://www.itk.org
http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110819/98f09665/attachment.pgp>


More information about the Insight-users mailing list