# integrating digital topology in image-processing libraries

Post on 05-Sep-2016

219 views

Embed Size (px)

TRANSCRIPT

computer methods and programs in b iomed ic ine 8 5 ( 2 0 0 7 ) 5158

journa l homepage: www. int l .e lsev ierhea l th .com/ journa ls /cmpb

Integr -

Julien LaIrcad, 1, Pla

a r t i c

Article histor

Received 14

Received in

28 August 2

Accepted 28

Keywords:

Digital topo

Image-proc

ITK

Code generi

to

al

, for

st i

e sa

rm

s as

ls o

ge-p

1. Introduction

Digital imathough sigtal images,account thaanymore buimages.

This dislevel, as moon an imaglogical levebase of topcontinuoustopologicalwhen appli

Algorithous, from c[1] or loop rical imagelibraries, ITduring the

Tel.: +33E-mail a

causes of course a loss of exibility, but also a loss of coher-

0169-2607/$doi:10.1016/ge processing is by nature a discrete process:nal processing algorithms can be applied to digi-they have to be adapted in some way to take intot the image they process is not a continuous signalt a set of pixels, or of voxels for three-dimensional

crete nature causes few problems at the geometricst of the geometric operations that can be appliede are independent of the underlying grid. At a topo-l, this is however different. The notion at the veryology, the neighborhood, is radically different fromspaces to discrete spaces. This leads to continuousalgorithms not respecting topological constraintsed on a digital grid.ms based on topological information are numer-onnected component labeling to skeletonizationemoval, all of which are used in the eld of med-processing [24]. In two major image-processingK [5] and Vigra [6], the type of neighborhood usedalgorithm is hard-coded in that algorithm. This

388 119 079; fax: +33 388 119 099.ddress: julien.lamy@ircad.u-strasbg.fr.

ence when processing both the foreground and the back-ground of a digital image, as it is a well-known fact thattwo different connectivities must be used for the backgroundand the foreground [7]. If this condition is not respected, theJordan theorem [8] will not hold and situations will arisewhere a closed curve does not partition the space in tworegions.

This rigid characteristic of those both major libraries isdue to the lack of pertinent data structures to correctly rep-resent the topology of digital images. In this paper, we showhow to integrate the digital topology information in an image-processing library in a way that is:

generic, with respect to both the image dimension and thedifferent types of neighborhood;

automated, in the sense that as few special case code aspossible has to be written;

fast, by pre-computing as many things as possible.

The language used in this paper is C++, as this work wasrealized within the ITK framework. However, the concepts

see front matter 2006 Elsevier Ireland Ltd. All rights reserved.j.cmpb.2006.08.006ating digital topology in image

my

ce de lHopital, 67091 Strasbourg Cedex, France

l e i n f o

y:

February 2006

revised form

006

August 2006

logy

essing library

city

a b s t r a c t

This paper describes a method

processing libraries. This addition

respecting topological constraints

digital topology is absent from mo

fullled. We describe and give cod

tion, and show a use case in the fo

lter can be up to a hundred time

dimension. This paper mainly dea

minor modications to other imaprocessing libraries

integrate digital topology informations in image-

information allows a library user to write algorithms

example, a seed ll or a skeletonization algorithm. As

mage-processing libraries, such constraints cannot be

mples for all the structures necessary for this integra-

of a homotopic thinning lter inside ITK. The obtained

fast as ITKs thinning lter and works for any image

f integration within ITK, but can be adapted with only

rocessing libraries.

2006 Elsevier Ireland Ltd. All rights reserved.

52 computer methods and programs in b iomed ic ine 8 5 ( 2 0 0 7 ) 5158

explained here could easily be adapted to other languages,and other image-processing libraries.

We willprocessingtopology, apresent thein an imageuse these stion algoritgiving lead

2. Pre

In this sectlack the neogy in the i

In ITK, talgorithmsneighborhoin two-dimit is not poground and

In Vigrathe Neighblimited toeight-connis not an etreated ascode everyby the num

The lackimage-proceven impoconstraints

3. Di

We will nothe notatioframeworkof the imagdecomposi

In this rrepresenterelations, ror voxels (c

3.1. Cel

Let us condened as

Ii is eithe k of the n

are of th

The dimz1 + 1[ ]z2,the image,

Cells in R2, with underlying digital grid andnates. Green: 0-cells (vertices); yellow: 1-cells (edges);-cells (faces). (For interpretation of the references toin this gure legend, the reader is referred to the

ersion of the article.)

ilarlrtexraph. 1 anng the hav

ll: vell: edlls: flls: s

willthethe

i if Iizi 1

Cells in R3. Green: 0-cells (vertices); yellow: 1-cells); blue: 2-cells (faces); red: 3-cells (solids). (Forretation of the references to colour in this gure, the reader is referred to the web version of the.)rst present the limitations of two major image-libraries, ITK and Vigra, with respect to digital

nd detail the theoretical background. We will thennecessary structures to integrate digital topology-processing library, and give an example on how totructures to implement a homotopic skeletoniza-hm. We conclude by summarizing our work and bys for future improvements.

vious work

ion, we show how both the ITK and Vigra librariescessary structures to correctly embed digital topol-mages and algorithms.here is no structure related to digital topology. Alluse a hard-coded neighborhood, usually the 18-od in three-dimensions, and the 4-neighborhoodensions. As these neighborhoods are hard-coded,ssible to use coherent connectivities for the back-the foreground.

, there is a basic support for digital topology, usingorhoodCirculator class. This class is howevertwo-dimensional images and treats the four- andectivity in a non-generic way. In our sense, thisasily maintainable solution: each connectivity isa special case. And as the developer has to hand-case, this multiplies the possible sources of errorsber of cases.of digital topology information in those twomajoressing libraries shows that it will be difcult, orssible, to write algorithms respecting topological.

gital topology basics

w recall the basics of digital topology, and presentns used in the rest of the article. To ensure that ourwill be generic with respect both to the dimensione and the type of neighborhood, we will use a celltion representation [9].epresentation, a binary image of any dimension isd as a set of cells, with well-dened neighboringather that just a set of pixels (cells of dimension 2)ells of dimension 3).

ls

sider images of dimension n. A k-cell of Rn [9] isa subset of Rn of the form c= I1 In such that:

r of the form ]zi, zi +1[ or the form {zi} (zi Z);sets Ii are of the form ]zi, zi +1[ and the other n k

e form {zi}.

ension of a k-cell is k. A n-cell has the form ]z1,z2 + 1[ ]zn, zn +1[, and is thus a pixel/voxel ofoccupying a unit area/volume.

Fig. 1coordiblue: 2colourweb v

Simis a ve

A gin Figs

Usithat w

0-ce 1-ce 2-ce 3-ce

Weused incell c iswhere

Ji = I Ji = ]

Fig. 2(edgesinterplegendarticley, a 0-cell has the form {z1} {z2} {zn}, andof a pixel/voxel, of coordinates (z1, z2, . . ., zn).ical denition of the cells of R2 and R3 is presentedd 2.e more usual vocabulary of modeling, we can seee the following equivalences, up to three-cells:

rtices;ges;aces;olids.

now dene the open star of a cell, which will bedenition of connectivity. The open star St(c) of a k-smallest open set containing c, i.e. St(c) = J1 Jn

= ]zi, zi +1[,, zi +1[ if Ii = {zi}.

computer methods and programs in b iomed ic ine 8 5 ( 2 0 0 7 ) 5158 53

Fig. 3 Open stars of 0-cell (vertex, left) and 1-cell (edge,right) in R2.

From this denition,we can see that the open star of a k-cellc contains the cell c as well as every -cell adjacent to c suchthat k R

2 can be s

3.2. Con

This cell dedenition arespect toneighborho

Let di becells (i.e. piexist a dj-ce

As shoneighborho1)-neighborlarly, in threto the 26-nto the 18-nlent to the

Using thent possiblcan also sedj coordinawhich diffedj)-neighbo

(di

dj

)2did

This resultbors in a la

Fig. 4 (2,0(right).

Table 1 Equivalences between connectivities expressedwith usua

Regular co

4, in two di8, in two di6, in three18, in three26, in three

Simtheo

m th

1 andkdsamd in

Jor

cont(i.e. non-overlapping) closed surface divides the spaceparts, the interior and the exterior. In a discrete space,ding on how the connectivities are chosen for the fore-and the background, this theorem can be invalidated.ple closed curved show in Fig. 5 intuitively divides the

in two parts. However, if the curve is (2, 0)-connectede background is also (2, 0)-connected, the backgroundore divided in two parts. In the opposite case, i.e. the (2,nectivity is used for the background and the foreground,ckground has two components, but the curve enclosingt closed anymore.as beenproven [10] that the (di, di 1)-connectivitymustd either for the foreground or the background. The (di,nectivity is usually chosen for the other connectivity.n. A graphical representation of the open stars ineen in Fig. 3.

nectivity

Recommended