Elsevier

Computers & Graphics

Volume 25, Issue 3, June 2001, Pages 493-509
Computers & Graphics

Technical Section
A topology-based filling algorithm

https://doi.org/10.1016/S0097-8493(01)00071-1Get rights and content

Abstract

In this paper we present a fast-recursive fully automated topology-based algorithm for filling in the interiors of objects that appear in a binary image. The algorithm is based on two topological properties of the image contours: perimeter coincidence and interiority. Based on these parameters the algorithm performs a tree-structured region classification. The final filling is done according to the labels of the tree leaves. The algorithm is well suited to cases in which contours overlap and ambiguities may arise about which regions to fill. The algorithm has been tested with three-dimensional solid objects given by surface representations, both for simple man-made CAD objects and for complicated images taken from human computer tomographies. A table shows the execution times taken by the algorithm for several medical volume data sets.

Introduction

In this paper we present a topology-based algorithm for filling in the interiors of objects that appear in a binary image. The problem of filling regions is somehow classical in the image processing and computer graphics communities. There exist a number of excellent papers that deal with this topic in terms of, for instance, low computational complexity, or in dealing with gray-level and color images [1], [2], [3]. Our contribution lies in proposing a thorough topological analysis prior to the filling procedure to be able to face cases in which the decision about which areas in the image should be filled is not straightforward. Recall Fig. 1. In this figure we represent two binary images (the two top images); in both, four contours appear. Focusing on the one on the left, we may think that this image represents an object with two holes inside, one of each containing an inner structure. Simple filling [4] procedures that perform a raster scan (one line of which is superimposed in Fig. 1) with a flag change every time a contour is encountered would behave satisfactorily, leading to the filled image that we show in the bottom-left corner.

The top-right image shows a similar situation but, in this case, contours overlap. The reason why the cavities may collapse in a number of points is irrelevant for this paper, but the fact that they do it is crucial for simple filling algorithms that use the raster-scan and flag-change paradigm. The result of such algorithms usually depends on the pixel they start from; in our example we show the result starting from the upper leftmost corner (see bottom right image). A more involved example in which ambiguities may arise is shown in Fig. 6.

Images as the ones proposed, and others much more complicated, are frequently observed in a number of applications. For instance, focusing on three-dimensional applications, in [5] a three-dimensional pattern recognition system is described. The purpose is to search a database of CAD objects in order to find some specific designs. The solid representation in the database is one CAD well-known format, in which the triangle vertices of the surface representation are stored: the objects will be therefore represented as a triangle-facet mesh. In the paper, the authors use a floodfill procedure to convert the triangular mesh representation into a volume data representation; this latter representation is used to calculate a number of invariant features, which are eventually used for the database search. The authors exchange formats by first cutting the triangular mesh by a set of parallel planes (hereon, slices); therefore, every slice will consist of the set of boundaries from all the intersections of the triangular mesh and the cutting planes.

Medical imaging applications also share this problem. For instance, in [6] the authors describe an environment for volume data compression applied to medical data. In order to quantify the compression degradation that a particular isosurface [4] suffers, once again, a filling procedure is needed to convert the triangular mesh isosurface representation into a volume data representation. As before, the mesh is converted into a series of slices. Images as the ones shown in Fig. 1 are obtained. The outer boundaries in the images come from the outer surface boundaries, while the inner boundaries come from the cavities in the isosurface. As it can be inferred, due to the blobby shapes of the human structures, the boundary maps obtained are very complicated, so the filling procedure will be an issue.

Classical filling algorithms have been classified [4] as Flood filling and Boundary filling algorithms. The former refers to filling a region of pixels whose values are equal to the value of a seed pixel. The latter, refers to filling a region whose pixels have values different from a boundary value. An extension of the foregoing to color images is called Tint filling.

These classical approaches are typically user-guided: an interior or boundary pixel selection is made and then a recursive algorithm fills in that region. But, more importantly, those algorithms do not use any kind of information related to the nature of the boundaries. Therefore, these algorithms work satisfactorily with simple and well-defined contour maps. Hence, the challenge is to devise a fully automated algorithm that performs the filling task satisfactorily, regardless of the complexity of the topologies it works on.

The rest of the paper is structured as follows: in Section 2 a theoretical description of the algorithm is presented; prior to the algorithm details, several definitions are needed to formalize some important concepts. For the sake of clarity, the algorithm is explained by means of a simple phantom image. Two degenerated cases let us generalize the algorithm to more complex situations. In Section 3 we describe several implementation issues. Finally, we illustrate our algorithm's performance by means of several real-world volume data sets corresponding to a computer tomography (CT) available in the public domain. Execution times for these data have also been included.

Section snippets

Theoretical description

Assume we are given the image shown in Fig. 2. This image consists of a background on which two objects are superimposed. The object on the upper left corner has one hole. The one on the bottom right has two. Our purpose is to fill the object interiors, i.e., our goal is to end up having the image we show in Fig. 4. However, we may need to deal with Fig. 3, in which fairly the same situation is depicted but with contour overlap. This second image (Fig. 3) could be, for instance, the result of

Practical implementation notes

The algorithm starts with the following piece of code:

main( )
{
Original Image, dimensions [I×J×K]
 for each section
 {
Obtain thinned image [I×J]
S=1
Create mask image, dimensions  [(I+2)×(J+2)]
Initialize pixel mask −S
Recursive search in thinned image, write on mask:
Set background pixels to 0, including the IP of every object
process_object (null, null, S)
}
}

This piece of code defines the datasets that will be used in the algorithm, which are the original image, the thinned image and a mask image. The mask is enlarged with a

Experimental results

In this section we illustrate the performance of our algorithm both graphically, by means of two slices taken from a CT of a human skull available in the public domain [11], and numerically, by computing some execution times. Fig. 18 shows these data rendered by well-known methods [11], [12].

Fig. 19(a) shows one axial section from the volume data with a size of 256×256 pixels. A thinning procedure is run, the result of which is shown in Fig. 19(b); finally, Fig. 19(c) shows the original image

Conclusions and further work

In this paper we have proposed a novel fast-recursive algorithm for filling in object interiors. Our algorithm potential is based on the topological analysis that we make on the structures present in the image: we have defined a number of topological features that comprise important physical meaning and that give an enormous help to make the appropriate decisions about which structures to label, and therefore, which structures to be filled.

Even though the paper includes a high number of

Acknowledgements

The authors acknowledge the Spanish CICYT for research grants TIC97-0772 and 1FD97-0881-C02 and Junta de Castilla y León for research grant VA78/99. Dr. Alberola expresses his gratitude to Prof. G. Cybenko for his help with respect to the 3D CAD object-recognition system.

References (12)

  • K.P. Fish et al.

    A family of new algorithms for soft filling

    Computer Graphics

    (1984)
  • Levoy M. Computer assisted cartoon animation. MS. thesis, Cornell University, Ithaca, August...
  • A.R. Smith

    Tint filling

    Computer Graphics

    (1979)
  • J. Foley et al.

    Computer graphics, principles and practice

    (1996)
  • Cohen KD, Bhasin A, Cybenko G. Pattern recognition of 3D CAD objects International Journal of Smart Engineering Design...
  • Martı́n M, Martı́n MA, Alberola C, Ruiz J. A novel error criterion for multiresolution volume data compression....
There are more references available in the full text version of this article.

Cited by (8)

  • An improved method of rendering oil extraction contour under constrained conditions

    2011, Mining Science and Technology
    Citation Excerpt :

    In this paper, it uses “boundary point based tracing method” to fill the contour maps, and the topological relationship between contours and constraints can be stored in a binary tree structure. Such topologic structure can display the relationship of linking and closing between boundary lines and unclosed contours, the nesting among closed contours in the order of tree rings [14,15]. The “boundary point based tracing method” traces the contour lines starting from the boundary or constrained factors and completes contour topology construction until it returns to the starting point.

  • An efficient filling algorithm for counting regions

    2004, Computer Methods and Programs in Biomedicine
  • Boundary character based declining scanning-line filling algorithm

    2010, Proceedings of SPIE - The International Society for Optical Engineering
  • An isoline rendering method considering of constrained conditions

    2010, International Geoscience and Remote Sensing Symposium (IGARSS)
  • Voronoi-based topological contour filling approach for environmental impact assessment

    2009, Zhejiang Daxue Xuebao (Gongxue Ban)/Journal of Zhejiang University (Engineering Science)
View all citing articles on Scopus
View full text