Efficient contour detection in binary and label images

Please use this identifier to cite or link to this publication: http://hdl.handle.net/1926/1352
ly in ITK, the only way to find the contour of the objects in a binary image is to use the BinaryErodeImageFilter, with a kernel of radius 1. This filter is a generic filter, made to support any shape and size of structuring element, and thus is not optimized for the particular case needed to detect the contours. Moreover, that filter is not multithreaded, so it can't get the performance improvements allowed by the multiprocessor systems. As a result, the contour detection can be quite time consuming currently -- for example, in SignedMaurerDistanceMapImageFilter, the contour detection takes about 33% of the execution time.
This contribution comes with a new filter which highly improve the performance of the contour detection in the binary image, and a second filter which allow the detection of the countours in label images with similar performance.
minus 2 Files (353Kb)
minus Automatic Testing Results by Insight-Journal Dashboard on Tue Aug 19 04:58:25 2008 for revision #2
starstarstarstarstar expertise: 5 sensitivity: 5
yellow This project passed all of its tests.
Click here for more details.

Go here to access the main testing dashboard.

minus Cutting off the crust---just like Mom used to do. by Nick Tustison on 2009-01-27 18:23:21 for revision #2
starstarstarstarstar expertise: 3 sensitivity: 5

Gaetan provides classes for a much more efficient method of extracting contours from labeled objects.  This is a vast improvement over my previous protocol of using various morphological operations to accomplish this task.




Gaetan provides a couple of sample images and corresponding results.

Open Science:

This contribution conforms in every way to the ideals of open science.


I downloaded the code.  I didn't try to reproduce the results or compile the executables as I had other immediate tasks to which I wanted to apply the filters.  I was able to compile the two filters within my own applications, though.  I did receive the following compilation warning

itkLabelContourImageFilter.txx:376: warning: unused variable ‘ee1’

which was easily fixed by commenting out that line.  My own results were as expected and were achieved much more quickly than with my previous method of using various binary morphological operations.

Quality of the data :

N/A as I did not use the data.


As Gaetan points out, an immediate application is in the signed Maurer distance transform in ITK.  

Add a new review
Quick Comments

Download All

Statistics more
Global rating: starstarstarstarstar
Review rating: starstarstarstarstar [review]
Code rating: starstarstarstarstar
Paper Quality: plus minus

Information more
Categories: Code speed optimization, Data Representation, Filtering, Image, Language binding, Mathematical Morphology, Programming
Keywords: border detection, binary image, label image, connected components
Toolkits: ITK
Export citation:


Linked Publications more
Reader/Writer for Analyze Object Maps for ITK Reader/Writer for Analyze Object Maps for ITK
by Hawley J., Johnson H.
Diffeomorphic Demons Using ITK's Finite Difference Solver Hierarchy Diffeomorphic Demons Using ITK's Finite Difference Solver Hierarchy
by Vercauteren T., Pennec X., Perchant A., Ayache N.

View license
Loading license...

Send a message to the author
ISSN 2327-770X
Powered by Midas