Anda di halaman 1dari 52

Active Contours

in Three Dimensions
Examensarbete utfrt i Bildbehandling
vid Linkpings Tekniska Hgskola
av
Jrgen Ahlberg
Reg nr: LiTH-ISY-EX-1708
iii
Active Contours
in Three Dimensions
Thesis project done at Computer Vision Laboratory,
Linkping University
by
Jrgen Ahlberg
Reg nr: LiTH-ISY-EX-1708
Examiner : Klas Nor dber g
Advisor : J ohan Wiklund
Comput er Vision Labor at or y
Linkping Univer sit y
S - 581 83 Linkping
Sweden
Linkping, September 1996
iv
Ready comprehension is often a knee-jerk response
and the most dangerous form of under st anding. It
blinks an opaque screen over your ability to learn.
Be warned. Understand nothing. All comprehension
is temporary. [8]
v
ABSTRACT
To nd a shape in an image, a t echnique called snakes or
active contours can be used. An act ive cont our is a cur ve
t hat moves t owar ds t he sought -for shape in a way cont r olled
by int er nal for ces - such as r igidit y and elast icit y - and an
image for ce. The image for ce should at t r act t he cont our t o
cer t ain feat ur es, such as edges, in t he image. This is done by
cr eat ing an at t r act or image, which denes how st r ongly
each point in t he image should at t r act t he cont our.
In t his t hesis t he ext ension t o cont our s (sur faces) in t hr ee
dimensional images is st udied. Met hods of r epr esent at ion of
t he cont our and comput at ion of t he int er nal for ces ar e
t r eat ed.
Also, a new way of cr eat ing t he at t r act or image, using t he
or ient at ion t ensor t o det ect planar st r uct ur e in 3D images,
is st udied. The new met hod is not gener ally super ior t o
t hose alr eady exist ing, but st ill has it s uses in specic appli-
cat ions.
Dur ing t he pr oject , it t ur ned out t hat t he main pr oblem of
act ive cont our s in 3D images was inst abilit y due t o st r ong
int er nal for ces over r iding t he inuence of t he at t r act or
image. The pr oblem was solved sat isfact or y by pr oject ing
t he elast icit y for ce on t he cont our s t angent plane, which
was appr oximat ed efcient ly using spher e-t t ing.
vii
CONTENTS
1. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Backgr ound 1
1.2 Pur pose 1
1.3 Limit at ions 1
1.4 Or der of Wor k 1
1.5 Out line 2
1.6 Acknowledgement s 2
2. ACTIVE CONTOUR BASICS . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 What is an Act ive Cont our ? 3
2.2 The Ener gy of t he Cont our 3
2.3 The Cont our-t t ing Pr ocess 4
3. THE ATTRACTOR IMAGE . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1 Limit at ions t o Ear lier Models 7
3.2 The Or ient at ion Tensor 7
3.3 At t r act ing t o Local Or ient at ion in 2D Images 8
3.4 At t r act ing t o Planar St r uct ur e in 3D Images 9
3.5 Cr eat ing t he At t r act or Image 10
4. REPRESENTATION IN THREE DIMENSIONS . . . . . . . . . 13
4.1 The 3D Cont our 13
4.2 The Ener gy of t he Cont our 13
4.3 Repr esent at ion 13
4.4 The Int er nal For ces Independent of Repr esent at ion 15
5. ROBUST CONTROL. . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1 The Pr oblem of Sensit ive Par amet er s 17
5.2 Out line of Solut ion 17
5.3 Reconst r uct ing a Cont our Using Basis Funct ions 18
5.4 Appr oximat ing t he Tangent Plane wit h Spher es 20
5.5 Cont r olling t he Cont our 21
6. EXPERIMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.1 The Act ive Cont our Model 23
6.2 Fit t ing Cont our s t o Synt het ic Shapes 23
6.3 Fit t ing Cont our s t o Medical Image Volumes 25
7. CONCLUSIONS & FUTURE WORK . . . . . . . . . . . . . . . . 29
7.1 The At t r act or Image 29
7.2 The Repr esent at ions 29
7.3 Cont r olling t he Cont our 29
7.4 Fur t her Suggest ions 30
REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
APPENDIX A: IMPLEMENTATION IN 2D . . . . . . . . . . . 33
APPENDIX B: IMPLEMENTATION IN 3D . . . . . . . . . . . 37
1
1
1INTRODUCTION
The project is here dened by giving scope and purpose. The out-
lines of the project and the thesis are also given.
1.1 BACKGROUND
In t he lat e eight ies it was suggest ed t hat it
should be possible t o follow edges in images by
suggest ing a cur ve (e.g., t he cir cumfer ence of an
object ) in an image, and t hen let t ing t he cur ve
it self move t o a suit able shape and posit ion. This
cur ve should have physical pr oper t ies like elas-
t icit y and r igidit y, and also be at t r act ed by edges
in t he image.
Such cur ves ar e called active contours, deform-
able models or snakes and have become popular
especially in medical image analysis.
For t he cont our t o be at t r act ed t o edges in t he
image an energy image or attractor image is cr e-
at ed, which has high values wher e t he or iginal
image has edges and low values ot her wise. The
at t r act or image gives t he cont our a pot ent ial
ener gy by summing t he ener gy in t he point s t he
cont our passes.
The cont our it self has an int er nal ener gy level
det er mined by it s shape (elast icit y and r igidit y)
and by minimizing t he t ot al ener gy one aims at a
smoot h cont our t hat follows t he or iginal images
edges well.
A nat ur al ext ension is t o segment t hr ee-
dimensional images using act ive cont our s, and in
sever al applicat ions sequences of t wo-dimen-
sional act ive cont our s ar e used (see e.g., [2] or
[7]). In some cases one has also allowed t he con-
t our sequence t o have elast icit y and r igidit y in
t he t hir d dimension.
1.2 PURPOSE
The pur pose of t his wor k is t o ext end t he t heor y
and met hods ment ioned above t o t cont our s t o
shapes in 3D images. This includes nding good
ways of r epr esent ing t he act ive cont our as well
as how t o it er at e and cont r ol t he cont our.
The second pur pose is t o examine how t he
at t r act or image can be cr eat ed using t he t ensor
r epr esent at ion of local or ient at ion developed at
Comput er Vision Labor at or y at Linkping Uni-
ver sit y.
The act ive cont our model should be imple-
ment ed in t he AVS
1
envir onment for easy use.
1.3 LIMITATIONS
The debat e on act ive cont our s most ly consid-
er s differ ent numer ical solut ions (e.g., using
nit e element met hods in t he it er at ion). That
is not at all t r eat ed in t his t hesis, since t hat
alone would be enough wor k for a t hesis in
numer ical analysis.
It is not necessar y t o give t he cont our t he
pr oper t ies elast icit y and r igidit y. Ot her possi-
bilit ies have not been examined in t his
pr oject .
1.4 ORDER OF WORK
The wor k has followed t he following st eps:
1. Lit er at ur e st udies.
Sear ching for and r eading what is wr it t en
about act ive cont our s. Appr oximat ely t went y
ar t icles wer e found, of which maybe half a
dozen war e dir ect ly used.
2. Implement at ion in 2D.
To incr ease t he under st anding of and give an
int uit ive feeling of act ive cont our s and t heir
behaviour in r ealit y, implement ing 2D act ive
cont our s in MATLAB was t he next st ep. This
1. Application Visualization S ystem fr om Advanced Vis-
ual S ystems, Inc.
2 CHAPTER 1: INTRODUCTION
Active Contours in Three Dimensions
also made it possible t o exper iment wit h dif-
fer ent numer ical solut ions, at t r act or images,
par amet er funct ions, et c.
3. Repr esent at ion.
Developing ways of r epr esent ing t he cont our
in 3D and implement ing t he r epr esent at ions
as classes in C++.
4. At t r act or image.
Finding out how a good at t r act or image can be
cr eat ed using t he above ment ioned t ensor-
r epr esent at ion and exper iment ing wit h differ -
ent lt er s in t he AVS envir onment .
5. Sensit ive par amet er s.
It was discover ed t hat t he cont our s ar e oft en
unst able and ver y sensit ive t o change of
par amet er s. This made it har d t o cont r ol t he
cont our, which made fur t her st udies neces-
sar y.
6. Implement at ion.
Implement ing t he algor it hms in C++, wor king
on t he pr eviously cr eat ed r epr esent at ion, and
incor por at ing t he code in AVS for visualiza-
t ion.
7. Exper iment s and evaluat ion.
Per for ming exper iment s wit h differ ent image
volumes, at t r act or images and r epr esent a-
t ions and evaluat ing t he r esult s.
1.5 OUTLINE
Chapt er 2, Act ive Cont our Basics descr ibes t he
exist ing t heor y of act ive cont our s in t wo dimen-
sions wit h some examples fr om t he exper iment s
per for med ear ly in t he pr oject .
Chapt er 3, The At t r act or Image descr ibes
how t he at t r act or image can be cr eat ed using
est imat es of local or ient at ion, t hus at t r act ing t he
cont our t o planar st r uct ur e in 3D images.
Chapt er 4, Repr esent at ion in Thr ee Dimen-
sions discusses t he basic ext ension of t he act ive
cont our model t o t hr ee dimensions and descr ibes
suggest ions of r epr esent at ion of t he cont our and
comput at ion of t he int er nal for ces.
Chapt er 5, Robust Cont r ol t r eat s t he pr ob-
lem of inst able cont our s, and gives suggest ions of
solut ions.
Chapt er 6, Exper iment s descr ibes t he exper -
iment s t hat wer e conduct ed and t heir r esult s.
Chapt er 7, Conclusions & Fut ur e Wor k con-
t ains, obviously, conclusions and some sugges-
t ions for fut ur e wor k and ext ensions of t he act ive
cont our model.
1.6 ACKNOWLEDGEMENTS
This pr oject was done at t he Comput er Vision
Labor at or y at t he Depar t ment of Elect r ical Engi-
neer ing at Linkping Univer sit y. The r esour ces
of t he neighbour ing Image Pr ocessing Labor a-
t or y have also been fr equent ly used.
Thanks goes t o Dr. Klas Nor dber g for int er est -
ing t heor et ical discussions and t o Licent iat e
J ohan Wiklund, r esear ch engineer, for helping
wit h pr act ical mat t er s, such as lear ning t he AVS
and GOP syst ems.
The pr oject is t he nal pr oject for a Mast er of
Science Degr ee fr om t he Comput er Science and
Engineer ing pr ogr am at Linkping Univer sit y
1
.
1. In swedish civilingenjr sexamen fr n ut bildnings-
pr ogr ammet fr Dat at eknik.
3
2
2ACTIVE CONTOUR BASICS
In this chapter some of the existing theory on active contours in
two dimensions is described. A three-step process of tting a con-
tour to an image is described and examples are given.
2.1 WHAT IS AN ACTIVE CONTOUR?
The concept of snakes was r st int r oduced in
1988 [9] and has lat er been developed by differ -
ent r esear cher s. The snake is t he simplest for m
of act ive cont our s and t he basic concept of t his
t hesis.
A snake is a cont our t hat can be descr ibed as a
funct ion wit h some boundar y con-
dit ions if r equir ed by t he sit uat ion. The cont our
is placed on an image , and it moves
t owar ds an opt imal posit ion and shape by mini-
mizing it s own ener gy.
Fit t ing act ive cont our s t o shapes in images is
an int er act ive pr ocess. The oper at or must sug-
gest an init ial cont our, which is quit e close t o t he
int ended shape. The cont our will t hen be
at t r act ed t o feat ur es in t he image ext r act ed by
cr eat ing an at t r act or image.
Open and closed contours
The cont our can be eit her a closed or an open
cur ve. If t he cont our is open, one should t ake
car e t o modify t he cont our s denit ion of it s
ener gy so t hat t he end-point s will not move in
t he same way as t he ot her point s (avoiding t he
cont our dr agging it self int o it self and vanishing).
Balloons
An ext ension of t he snake-concept called balloons
is descr ibed in [1]. The idea is t o add an inat ion
for ce t o a closed cont our t o make t he cont our
bypass ir r elevant element s in t he image. Using
t his inat ion for ce, t he cont our init ially sug-
gest ed no longer needs t o be in t he neighbour -
hood of t he opt imal solut ion. For example one
could place a small closed cont our somewher e in
t he middle of a shape t o which a cont our should
be t t ed, and t hen inat e t he cont our t o appr oxi-
mat ely t he desir ed size. A var iant of t his is
descr ibed in Chapt er 5, Robust Cont r ol.
2.2 THE ENERGY OF THE CONTOUR
The ener gy depends on t he shape of t he cont our
(int er nal ener gy) and on it s posit ioning on t he
image accor ding t o
(2.1)
These ener gies inuence all point s along t he
cont our wit h int er nal for ces and an image for ce.
When all for ces ar e balanced, t he t ot al ener gy is
at a minimum.
Internal energy
The int er nal ener gy of t he cont our depends on
t he shape of t he cont our and t he par amet er func-
t ions and and is dened as
(2.2)
The r st t er m, , will have lar ger values
if t her e is a lar ge gap bet ween successive point s
on t he cont our and minimizing it will minimize
t he t ot al lengt h of t he cont our
1
. The second t er m,
, will be lar ger wher e t he cont our is bend-
ing and r equir es t he cont our t o be as smoot h as
possible. These t er ms ar e weight ed by par amet er
funct ions, and so det er mines t he elasticity of
t he cont our, and det er mines t he rigidity. If
equals zer o at some point s t hen discont inui-
1. The equat ion (2.2) is a membrane equation known
fr om mechanics (see e.g., [11]) combined wit h a r igid-
it y-t er m.
v : 0 1 [ , ]
2

f :
2

E v f , ( ) E
e imag
v f , ( ) E
int
v ( ) + =
s ( ) s ( )
E
int
s ( ) v' s ( )
2
s ( ) v'' s ( )
2
+ ( ) s d

=
v' s ( )
2
v'' s ( )
2
s ( )
s ( )
s ( )
4 CHAPTER 2: ACTIVE CONTOUR BASICS
Active Contours in Three Dimensions
t ies ar e allowed t her e, and wher e equals
zer o, discont inuous cur vat ur e such as cor ner s ar e
allowed.
To simplify, t he par amet er-funct ions will
hencefor t h be r egar ded as const ant s.
Image energy
The image ener gy depends on how t he cont our is
posit ioned on an attractor image p, and it is
dened as
(2.3)
wher e [9] uses an at t r act or image given by
(2.4)
This at t r act or image makes t he cont our
at t r act t o edges in t he or iginal image.
Minimizing the energy
Minimizing t he ener gy (2.1) is equivalent t o solv-
ing t he cor r esponding Euler-Lagr ange-equat ion
(2.5)
which simply means t hat t he int er nal for ces
shall balance t he image for ce
.
In pr act ice one does not st udy t he cont our at
all point s. Inst ead, t he cont our is r epr esent ed by
a vect or of cont r ol point s v
j
. The cont r ol point s
must not be separ at ed by mor e t han a few pixels
t o pr event t he cont our fr om bypassing at t r act ive
but small ar eas in t he image. It is t he pur pose of
t he elast icit y for ce t o keep t he cont r ol point s
equidist ant .
In t he cont r ol point s v
j
t he der ivat ives in (2.5)
can be appr oximat ed by nit e differ ences [5],
which gives
(2.6)
(2.7)
Using t hese expr essions (2.5) can be wr it t en as
(2.8)
wher e A is t he mat r ix given by (2.6) and (2.7) and
inser t ion of and . A cont our can t hen be cal-
culat ed wit h it er at ions accor ding t o Euler s
met hod [5] as
(2.9)
wher e is t he set of or iginally suggest ed cont r ol
point s.
One it er at ion makes each cont r ol point move
so far in t he dir ect ion of t he image for ce t hat it is
balanced by t he r esult ing int er nal for ces.
Since I + A is pent adiagonal it is possible t o
solve t he syst em (2.9) in O(n)-t ime.
2.3 THE CONTOUR-FITTING PROCESS
To nd a suit ably shaped and posit ioned cont our
t hr ee main st eps ar e execut ed. As an example,
t he pict ur e in Figur e 2.1 is used, and a det ailed
descr ipt ion of how t he example is const r uct ed
can be found in Appendix A, Implement at ion in
2D.
Fi gur e 2.1: The original image, , and
the initial suggestions of control points (the
white crosses).
Step 1: Suggesting an initial contour
To make t he cont our at t r act t o t he shape in t he
image t o which one want s t o t t he cont our, an
init ial suggest ion should be given. As will be dis-
cussed in Sect ion 4.3, Repr esent at ion, t his can
also include det er mining t he r epr esent at ion of
t he cont our. When segment ing a 2D image, t he
r epr esent at ion is st r aight for war d; a vect or of
cont r ol point s.
In t he example in Figur e 2.1, t wo closed con-
t our s ar e suggest ed, wit h four cont r ol point s
each. Mor e cont r ol point s ar e cr eat ed aut omat i-
cally.
Step 2: Calculating the attractor image
The or iginal image has t o be lt er ed t o cr eat e t he
at t r act or image accor ding t o (2.4). The at t r act or
image is t hen pr efer ably lt er ed wit h gr adient
lt er s t o cr eat e t he image for ce .
The image fr om Figur e 2.1 is lt er ed wit h t wo
edge det ect ing lt er s (det ect ing edges in
differ ent dir ect ions) and in t wo scales. The
s ( )
E
e imag
p v s ( ) f , ( ) s d

=
p x f , ( ) f x ( )
2
=
v'' v
4 ( )
p v f , ( ) =
v'' v
4 ( )

p v f , ( )
v
v
j
'' v
j 1
2v
j
v
j 1 +
+
v
j
4 ( )
v
j 2
4v
j 1
6v
j
4v
j 1 +
v
j 2 +
+ +
Av p v f , ( ) + 0 =

I A + ( )v
k 1 +
v
k
p v
k
f , ( ) + =
v
0
f x ( )
p
3 3
2.3 THE CONTOUR-FITTING PROCESS 5
Computer Vision Laboratory, Linkping University
r esult s ar e added, nor malized, and squar ed,
r esult ing in t he at t r act or image in Figur e 2.2.
Fi gur e 2.2: The attractor image .
The pr ocess of cr eat ing t he at t r act or image
will be consider ed in Chapt er 3, The At t r act or
Image.
Step 3: Iterate
The suggest ed cont our is it er at ed accor ding t o
(2.9). The it er at ion will pr oceed unt il it event u-
ally gives a st able cont our or unt il t he user int er -
r upt s t he it er at ion.
In Figur e 2.3, t he t wo cont our s ar e shown aft er
50 it er at ions.
Fi gur e 2.3: The two contours after 50
iterations.
Anot her example can be seen in Figur e 2.4
wher e an open cont our wit h xed end-point s is
used t o give a smoot h segment at ion of t he image
int o t wo ar eas.
Fi gur e 2.4: Using an open contour to
follow an edge.
f x ( )
2
7
3
3THE ATTRACTOR IMAGE
The attractor image has been calculated in approximately the
same way in most applications. S ince that model has some limita-
tions, especially in 3D, some improvements based on orientation
estimates are suggested here.
3.1 LIMITATIONS TO EARLIER MODELS
As ment ioned in Chapt er 2, t he or iginal at t r act or
image in [9] was given by
(3.1)
and t he image for ce on t he cont our v in a point
is given by . This at t r act or
image has some limit at ions:
It is only sensit ive t o edges, not t o lines. That
implies t hat t he cont our will be at t r act ed t o
point s on eit her side of a line. This is not
always a pr oblem, but in some applicat ions it
cer t ainly is.
In 3D, it is sensit ive t o lines as well as t o
planes. When t r ying t o segment a volume in a
3D image, we ar e pr obably not int er est ed in
at t r act ing t he cont our t o linear st r uct ur es in
t he image but want t he volume t o be bounded
by planar st r uct ur es.
The r st pr oblem is quit e easily solved by t aking
t he magnit ude of an or ient at ion est imat e on t he
or iginal image. This met hod is descr ibed in Sec-
t ion 3.3 below.
To solve t he second pr oblem it is suit able t o
cr eat e a local est imat e of t he pr obabilit y of linear
and planar st r uct ur es, which is t r eat ed in Sec-
t ion 3.4.
3.2 THE ORIENTATION TENSOR
The t heor y of or ient at ion t ensor s is descr ibed in
det ail in [6]. Only an infor mal explanat ion neces-
sar y for under st anding t he r est of t he chapt er
will be given her e.
A neighbour hood in an image (an n-dimen-
sional signal) can be descr ibed wit h vect or s
point ing in t he dir ect ions of signal var iat ion. On
an edge or a line t hat vect or should be t he edge/
line nor mal. If t he signal wit hin t he neighbour -
hood var ies in mor e t han one dir ect ion, e.g on a
cr ossing of lines, sever al vect or s might be
needed.
However, a simple neighbour hood (var ying in
one dir ect ion only) can be expr essed as
1
(3.2)
wher e
2
is a vect or point ing in t he dir ect ion of
signal var iat ion. Not e t hat but
.
For simple signals we can expr ess t he local or i-
ent at ion wit h a t ensor
3
(3.3)
The t ensor T will have t he nor m , one
non-zer o eigenvalue k and t he cor r esponding
eigenvect or . To t his t ensor we can add anot her
t ensor T
2
, descr ibing anot her simple signal wit h
t he or ient at ion . The r esult ing t ensor will
have t wo eigenvect or s point ing in t he t wo
(or t hogonal) dir ect ions in which t he signal var -
ies, and t he cor r esponding eigenvalues t ell t he
magnit ude of t he var iat ion. The signal is st ill
1. This can also be wr it t en as or
.
2. denot es t he nor malized vect or s, i.e., .
3. The t ensor can be r epr esent ed by a mat r ix ever y-
wher e in t his t hesis, and no special t ensor t heor y is
needed her e. I will for t he sake of consist ency wit h
ot her t ext s st ill call it a t ensor .
p x f , ( ) f x ( )
2
=
s 0 1 , [ ] p v s ( ) f , ( )
f x ( ) g x s ( ) =
f x ( ) g x s ( , ) ( ) cos ( ) =
f x ( ) g x
T
s ( ) =
s
s s s s =
f :
n

g :
T k ss
T
=
T k =
s
r s
8 CHAPTER 3: THE ATTRACTOR IMAGE
Active Contours in Three Dimensions
const ant in all dir ect ions or t hogonal t o t he space
spanned by t he eigenvect or s (or, equally, by
and ).
Similar ly, we can add any number of simple
signals t o t he or iginal one, building any signal,
and t he eigenvect or cor r esponding t o t he lar gest
eigenvalue will always point in t he dir ect ion of
t he dominant or ient at ion of t he signal. If only
one eigenvect or exist s, t he signal var ies in one
dir ect ion and is a simple signal.
3.3 ATTRACTING TO LOCAL ORIENTATION
IN 2D IMAGES
In t wo dimensions t he local or ient at ion can also
be descr ibed as an or ient at ion vect or [6]
, (3.4)
This vect or has t he same nor m as t he or ient at ion
t ensor T and is consequent ly a measur e of t he
magnit ude of t he local or ient at ion, or t he cer -
t aint y t hat t he neighbour hood is dominat ed by
or ient ed st r uct ur e. Not e t hat t he vect or z does
not point in t he same dir ect ion as t he dominant
or ient at ion of t he neighbour hood, but uses a dou-
ble-angle r epr esent at ion. This makes
and be r epr e-
sent ed by t he same or ient at ion vect or.
By lt er ing an image wit h edge and line det ec-
t or s in four dir ect ions, it is possible t o est imat e
t he or ient at ion vect or as follows:
If t he convolut ion ker nel q
line
(x) is a hor izont al
line det ect ing lt er ker nel and q
edge
(x) is a hor i-
zont al edge det ect ing lt er ker nel, t hen
1
(3.5)
is an est imat e of t he dominance of local hor izon-
t al or ient at ion in t he image f. Combining q
1
wit h
a ver t ical est imat e q
3
, one can get a mor e
secur e est imat e in , since ver t ical and hor -
izont al or ient at ion ar e r egar ded as opposit es.
This is an est imat e of t he local one-dimensional-
it y of t he neighbour hood, i.e., t hat t he neighbour -
hood cont ains st r uct ur e or ient ed hor izont ally
only (a negat ive value means t hat t he neighbour -
1. denot es t he funct ion t hat is t he r esult of
convolving f(x) wit h g(x).
hood is dominat ed by ver t ical st r uct ur e). Using
q
1
, q
3
and t heir r ot at ions by q
2
and q
4
t he
or ient at ion vect or can be cr eat ed as
(3.6)
An est imat e of t he local magnit ude of or ient a-
t ion can be calculat ed as t he nor m of z, which
equals
(3.7)
Using t his nor m
(3.8)
as t he at t r act or image will cause t he cont our t o
be at t r act ed t o or ient ed st r uct ur e invar iant ly t o
phase, i.e., t o lines as well as t o edges.
As showed in [6] it is not r eally necessar y wit h
four complex
2
lt er s; in t wo dimensions it is
quit e enough using t hr ee lt er s
3
det ect ing lines/
s
r
z k
s
1
2
s
2
2

2s
1
s
2
= s
s
1
s
2
=
f
1
x ( ) g x
T
s ( ) = f
2
x ( ) g x
T
s ( ) =
f
*
g ( ) x ( )
q
1
x f , ( ) f
*
q
line
( ) x ( )
i f
*
q
edge
( ) x ( ) +
=
q
1
q
3

4
z
q
1
q
3

q
2
q
4

=
z
2
q
k
2
k 1 =
4

2 q
1
q
3
q
2
q
4
+ ( ) =
p x f , ( ) z x f , ( )
2
=
Fi gur e 3.1: The original image (top); the
attractor image computed with the
gradient method (middle); estimate of
magnitude of local orientation (bottom).
3.4 ATTRACTING TO PLANAR STRUCTURE IN 3D IMAGES 9
Computer Vision Laboratory, Linkping University
edges in dir ect ions separ at ed by . The nor m
can t hen be calculat ed as
(3.9)
What is impor t ant in or der t o get a good est i-
mat e, t hough, is t hat t he lt er s t oget her cover all
dir ect ions.
In Figur e 3.1 an image is lt er ed wit h t he gr a-
dient met hod and t he or ient at ion met hod. Bot h
met hods uses four lt er s (line det ect ing
and line/edge det ect ing r espect ively) applied in
t wo scales. The gr adient met hod is t he same as
in t he example in Sect ion 2.3 and accor ding t o
(3.1). The or ient at ion met hod is used accor ding
t o (3.7) and (3.8).
3.4 ATTRACTING TO PLANAR STRUCTURE
IN 3D IMAGES
As descr ibed in [6] one can weight t he line/edge
lt er s ment ioned above and est imat e t he or ient a-
t ion t ensor T, whose eigensyst em descr ibes t he
local var iat ion of t he signal (or t he local ener gy
dist r ibut ion in t he Four ier domain) and t her efor e
also t he or ient at ion.
Calling Ts eigenvalues
1
,
2
and
3
, wher e

1

2

3
, and t he cor r esponding eigenvect or s
e
1
, e
2
and e
3
, t her e ar e (in 3D) t hr ee char act er is-
t ic cases:
Plane case:
1
>>
2

3
0
The signal var ies mainly in one dir ect ion, e
1
,
i.e t he spat ial neighbour hood descr ibes a pla-
nar st r uct ur e, wit h e
1
as nor mal vect or (t he
plane is spanned by e
2
and e
3
). The ener gy in
t he Four ier domain is mainly dist r ibut ed
along a line in t he dir ect ion of e
1
.
Line case:
1

2
>>
3
0
The ener gy in t he Four ier domain is dist r ib-
ut ed on a plane spanned by e
1
and e
2
. The
spat ial neighbour hood is (near ly) const ant in
t he same dir ect ion and descr ibes a linear
st r uct ur e along e
3
.
2. Or eight r eal filt er s.
3. Act ually, any number (equal or gr eat er t han t hr ee) of
filt er s can be used. The est imat ion will be mor e se-
cur e t he lar ger t he number and t he smaller t he r adial
bandwidt h of t he filt er s. This decr ease of bandwidt h
will however incr ease t he spat ial size of t he filt er s,
making t he or ient at ion est imat e less local.
Isot r opic case:
1

2

3
The neighbour hood has no or ient at ion, i.e it
var ies equally in all dir ect ions.
Using a certainty estimate as attractor
In 3D, a signal cont aining planar st r uct ur e is a
simple signal. Thus, an est imat e of planar st r uc-
t ur e is
, (3.10)
i.e how much t he or ient at ion t ensor differ s fr om
t he t ensor cor r esponding t o a simple signal in t he
dir ect ion of dominant or ient at ion.
The spect r um t heor em st at es t hat
(3.11)
and since t he nor m can be cal-
culat ed as
(3.12)
will be close t o zer o in t he pr esence of
planar st r uct ur e, and comput at ion of (3.12) in
each point in t he image cr eat es an at t r act or
image t hat will at t r act t he cont our t o planar
st r uct ur es in t he image.
will also be close t o zer o when all eigen-
values ar e small. Consequent ly is ver y sen-
sit ive t o noise on low-ener gy par t s of t he image,
and t her efor e a division by
1
is suit able. The
at t r act or image can t hen be expr essed as
(3.13)
wher e
, (3.14)
3
z
2
q
k
2
k 1 =
3

q
1
q
2
q
1
q
3
q
2
q
3
+ + =
3 3



T ( ) T T
1
= T
1

1
e
1
e
1
T
=
T
1
e
1
e
1
T

2
e
2
e
2
T

3
e
3
e
3
T
+ + =
e
2
e
2
T
e
3
e
3
T
T ( )
T ( ) T T
1

2
e
2
e
2
T

3
e
3
e
3
T
+ = =

2
2

3
2
+ =
T ( )
Or ient at ion
Noisy backgr ound
No
or ient at ion
Fi gur e 3.2: Histogram of an attractor
image.
T ( )
T ( )
p

x f , ( )

eigenvalues T x f , ( ) ( ) ( ) =

( )

2
2

3
2
+

1
--------------------- =

:
3

10 CHAPTER 3: THE ATTRACTOR IMAGE
Active Contours in Three Dimensions
If t he at t r act or image is calculat ed accor ding
t o (3.13), t he t ypical hist ogr am look like Figur e
3.2. Pixels wit hin isot r opic neighbour hoods will
have lower values t han t he or ient ed pixels, but
pixels wit hin isot r opic neighbour hoods domi-
nat ed by noise (e.g., noise added t o a black back-
gr ound) will have higher values (see Figur e 3.2),
i.e close t o t he or ient ed pixels.
Another certainty estimate
The int er est ing case of t he cases ment ioned
above is t he plane case, i.e., when
1
>>
2

3
.
Thus, t he quot a
(3.15)
is a cer t aint y est imat e of planar st r uct ur e, which
var ies bet ween one and one t hir d. As wit h t he
r st cer t aint y est imat e when all t he eigenvalues
ar e small, t he quot a (3.15) will be quit e r andom.
It is t her efor e suit able t o mult iply t he quot a wit h

1
t o r educe t he sensit ivit y t o noise.
The at t r act or image used will consequent ly be
expr essed as
(3.16)
wher e
, (3.17)
A t ypical hist ogr am of t he at t r act or image
comput ed accor ding t o (3.16) will look like Figur e
3.3. The or ient ed and isot r opic ar eas seems not
t o be as well separ at ed as wit h (3.13), but t his
met hod is not as sensit ive t o noise. The choice of
met hod should t her efor e depend on how noisy
t he image is ar ound t he object one wishes t o seg-
ment .
3.5 CREATING THE ATTRACTOR IMAGE
As indicat ed above, sever al st eps ar e r equir ed t o
cr eat e t he at t r act or image and t he r esult ing
image for ce. The sequence of t hese st eps is illus-
t r at ed in Figur e 3.4 and descr ibed below (a 3D-
image is assumed).
1. Tensor lt er ing
Filt er t he image wit h at least six edge/line-
det ect or s and cr eat e t he or ient at ion t ensor
accor ding t o Sect ion 3.4.
2. Aver aging
The t ensor eld usually needs some aver aging
(low-pass-lt er ing) t o r educe r andomness of
t he or ient at ion caused by noise. An or dinar y
or gaussian ker nel is used.
3. Comput ing eigenvalues
Comput e t he eigenvalues of t he t ensor eld
and sor t t hem in decr easing or der.
4. Det ect ing planar st r uct ur e
Comput e t he ener gy accor ding t o equat ion
(3.16) or (3.13).
5. Thr esholding
The par t s of t he or iginal image wit hout domi-
nant local or ient at ion, e.g black backgr ound,
will (especially in t he pr esence of noise) con-
t r ibut e t o t he calculat ed at t r act or, however
wit h quit e low values. It is, t hough, pr efer able
t o set all t hese point s t o zer o. This will
st r aight en out t he cont our wher e cr ossing
such r egions, since t he cont our will t her e only
be under t he inuence of t he int er nal for ces
(elast icit y and r igidit y).
The t ypical hist ogr am (see Figur e 3.3) is
mainly divided int o t wo ar es; all unint er est -
ing pixels (isot r opic case) have low values
and t he pixels wit h planar st r uct ur e have
higher values. Set t ing all pixels in t he iso-
t r opic ar ea t o zer o and subt r act ing t his value
fr om t he ot her pixels r esult s in a mor e r elia-
ble at t r act or image.

1

2

3
+ +
-----------------------------
p
c
x f , ( ) c eigenvalues T x f , ( ) ( ) ( ) =
c ( )

1
2

1

2

3
+ +
----------------------------- = c :
3

Or ient at ion
No or ient at ion
Fi gur e 3.3: Histogram of an attractor
image.
5 5 5 7 7 7
3.5 CREATING THE ATTRACTOR IMAGE 11
Computer Vision Laboratory, Linkping University
If t he second cer t aint y est imat e is used,
t hen a (var iable) t hr eshold of slight ly mor e
t han
1
/3 will set all isot r opic pixels t o zer o.
6. Gr adient lt er ing
Comput ing t he 3D-gr adient of t he at t r act or
image will r esult in t he image for ce used
when it er at ing t he cont our. The image for ce is
a funct ion , i.e., ever y pixel in
t he 3D-image is a t hr ee-element vect or.
Tensor ltering
Computing eigenvalues
Detecting planar structure
Gradient ltering
Thresholding
Original image
Image force
Averaging
Fi gur e 3.4: The process of calculating the
image force.
f :
3

13
4
4REPRESENTATION IN THREE DIMENSIONS
This chapter treats the basic extension of the active contour model
from two to three dimensions. Different representations of 3D con-
tours are described, which also makes it necessary to revisit the
methods of calculating the internal forces.
4.1 THE 3D CONTOUR
A 3D cont our is t ypically descr ibed by a funct ion
. The cont our is placed on an
image and is moved by it er at ion in
t he same way as in t he 2D case.
The simplest way t o cr eat e an act ive cont our
in 3D is by using r epeat ed 2D cont our s. This
met hod is oft en used since it is also quit e int ui-
t ive in many applicat ions wit h image sequences.
The major dr awback is t hat it is impossible t o
var y t he dist ance bet ween t he cont r ol point s in
t he t hir d dimension, so t hat exact ly one point per
pixel (in t he t hir d dimension) is r equir ed.
In some applicat ions (e.g., [2] and [7]) one does
not even car e about elast icit y and r igidit y in t he
t hir d dimension and calculat es a number of inde-
pendent cont our s on separ at e images. This, of
cour se, can r esult in ver y unpleasant cont our s,
e.g., if a piece of a line t hr ough t he image
sequence is missing in one or some images.
In t his t hesis, t r ue 3D cont our s ar e dis-
cussed, i.e., t he cont r ol point s can move in t hr ee
dir ect ions and bot h t he ext er nal and int er nal
for ces oper at e in 3D.
4.2 THE ENERGY OF THE CONTOUR
In 3D t he image for ce is dened in t he same way
as in 2D, but t he int er nal ener gy has t o be calcu-
lat ed in a slight ly differ ent way, which also leads
t o a modicat ion of t he Euler-Lagr ange-equat ion
(2.5).
To calculat e t he int er nal ener gy in 3D, some
addit ional par amet er funct ions ar e r equir ed, and
t he ener gy is now dened as (wit h )
E
int
= (4.1)
wher e and det er mine t he elast icit y along
t he s- and r-axis r espect ively, and det er -
mine t he cor r esponding r igidit ies and det er -
mines t he r esist ance t o t wist .
The ener gy is minimized by nding t he v t hat
sat ises t he Euler-Lagr ange-equat ion
(4.2)
which, as in 2D, means t hat t he int er nal for ces
shall balance t he image for ce.
4.3 REPRESENTATION
A 2D cont our is simply r epr esent ed by a vect or of
cont r ol point s wher e neighbour ing cont r ol point s
ar e r epr esent ed by neighbour ing element s in t he
vect or. (This is what causes t he mat r ix A in (2.8)
- (2.9) t o be pent adiagonal.)
In 3D, t he cont our is most easily r epr esent ed
by a mat r ix of cont r ol point s, a mesh. The mesh
is not suit able in all cases; t his will be discussed
below.
v : 0 1 [ , ] 0 1 [ , ]
3

f :
3

v v s r , ( ) =

s
v
s
'
2

r
v
r
'
2

s
+ v
ss
''
2

r
v
rr
''
2

sr
v
sr
''
2
+
+ +
(
) s d r d

s

r

s

r

sr
p v f , ( )
s
v
ss
''
r
v
rr
'' + +

s
v
ssss
4 ( )

r
v
rrrr
4 ( )

sr
v
ssrr
4 ( )
0 =
14 CHAPTER 4: REPRESENTATION IN THREE DIMENSIONS
Active Contours in Three Dimensions
Representing the contour with a mesh
The t wo differ ent t ypes of 2D cont our s (open and
closed cont our s) can wit h t he cor r esponding
boundar y condit ions
(4.3)
(4.4)
be ext ended t o a cylinder if one of (4.3) and (4.4)
is met or a t or us if bot h (4.3) and (4.4) ar e met . If
none of t he condit ions ar e met , t he cont our is just
an open sur face.
Assuming an n m-mesh, it is t r ivial t o expand
t he mesh t o an n(n - a) m(m - b)-mesh, wher e a
and b equal one if equat ion (4.3) and (4.4) r espec-
t ively ar e sat ised (and zer o ot her wise).
Representing the contour with a polyhedron
To cr eat e a spher e-like cont our one can use t he
following set of boundar y condit ions:
(4.5)
(4.6)
(4.7)
However t he cont r ol point s will t hen be placed
on t he spher e in a quit e ir r egular manner (wit h
r egar d t o t heir mut ual dist ances), and t her e is no
obvious way t o modify (4.1) t o t t his t opology.
Consequent ly t he mesh-r epr esent at ion is not
suit able for spher ical cont our s - inst ead it is pr ef-
er able t o place t he cont r ol point s r egular ly on a
spher e, i.e., t o let t he cont r ol point s be t he ver t i-
ces of a r egular polyhedr on (in case of eight con-
t r ol point s, t hey should be placed like t he cor ner s
of a cube). Unfor t unat ely t her e is no r egular
polyhedr on wit h mor e t han t went y ver t ices, as
pr oved by Plat o some t ime ago [4].
A solut ion is t o cr eat e a quasi-r egular polyhe-
dr on wit h equal dist ances bet ween each ver t ex
and it s neighbour s. Such polyhedr a can be cr e-
at ed r ecur sively fr om an icosahedr on, see Figur e
4.1, using t he following algor it hm:
1. Place a new ver t ex at t he midpoint of each
edge.
2. Remove t he old edges and cr eat e new edges
bet ween all ver t ices wit h a mut ual dist ance
t hat equals half of t he dist ance bet ween t he
old ver t ices.
3. Pr oject t he new ver t ices on t he cir cumspher e
of t he polyhedr on.
The or iginal t welve ver t ices have ve neighbour s
while all new ver t ices will have six neighbour s.
The number of faces, edges and ver t ices
(F
n
, E
n
and V
n
wher e n is t he number of r ecur -
sions) gr ow quit e quickly. The or iginal polyhe-
dr on P
0
has got t he char act er ist ics
(F
0
E
0
V
0
) = (20 30 12), and t he char act er ist ics of
polyhedr on P
n
is calculat ed r ecur sively (dir ect ly
fr om t he algor it hm) as
(4.8)
Expanding E
n
as
E
n
(4.9)
(and so on) makes it obvious t hat E
n
can be wr it -
t en as a closed expr ession:
E
n
(4.10)
v s 0 , ( ) v s 1 , ( ) s =
v 0 r , ( ) v 1 r , ( ) r =
v s 0 , ( ) v s 1 , ( ) s =
v 0 r
1
, ( ) v 0 r
2
, ( ) = r
1
r
2
,
v 1 r
1
, ( ) v 1 r
2
, ( ) = r
1
r
2
,
Fi gur e 4.1: The icosahedron, one of the ve
Platonic polyhedra.
F
n
4 F
n 1
=
E
n
2E
n 1
3F
n 1
+ =
V
n
V
n 1
E
n 1
+ =

'

2 2E
n 2
3F
n 2
+ ( ) 3F
n 1
+ =
2 2 2E
n 3
3F
n 3
+ ( ) 3F
n 2
+ ( ) +3F
n 1
=
2
n
E
0
3 2
n 1 k
k 0 =
n 1

F
k
+ =
2
n
E
0
3 2
n 1
2
k

F
0
4
k
+ =
2
n
E
0
3 2
n 1
F
0
2
k

+ =
30 4
n
=
4.4 THE INTERNAL FORCES INDEPENDENT OF REPRESENTATION 15
Computer Vision Laboratory, Linkping University
In a similar way V
n
can be expanded and
expr essed as
V
n
(4.11)
F
n
is t r ivially r ewr it t en, and so (4.8) equals
(4.12)
For example, P
3
and P
4
have 642 and 2562 ver -
t ices r espect ively, which could be suit able
amount s in pr act ical applicat ions. The four r st
polyhedr a (P
0
t hr ough P
3
) ar e illust r at ed in Fig-
ur e 4.2.
4.4 THE INTERNAL FORCES INDEPENDENT
OF REPRESENTATION
Elast icit y can be r egar ded as a dr agging for ce
fr om each of t he neighbour ing cont r ol point s, i.e.,
t he elast icit y for ce in a cont r ol point is simply t he
vect or fr om t he cont r ol point t o t he aver age of t he
neighbour ing cont r ol point s (see Figur e 4.3). In
2D, t his is t he same as equat ion (2.6).
Fi gur e 4.3: The elasticity force drags the
control point v
j
towards the average of the
control points v
j-1
and v
j+1
.
Rigidit y can be r egar ded as t he for ce fr om a
cont r ol point t o a point linear ly pr edict ed by
t he t wo ear lier point s, as shown in Figur e 4.4,
i.e., t he vect or fr om v
j-2
t o v
j-1
is added t o v
j-1
, and
v
j
is for ced t owar ds t he r esult ing point . This
means t hat t he r igidit y for ce in a point v
j
is
. The pr edict ion can be made in
all dir ect ions and be gener alized t o higher
dimensionalit y.
Fi gur e 4.4: The rigidity force drags the
control point v
j
towards the position
predicted by the control points v
j-2
and v
j-1
.
The control points v
j+2
and v
j+1
creates a
similar force.
This view of r igidit y is not t he same as t he
physical pr oper t y; it will not st r aight en lines by
suppr essing cor ner s but by r aising neighbour ing
point s t o t he same level as t he cor ner. By adding
t wice t he elast icit y t o t he r igidit y it becomes t he
same.
This can mor e for mally be expr essed in t he fol-
lowing way:
Fi gur e 4.2: The icosahedron and its rst
three expansions.
V
0
E
k
k 0 =
n 1

+ =
12 30 4
k

+ =
2 10 4
n
+ =
F
n
20 4
n
=
E
n
30 4
n
=
V
n
2 10 4
n
+ =

'

v
j-1
v
j
v
j+1
2v
j 1
v
j 2
v
j

v
j-2
v
j-1
v
j
16 CHAPTER 4: REPRESENTATION IN THREE DIMENSIONS
Active Contours in Three Dimensions
Let , , be t he set of
M point s on a dist ance d st eps fr om a cont r ol
point v
j
. By set t ing c
j,d
t o t he aver age of all point s
on t he dist ance d fr om t he point v
j
, i.e.,
(4.13)
t he elast icit y and r igidit y for ces in t he point v
j
can be expr essed as
(4.14)
(4.15)
These equat ions ar e applicable on a cont our in
2D as well as on a mesh (descr ibing a sur face,
t or us or cylinder ) or a polyhedr on. Their best use
is however on t he polyhedr on, wher e it is not
obvious how t o calculat e t he s- and r-der ivat ives.
They also make it possible t o choose whet her t o
use 4-connect ivit y or 8-connect ivit y in t he mesh.
The elast icit y and r igidit y par amet er s ar e
t hen again only t wo - (for elast icit y in all dir ec-
t ions) and (for r igidit y in all dir ect ions) - and
t he sought -for balance of t he cont our for ces is
now expr essed as
(4.16)
wher e is t he set of cont r ol point s r epr esent ing
t he cont our v. If is a vect or (4.16) equals (2.5),
and if is a mesh wit h 4-connect ivit y (4.16)
equals (4.2) wit h , and .
P
j d ,
p
j d m , ,
{ } = m 1 M , , =
c
j d ,
p
j d m , ,
P
j d ,
--------------
m

=
F
elast
v
j
( ) c
j 1 ,
v
j
=
F
rigid
v
j
( ) 4c
j 1 ,
c
j 2 ,
3v
j
=

F
elast
v ( ) F
rigid
v ( ) p v f , ( ) + + 0 =
v
v
v

s

r
=
s

r
=
sr
0 =
17
5
5ROBUST CONTROL
This chapters examines the problem of instability due to internal
forces, which are too strong but which are still too weak to full
their purpose. The suggested solution limits the internal forces
inuence on the shape of the contour, instead letting them inu-
ence the point distribution only. This also makes it possible to use
the balloon-concept in a stable way.
5.1 THE PROBLEM OF SENSITIVE
PARAMETERS
The pur pose of t he elast icit y for ce is t o keep t he
cont r ol point s equidist ant along t he cont our.
However, if t he dist ance bet ween t he cont r ol
point s is t oo lar ge on an over ly cur ved image con-
t our, t he elast icit y for ce t ends t o dr ag t he cont r ol
point s away fr om r at her t han along t he image
cont our ; see Figur e 5.1.
This can be avoided by decr easing t he values
of t he elast icit y par amet er funct ion (s), but a
t oo weak elast icit y for ce (compar ed t o t he image
for ce) makes t he point s gat her in st r ong ar eas on
t he at t r act or image in a ver y non-equidist ant
manner. To nd an (s) (and a (s)) t hat solves
t he pr oblem, it may be necessar y t o set it s values
individually in each point , but even t hen it is not
cer t ain t hat a solut ion exist s.
5.2 OUTLINE OF SOLUTION
Xu et al. suggest in [14] t hat t he t angent of t he
cont our should be appr oximat ed at each cont r ol
point , and t hat a pr essur e for ce per pendicular t o
t he t angent should be added. This for ce has in
each cont r ol point t he same magnit ude as t he
par t of t he int er nal for ce t hat is per pendicular t o
t he t angent , but t he t wo for ces shall point in
opposit e dir ect ions and consequent ly balance
each ot her. As a r esult t he int er nal for ces may
only move a cont r ol point along t he dir ect ion of
t he t angent .
A simpler way t o expr ess t he same t hing is
t hat t he elast icit y for ce should be pr oject ed on
t he t angent plane of t he cont our befor e inuenc-
ing t he cont our.
The pr oblem is t hen r educed t o appr oximat ing
t he t angent , or, in 3D, t he t angent plane, in each
point . Two met hods ar e descr ibed below.
v
j-1
v
j
v
j+1
F
elast v
j-1
v
j
v
j+1
F
elast
v
j-2
Figure 5.1: An overly strong elasticity force, F
elast
, drags the control point v
j
away from the
image contour (left), while a weak elasticity force cannot keep the points equidistant (right).
18 CHAPTER 5: ROBUST CONTROL
Active Contours in Three Dimensions
A comment on complexity of algorithms
Only comput at ional complexit y (complexit y in
t ime) is consider ed her e, since t he complexit y in
space (i.e., memor y) is in any case ver y small
compar ed t o t he space needed for t he at t r act or
image.
The comput at ional complexit y is appr oxi-
mat ed by t he number of oat ing point oper at ions
needed. Fixed point oper at ions for pr ogr am con-
t r ol, et c., ar e r egar ded as t aking zer o t ime.
5.3 RECONSTRUCTING A CONTOUR USING
BASIS FUNCTIONS
If t he cont our is r epr esent ed by a mesh, we can
r egar d t he cont r ol point s as a r egular sampling
of a signal. We can t hen r econst r uct t he signal as
a linear combinat ion of a set of basis funct ions
wit h t he values in t he sampling point s as coef-
cient s.
Assuming t he signal is limit ed t o a nit e
r ange/ar ea/volume in t he Four ier domain, a per -
fect r econst r uct ion is possible. For a signal t o be
band-limit ed, it must be unlimit ed in space, and
t her efor e only closed cont our s (per iodic signals)
can be band-limit ed.
Requirements on basis functions
For a set of funct ions t o be used as basis func-
t ions t he following r equir ement s have t o be met :
The funct ions should equal zer o in all sam-
pling point s but t he one cor r esponding t o t he
basis funct ion.
The sum of all basis funct ions should equal
one in all point s (not just in t he sampling
point s).
The funct ions should belong t o a Sobolev-
space of t he four t h or der, i.e., all der ivat ives of
up t o t he four t h or der should be squar ed int e-
gr able. If not , t he r igidit y for ce does not neces-
sar ily conver ge.
Choice of basis functions
If t he cont our is closed in a dimension (i.e., equa-
t ion (4.3) or (4.4) in Sect ion 4.3 is sat ised), we
can use a band-limit ed per iodic funct ion as t he
basis in t hat dimension. It s per iod should equal
t he lengt h of t he cont our, and a suit able basis
funct ion (if t he number of samples is odd) is
(5.1)
wher e n is t he number of samples and t he ot her
basis funct ions in t he set ar e t he t r anslat ions
. The der ivat ive funct ion of t he m:t h
or der is t hen given by
(5.2)
In case of an open cont our it is not possible t o
use band-limit ed funct ions. Inst ead t he open con-
t our can be r egar ded as a small par t of a much
lar ger (closed) cont our, whose sampled values all
equal zer o out side t he limit ed par t .
For example, (5.1) can be used as a basis func-
t ion, but wit h an n at least t wice t he number of
samples (in or der for t wo point s t o cor r elat e less
as t he dist ance bet ween t hem gr ows).
Reconstruction of the contour and its
derivatives
The cont our can be wr it t en as
(5.3)
wit h t he der ivat ives
(5.4)
Assuming t he cont our t o be r epr esent ed by
t hr ee -meshes , and t he der iva-
t ives in a cont r ol point (s
1
, s
2
), s
j
{0, ... , n
j
- 1},
equal
(5.5)
The values of t he funct ions can be
calculat ed in advance (i.e out side t he it er at ion-
loop) and t he values st or ed in vect or s
(5.6)

n
x ( )
1
n
-- - 1 2
2kx
n
------------
,
_
cos
k 1 =
n 1 ( ) 2

+
,

_
=

n
x k ( )

n
m ( )
x ( )
2
n
---
2k
n
---------
,
_
m
2kx
n
------------
m
2
-------
,
_
cos
k 1 =
n 1 ( ) 2

=
v :
2

v s
1
s
2
, ( )
x
1
s
1
s
2
, ( ) x
2
s
1
s
2
, ( ) x
3
s
1
s
2
, ( )
T
=
s
k
m
m

v
s
k
m
m

x
1
s
k
m
m

x
2
s
k
m
m

x
3
T
=
n
1
n
2
x
1
x
2
x
3
s
1
m
m

x
j
x
j
k s
2
, ( )
n
1
m ( )
s
1
k ( )
k 0 =
n
1
1

=
s
2
m
m

x
j
x
j
s
1
k , ( )
n
2
m ( )
s
2
k ( )
k 0 =
n
2
1

'

n
j
m ( )
x k ( )

n
m ( )
s ( )

n
m ( )
s ( )

n
m ( )
s n 1 ( ) ( )
=
5.3 RECONSTRUCTING A CONTOUR USING BASIS FUNCTIONS 19
Computer Vision Laboratory, Linkping University
Using (5.6) and t he mat r ix given by
(5.7)
(and t he cor r esponding ) t he der ivat ives
can be expr essed as
(5.8)
Since t he values of t he basis funct ions can be
calculat ed in any point , it is possible t o int er po-
lat e t he cont our and it s der ivat ives in any point
(s
1
, s
2
). If neit her of s
1
or s
2
ar e int eger values, t he
cont our v
(m)
has r st t o be int er polat ed in all t he
point s (s
1
, 0) ... (s
1
, n
2
- 1) (using t he second equa-
t ion in (5.8)). Then v
(m)
(s
1
,s
2
) can be r econst r uct ed
using t he r st equat ion in Figur e 5.8.
The tangent plane
The t angent plane of t he cont our is given by it s
nor mal vect or
(5.9)
which by inser t ion of (5.8) can be expr essed as
(5.10)
Computational complexity
Comput ing (5.8) r equir es 6(n
1
+ n
2
- 1) oat ing
point oper at ions. Anot her 9 oper at ions ar e
needed t o calculat e t he nor mal vect or , so a
t ot al of 6(n
1
+ n
2
) + 3 oper at ions ar e needed t o cal-
culat e in one point , i.e in O(n
1
+ n
2
) t ime.
x
s
1
s
2
( )
x
1
0 s
2
, ( ) x
1
n
1
1 s
2
, ( )
x
2
0 s
2
, ( ) x
2
n
1
1 s
2
, ( )
x
3
0 s
2
, ( ) x
3
n
1
1 s
2
, ( )
=
x
s
2
s
1
( )
s
1
m
m

v s
1
s
2
, ( ) x
s
1
s
2
( )
n
1
m ( )
s
1
( ) =
s
2
m
m

v s
1
s
2
, ( ) x
s
2
s
1
( )
n
2
m ( )
s
2
( ) =

'

s
1

v
s
2

v
=
s
1
s
2
, ( ) x
s
1
s
2
( )
n
1
m ( )
s
1
( ) x
s
2
s
1
( )
n
2
m ( )
s
2
( ) =
15 20 25 30 35 40 45 50 55
15
20
25
30
35
40
45
15 20 25 30 35 40 45 50 55
15
20
25
30
35
40
45
15 20 25 30 35 40 45 50 55
15
20
25
30
35
40
45
15 20 25 30 35 40 45 50 55
15
20
25
30
35
40
45
Figure 5.2: The contour represented by 11 control points and its reconstruction (top left); the
rigidity force (top right); the elasticity force (bottom left); the elasticity force projected on the
tangent in each point (bottom right).
20 CHAPTER 5: ROBUST CONTROL
Active Contours in Three Dimensions
Global internal forces
Equat ion (5.8) can be also used t o calculat e t he
elast icit y and r igidit y for ces. Compar ed t o using
t he ear lier met hods (e.g., equat ions (4.14) - (4.15)
in Sect ion 4.4) t his will incr ease comput at ion
complexit y by a fact or pr opor t ional t o n
1
+ n
2
. As
a posit ive effect t he int er nal for ces will behave
globally, i.e., if when a cont r ol point is moved, t he
for ce on all ot her point s will be immediat ely
effect ed, inst ead of sever al it er at ions lat er.
An example
In Figur e 5.2, a 2D-cont our wit h 11 cont r ol
point s is int er polat ed in 55 point s using t he basis
funct ion (5.1). It s second and four t h der ivat ives,
i.e t he elast icit y and t he r igidit y for ce r espec-
t ively, ar e int er polat ed as well.
5.4 APPROXIMATING THE TANGENT PLANE
WITH SPHERES
On a gener alized r epr esent at ion of t he cont our,
e.g., t he polyhedr on-r epr esent at ion descr ibed in
Chapt er 4, t he met hod descr ibed above cannot be
used (unless a way of expr essing basis funct ions
for a gener al polyhedr on can be found). Inst ead,
an appr oximat ing met hod will be used.
In [14] it is suggest ed t hat a 2D cont our can be
appr oximat ed wit h t angent ar cs, i.e., t he t angent
in a point v
j
is appr oximat ed wit h t he cir cle t hat
passes t hr ough point s v
j-1
, v
j
and v
j+1
. The t an-
gent is r epr esent ed by it s nor mal vect or ,
point ing fr om v
j
t owar ds t he cent r e of t he cir cle
m
j
; see Figur e 5.3.
Figure 5.3: The tangent approximated with
the circle through three control points.
By denit ion m
j
must be sit uat ed at t he same
dist ance fr om v
j-1
, v
j
and v
j+1
, which implies t hat

j
pr oject ed on v
j-1
- v
j
and v
j+1
- v
j
(see Figur e 5.3)
will r each half-way along t hese vect or s r espec-
t ively, i.e
j
should sat isfy
(5.11)
Extending to three dimensions
In 3D, we use t hr ee neighbour ing point s, v
j,a
, v
j,b
and v
j,c
, and calculat e t he spher e which has all
four point s as edge point s. In t he same way as
(5.11), t he sought -for
j
is found by solving t he
syst em
(5.12)
Spheres approximating a polyhedron
Using t he suggest ed polyhedr on r epr esent at ion
(Sect ion 4.3), wher e most point s have six neigh-
bour s, sever al differ ent t angent planes can be
calculat ed. Pr efer ably t hr ee neighbour ing point s
t hat ar e not neighbour ing each ot her ar e used t o
calculat e a nor mal
j,1
. The t hr ee neighbour ing
point s not used can be used (see Figur e 5.4) t o
calculat e anot her nor mal
j,2
, and t he aver age
(aft er nor malizat ion) can be used.
Figure 5.4: The control point v
j
and its six
neighbours. The two gray triangles
surround the points that should be used for
calculating
j,1
and
j,2
respectively.
Some car e is needed doing t he aver aging. If
t he t wo nor mal vect or s ar e r elat ed like

j
v
j-1
v
j
v
j+1

j
m
j
v
j 1
v
j

v
j 1
v
j

--------------------------
,
_

1
2
--- v
j 1
v
j
=
v
j 1
v
j
+
v
j 1
v
j
+
--------------------------
,
_

1
2
--- v
j 1
v
j
+ =

'

v
j a ,
v
j
( )
T
v
j b ,
v
j
( )
T
v
j c ,
v
j
( )
T

j
1
2
---
v
j a ,
v
j

2
v
j b ,
v
j

2
v
j c ,
v
j

2
=
v
j
5.5 CONTROLLING THE CONTOUR 21
Computer Vision Laboratory, Linkping University
t he aver age will point in a r andom
dir ect ion. This is avoided by dening
j
as
(5.13)
wher e
(5.14)
On t he t welve point s on t he polyhedr on which
have only ve neighbour s,
j
has t o be calculat ed
differ ent ly. To get a symmet r ical dist r ibut ion of
spher es, ve spher es ar e needed, each spher e
using t he cont r ol point in which t he t angent
should be calculat ed, one neighbour ing cont r ol
point v
k
and t he t wo point s neighbour ing v
j
but
not v
k
. The r esult ing nor mal is t hen calculat ed by
gener alizing (5.13):
(5.15)
wher e N is t he number of spher es (i.e 5).
Alt er nat ively, only one spher e is calulat ed,
hoping t hat t hr ee neighbour ing point s ar e
enough for a good appr oximat ion.
Spheres approximating a mesh
Using 8-connect ivit y, t he t angent plane of a mesh
can be appr oximat ed wit h four spher es. Number -
ing t he neighbour s accor ding t o Figur e 5.5 we
calculat e t he four spher es using t he following
set s of point s: {0, 4, 3, 8}, {0, 2, 6, 8}, {0, 5, 1, 6},
{0, 7, 1, 3}. The r esult ing
j,1
,...,
j,4
ar e used
accor ding t o (5.15) t o calculat e
j
. The alt er nat ive
ment ioned above, i.e., t o calculat e only one of
t heses spher es, is st ill valid.
Figure 5.5: A numbering of control points.
Computational complexity
Using Cr amer s r ule [10] st at ing
1
(5.16)
t o inver t t he mat r ix in (5.12), t he inver sion can
be done making 27 oat ing point oper at ions.
(Since we do not car e about t he lengt h of t he vec-
t or
j
, it is not necessar y t o calculat e .)
Cr eat ing t he vect or on t he r ight hand in (5.12)
needs 24 oper at ions, and mult iplying it wit h A
-1
needs anot her 15 oper at ions. This adds up t o 66
oper at ions t o solve t he syst em (5.12) and calcu-
lat e one spher e.
Equat ion (5.15) needs 11(N - 1) oper at ions plus
anot her 9N oper at ions for nor malizing t he vec-
t or s. Summing up, t her e is need for 86N - 11 oper -
at ions t o calculat e t he nor mal vect or.
Compar ing t his wit h t he met hod suggest ed in
Sect ion 5.3 (using basis funct ions), spher e-t t ing
is fast er except for on a ver y small mesh.
5.5 CONTROLLING THE CONTOUR
Pr oject ing t he elast icit y on t he t angent plane
befor e it inuences t he shape of t he cont our
makes t he cont our mor e st able and less sensit ive
t o t he choice of par amet er s. Using a const ant of
0.5, which makes t he point s move t o t he (cur -
r ent ly) ideal posit ion in each it er at ion, should no
longer change t he shape of t he cont our signi-
cant ly.
By pr oject ing t he r igidit y on t he t angent plane
as well, t he cont our can hold on t o shapes in t he
images t hat have a high degr ee of cur vat ur e
(wit hout changing t he par amet er in select ed
point s). The cont our has of cour se lost most of it s
r igidit y but will now keep appr oximat ely t he
same size and shape (except for by inuence fr om
t he at t r act or image).
The cont our can now be cont r olled by adding
anot her for ce, a user-cont r olled inat ion for ce, t o
give t he cont our t he pr efer r ed size. This makes it
possible t o guide t he cont our t o t he int er est ing
par t of t he image by manipulat ing only one (glo-
bal) par amet er. This is t he same idea as t he bal-
loon model descr ibed in [1].
For example, when t r ying t o nd t he inside of
a vent r icle, a small spher ical cont our (polyhe-
dr on) could be placed in t he middle of t he vent r i-
cle and inat ed t o appr oximat ely t he cor r ect size.
Then, t he cont our can be t ur ned act ive again, by
1. B = adj(A) denot es t he mat r ix of which t he element b
ij
equals t he cofact or of t he element a
ji
in A.

j 1 ,

j 2 ,

j

j 1 ,
sign
j 1 ,

j 2 ,
( )
j 2 ,
+ =
sign x ( )
1 if x 0
1 if x 0 <

'

j

j 1 ,
sign
j 1 ,

j k ,
( )
j k ,
k 2 =
N

+ =
0
1 2 3
4 5
6 7 8
A
1 adj A ( )
det A ( )
---------------- =
det A ( )
22 CHAPTER 5: ROBUST CONTROL
Active Contours in Three Dimensions
no longer pr oject ing t he r igidit y and r eset t ing
t he inat ion for ce.
The for ce inuencing a cont r ol point v
j
can now
be expr essed as
= (5.17)
wher e is t he user-cont r olled par amet er r egulat -
ing t he inat ion for ce and is t he par amet er t ell-
ing t he cont our t o be act ive or inact ive, i.e.,
(5.18)
When calculat ing t he inat ion for ce it is
impor t ant t hat all nor mal vect or s
j
ar e point ing
in t he same dir ect ion. That is, on a spher ical
cont our, all nor mal vect or s should point t owar ds
t he out side of t he cont our (or inside, but t hey
should all be alike). If t he nor mal vect or s ar e cal-
culat ed using spher es, t his is only guar ant eed if
t he cont our is convex. The pr oblem is not t r ivial,
but since it depends on t he implement at ion it is
not t r eat ed her e. A solut ion is descr ibed in
Appendix B, Implement at ion in 3D.
F v
j
( ) F
e last
v
j
( ) F
e last
v
j
( )
j
( )
j
( )
F
r igid
v
j
( ) F
r igid
v
j
( )
j
( )
j
( )

j
p v
j
f , ( )
+
+

1 if 0 >
0 otherwise

'

=
23
6
6EXPERIMENTS
This chapter describes the experiments performed to test the meth-
ods suggested in earlier chapters. Two experiments were per-
formed; one with ideal, mathematically dened image volumes
and one with realmedical image volumes.
6.1 THE ACTIVE CONTOUR MODEL
The act ive cont our model was implement ed as
C++ classes and AVS modules, as descr ibed in
Appendix B.3, The Act ive Cont our Model.
The int er nal for ces in t he cont r ol point s
wer e comput ed as dened in Sect ion 4.4,
i.e., as
(6.1)
(6.2)
wher e is t he aver age of all cont r ol
point s on t he dist ance i fr om t he cont r ol point v
j
.
The it er at ions wer e per for med accor ding t o
(6.3)
wher e t he for ce F(v
j
) in each cont r ol point is com-
put ed as
= (6.4)
, and ar e t he par amet er s r egulat ing t he elas-
t icit y, t he r igidit y and t he inat ion for ce r espec-
t ively, and ar e t he par amet er s t elling
t he int er nal for ces t o be act ive or inact ive (i.e., if
t hey should be pr oject ed on t he cont our s t angent
plane or not ). The funct ion clip limit s t he image
for ce vect or t o t he lengt h .
Not e t hat t he it er at ion-met hod in Equat ion
(6.3) is not t he same as Equat ion (2.9) (Euler s
met hod). Inst ead, each cont r ol point is moved
accor ding t o t he sum of all for ces. This met hod
conver ges somewhat slower but is ext r emely
easy t o implement in O(n)-t ime.
The nor mal vect or s wer e appr oximat ed using
t he spher e-t t ing met hod descr ibed in Sect ion
5.4.
6.2 FITTING CONTOURS TO SYNTHETIC
SHAPES
Two t est volumes wer e const r uct ed, one for t est -
ing each r epr esent at ion (mesh and polyhedr on;
see Chapt er 4). The pur pose t o measur e t he per -
for mance of t he cont our s, since t he int ended
shapes ar e well dened. The volumes used wer e:
The half-spher e volume for t est ing t he poly-
hedr on r epr esent at ion: A pixel
volume wher e t he pixels on a half-spher e and
t he pixels in t he cir cle t hat cut s t he spher e
have t he value one. The r est of t he pixels ar e
set t o zer o.
In addit ion, an ar ea on t he half-spher e has
it s values mult iplied wit h t hr ee, t hus
int ended t o at t r act t he cont our mor e st r ongly
and dist ur b t he point dist r ibut ion. The vol-
ume is illust r at ed in Figur e 6.1.
v
j

3

F
elast
v
j
( ) c
j 1 ,
v
j
=
F
rigid
v
j
( ) 4c
j 1 ,
c
j 2 ,
3v
j
=
c
j i ,

3

v
k 1 +
v
k
F v
k
( ) + =
F v
j
( ) F
e last
v
j
( )
1
F
e last
v
j
( )
j
( )
j
( )
F
r igid
v
j
( )
2
F
r igid
v
j
( )
j
( )
j
( )

j
clip p v
j
f , ( ) , ( )
+
+
+

i
0 1 { , }
60 40 60
Fi gur e 6.1: The half-sphere. The pixels
with higher value are darker.
24 CHAPTER 6: EXPERIMENTS
Active Contours in Three Dimensions
The half-cylinder volume for t est ing t he
mesh r epr esent at ion: A pixel vol-
ume wher e t he pixels on a half-cir cular cylin-
der ar e set t o one and t he ot her pixels ar e set
t o zer o. Not e t hat t he cylinder is open in t he
ends. As in t he half-spher e case, a band
acr oss t he cylinder has higher values. The vol-
ume is illust r at ed in Figur e 6.2.
Creating attractor volumes
Bot h t est volumes wer e lt er ed t o cr eat e t wo dif-
fer ent at t r act or volumes, hencefor t h called
at t r act or s, each:
1. Gr adient . This at t r act or is dened accor ding
t o t he or iginal edge det ect ing idea, i.e.,
.
2. Or ient at ion. The at t r act or is comput ed
accor ding t o t he st eps in Sect ion 3.5, but wit h-
out any aver aging of t he t ensor eld. Since
t he t est volumes lacks noise, t he aver aging is
not necessar y.
The at t r act or s wer e comput ed using t he GOP and
AVS envir onment s, as descr ibed in Appendix B.2,
Cr eat ing t he At t r act or Image.
The contour-tting process
The following sequence of st eps was followed
when t t ing a cont our t o a shape in a t est vol-
ume. The sequence was per for med t wice for each
at t r act or - once wit h t he elast icit y t ur ned inac-
t ive and once wit hout t hat possibilit y.
1. Place a small cont our (wit h a diamet er of
about 10 pixels) in t he middle of t he t est
shape. A polyhedr on wit h 42 cont r ol point s
was used in t he half-spher e volume and a
mesh wit h 56 cont r ol point s was used in t he
half-cylinder volume.
2. Use 20 it er at ions for inat ing t he cont our t o
appr oximat ely t he r ight size and shape. The
inat ion for ce was set t o one pixel, as was t he
maximum at t r act or for ce.
3. Expand t he cont our, i.e., incr ease t he number
of cont r ol point s and halve t he maximum
at t r act or inuence.
4. It er at e, and per for m st ep t hr ee ever y ft h
it er at ion.
Measuring the performance
To measur e t he success of t he cont our t t ing, t he
cont our s wer e expanded t wice mor e, aft er which
t he (Euclidian) dist ance fr om each cont r ol point
t o t he t est shape was comput ed. The aver age dis-
t ance was used as a discr epancy measur e.
The r esult s fr om t he polyhedr on-case, using
t he half-spher e-volume, ar e shown in t he gr aph
in Figur e 6.4. As can be seen in t he gr aph, t he
cont our wit h act ive elast icit y is closer t o t he
int ended shape aft er t he init ial 20 inat ing it er a-
t ions. This is because 20 it er at ions is t oo much
(t he cont our gr ows t oo lar ge), but t he act ive elas-
t icit y r educes t he size of t he cont our. When t he
inat ion for ce is t ur ned off, t he cont our wit h
inact ive elast icit y per for ms bet t er.
In t he mesh case (using t he half-cylinder vol-
ume), t he cont our wit h inact ive elast icit y had an
aver age discr epancy of less t han a t hir d of a
pixel, while t he cont our using act ive elast icit y
did not at t ach t o t he int ended shape at all.
Inst ead, an init ial cont our being lar ger t han t he
int ended shape had t o be used, t hen let t ing t he
cont our shr ink under t he inuence of t he elast ic-
it y. The nal r esult was a discr epancy of only
slight ly less t han one pixel.
60 80 40
Fi gur e 6.2: The half-cylinder. The pixels
with higher value are darker.
p x f , ( ) f x ( )
2
=
25 30
Iterations
A
v
e
r
a
g
e

d
i
s
t
a
n
c
e

(
p
i
x
e
l
s
)
Fi gur e 6.4: Discrepancy measure of
contours with inactive (black/ white graph)
and active (gray graph) elasticity. Both use
the same orientation attractor.
0.5
0.7
6.3 FITTING CONTOURS TO MEDICAL IMAGE VOLUMES 25
Computer Vision Laboratory, Linkping University
Using a gr adient at t r act or, t he cont our st abi-
lized wit h a discr epancy of mor e t han one pixel,
which was expect ed since t he cont our at t aches t o
t he gr adient at t r act or slight ly beside t he
int ended shape.
6.3 FITTING CONTOURS TO MEDICAL IMAGE
VOLUMES
Two medical 3D image volumes have been used
t oo - again, one for t r ying out each of t he t wo r ep-
r esent at ions. The pur pose was t o examine and
give examples of how t o use act ive cont our s in a
mor e r ealist ic sit uat ion, but wit hout object ive
measur ement of t he per for mance (since t he cor -
r ect shapes ar e unknown). The volumes t hat
wer e used ar e:
The knee volume: This is a magnet ic r eso-
nance-image of a knee of t he size
pixels. The bones of t he knee
and leg ar e clear ly visible in t he volume slices,
and t he int ent was t o t a cylinder-shaped
act ive cont our t o a par t of one of t he bones in
t he leg (eit her t he t highbone or t he calfbone).
A 2D slice of t he volume is shown in Figur e
6.5, and it is obvious t hat an at t r act or image
volume cr eat ed wit h t he gr adient met hod
could wor k well (t he bone is sur r ounded by
edges).
The hear t volume: This volume is con-
st r uct ed by a sequence of 2D ult r a-sound
images of a hear t . The size is ,
and differ ent cavit ies (vent r icles) can be seen
by slicing t he volume. It is ver y har d t o det er -
mine t he shape of t he cavit ies by looking at
t he slices, and t her efor e t he int ent was t o
ext r act one of t hese shapes wit h an act ive con-
t our r epr esent ed by a polyhedr on. A slice fr om
t he hear t volume is shown in Figur e 6.5,
wher e a cr oss mar ks t he cavit y t o which t he
cont our was int ended t o t .
Creating the attractor volumes
Bot h medical volumes wer e lt er ed t o cr eat e t wo
differ ent at t r act or s each:
1. Gr adient . The or iginal edge-det ect ing
met hod.
2. Aver aged or ient at ion. The at t r act or is com-
put ed accor ding t o t he st eps in Sect ion 3.5
(including aver aging).
The knee attractors
The main differ ence of t he or ient at ion at t r act or s
vs. t he gr adient at t r act or (see Figur e 6.6, t op t wo
images) is t hat t he or ient at ion-at t r act or s have
t heir highest values slight ly out side t he sur face
of t he bone. This is an effect of t he fact t hat t her e
ar e layer s of t issue sur r ounding t he bone, t hus
for ming planar st r uct ur e.
Anot her differ ence is t hat t he or ient at ion
at t r act or s ar e of consider able low-pass char act er
when compar ed t o t he gr adient at t r act or (which
is no sur pr ise - it was LP-lt er ed (aver aged)
while cr eat ed). This makes it suit able t o use t he
or ient at ion at t r act or t o nd t he r st , r ough
appr oximat ion cont our. Then we can incr ease t he
r esolut ion of t he cont our and use t he gr adient
Fi gur e 6.5: A slice of the knee-volume (left) and a slice of the heart-volume (right).
256 256 128
177 155 152
26 CHAPTER 6: EXPERIMENTS
Active Contours in Three Dimensions
at t r act or t o do a mor e exact t t ing (of cour se, an
aver aged ver sion of t he gr adient at t r act or could
have been used for t he r st st ep).
The heart attractors
The main differ ence bet ween t he t ypes of at t r ac-
t or s is t hat t he gr adient at t r act or has det ect ed
t he sur face enclosing t he cavit y t o a ver y var ying
degr ee, leaving gaps and having some ver y
st r ong point s. Slices fr om t wo of t he at t r act or s
ar e shown at t he bot t om of Figur e 6.6.
The contour-tting process
In bot h t he hear t and knee cases t he
sequence of st eps followed was as follows:
1. Place an init ial cont our inside t he sought -for
sur face. In t he knee case, t his was a plain
cylinder wit h appr oximat ely half t he diamet er
of t he bone. In t he hear t case, it was an
icosahedr on.
2. Inat e t he cont our unt il it begins t o be inu-
enced by t he at t r act or.
3. Incr ease t he r esolut ion of t he cont our.
Fi gur e 6.6: A slice of the gradient-attractor (top left) and the orientation-attractor (top
right) of the knee-volume. Below the corresponding attractors of the heart-sequence.
6.3 FITTING CONTOURS TO MEDICAL IMAGE VOLUMES 27
Computer Vision Laboratory, Linkping University
4. Do 10 - 20 it er at ions unt il t he cont our is quit e
st able.
5. If ne adjust ment is needed, incr ease t he r es-
olut ion, decr ease t he maximum at t r act or
inuence and do some mor e it er at ions.
Fitting a contour to the knee volume
While t t ing t he cont our in t he knee-volume t he
following obser vat ions wer e made:
It is not necessar y t o let t he cont r ol point s be
able t o move along t he cylinder-shaped con-
t our - act ually t he cont our behaves bet t er if
not . This is because if t he cont r ol point s can
move along t he cylinder, t hey t end t o gat her
in t he places wher e t he at t r act or is especially
st r ong, t hus being inequidist ant .
It is, however, impor t ant t o comput e t he
int er nal for ces using all dimensions, t hus
keeping t he r esult ing 2D cont our s st r ongly
cor r elat ed.
Fi gur e 6.7: The surface of a bone visualized with an active contour. Two orthogonal slices
of the image volume are shown, while the rest of the volume is invisible.
28 CHAPTER 6: EXPERIMENTS
Active Contours in Three Dimensions
The most impor t ant st ep dur ing t he it er at ions
is t o t t he ends of t he cylinder well t o t he vol-
ume. When t hese ar e t t ed, t hey should be
xed and t he r est of t he cont our it er at ed.
Since t he init ial cont our was not close t o t he
int ended shape, but a t hin cylinder inside t he
bone, it was necessar y t o inat e t he cont our.
It t ur ned out t o be ext r emely har d t o do t his
in a cont r ollable way wit hout t ur ning t he
elast icit y inact ive (i.e., pr oject it on t he con-
t our s t angent plane).
As suspect ed, t he gr adient at t r act or wor ked
best for ne adjust ment . The or ient at ion
at t r act or s could also have been r eplaced by
aver aged gr adient at t r act or s, but t hey wor k
well for cat ching t he cont our fr om t he init ial
inat ion.
The r esult ing cont our is visualized along wit h
t wo or t hogonal slices of t he knee volume in Fig-
ur e 6.7. St udying sever al slices of t he volume
ver ies t hat t he cont our follows t he bones sur -
face, except wher e t he cont our s r igidit y has
for ced t he cont our t o be smoot her.
Fitting a contour to the heart volume
While t t ing a polyhedr on t o t he cavit y in t he
hear t volume, it was absolut ely necessar y t o
t ur n t he elast icit y inact ive. The polyhedr on r ep-
r esent at ion needs a st r ong elast icit y for ce t o
keep t he cont r ol point s fair ly equidist ant , and
wit hout t ur ning t he elast icit y for ce inact ive it
will not let t he at t r act or inuence t he cont our
enough.
Wit h t he hear t volume, t he aver aged or ient a-
t ion at t r act or was t he best t o use. Since t he gr a-
dient at t r act or var ied gr eat ly in st r engt h,
maximum possible elast icit y was not enough t o
keep t he cont r ol point s fr om gat her ing in st r ong
ar eas along t he sur face.
Using t he or ient at ion at t r act or s, t he pr oblem
st ill exist ed, but at a level t hat could be compen-
sat ed by t he elast icit y for ce, and t he cont our
nally t t ed t he cavit y quit e well. However, t hat
is st at ed wit hout any medical knowledge and
wit hout knowing t he shape t hat such a cavit y is
supposed t o have
1
. What was done was t o com-
par e t he cont our wit h sever al slices of t he or igi-
nal volume.
The r esult ing cont our is shown in Figur e 6.8.
Fi gur e 6.8: The surface of a cavity in a
heart visualized with an active contour.
1. To add t o t he confusion, t he ult r a-sound volume is
not sampled so t hat t he angles ar e cor r ect .
29
7
7CONCLUSIONS & FUTURE WORK
This chapter discusses the results of the experiments and some
ideas for future study of active contours.
7.1 THE ATTRACTOR IMAGE
Two ways of cr eat ing t he at t r act or image wer e
descr ibed in Chapt er 3, The At t r act or Image;
t he t r adit ional edge-det ect ing gr adient at t r act or
and an or ient at ion-based det ect or of planar
st r uct ur e.
The most suit able manner of cr eat ing t he
at t r act or image depends fully on t he image t he
cont our should be t t ed t o, and not hing gener al
can be said. I have, however, shown how t o use
t he or ient at ion-based met hod for cr eat ing at t r ac-
t or images and t hat t he met hod wor ks well in
cer t ain sit uat ions.
Ther e ar e, of cour se, an innit e number of pos-
sible ways t o cr eat e at t r act or images. Depending
on what feat ur e t hat should at t r act t he cont our,
any local feat ur e ext r act ing met hod could be
used t o cr eat e an at t r act or image.
Further studies
What should have been st udied is t he cont our s
sensit ivit y t o noise using differ ent at t r act or s.
Such exper iment s wer e not done, since ot her
pr oblems r eceived higher pr ior it y.
In t he knee volume (see Chapt er 6, Exper i-
ment s) t he gr adient at t r act or wor ked well bec-
use it is var iant t o phase. It is, however, st ill a
planar st r ucut r e t hat is sought for, and an at t r ac-
t or sensit ive t o bot h phase and planar st r uct ur e
is pr obably t he best solut ion in all t he t est vol-
umes. This could be implement ed by a one
dimensional line/edge det ect ing in t he dir ect ion
of t he eigenvect or cor r esponding t o t he lar gest
eigenvalue of t he or ient at ion t ensor, or wit h a
phase-var iant or ient at ion t ensor (discussed in
[11]).
7.2 THE REPRESENTATIONS
The t wo r epr esent at ions (mesh and polyhedr on)
descr ibed in Chapt er 4, Repr esent at ion in Thr ee
Dimensions wor ked well, as did t he algor it hms
for expanding t hem and for calculat ing t he int er -
nal for ces
1
.
Further studies
What should be fur t her examined is how t o
expand t he polyhedr on exclusively in t hose ar eas
wher e t he cont r ol point s ar e t oo widely spr ead. It
will t hen be necessar y t o nd ways t o calculat e
t he int er nal for ces on a polyhedr on wit h var ying
r esolut ion.
The int er nal for ces should also be r edened t o
be invar iant t o t he r esolut ion of t he cont our.
Wit h t he met hods descr ibed in Chapt er 4, t he
spat ial scope of t he int er nal for ces will be halved
when t he cont our is expanded.
7.3 CONTROLLING THE CONTOUR
Dur ing t he pr oject , it t ur ned out t hat it was ver y
har d t o cont r ol t he cont our when a st r ong elast ic-
it y was needed. The exper iment wit h t t ing an
act ive cont our t o t he cavit y inside a hear t seemed
near ly impossible.
The solut ion descr ibed in Chapt er 5, Robust
Cont r ol, i.e., t o appr oximat e t he cont our s t an-
gent plane wit h spher e t t ing and pr oject t he
elast icit y for ce on t hat plane (t ur ning t he elast ic-
it y inact ive), solved t he pr oblem almost com-
plet ely
2
, and t his is pr obably t he most impor t ant
r esult of t his pr oject . The exper iment s t hat wer e
1. The exact algor it hms have not been descr ibed in t he
t hesis, but can be found in Appendix B, Implement a-
t ion in 3D.
30 CHAPTER 7: CONCLUSIONS & FUTURE WORK
Active Contours in Three Dimensions
per for med showed t hat t ur ning t he elast icit y
inact ive pr oduced bet t er r esult s as well as made
t he int er act ive pr ocess of t t ing t he cont our s eas-
ier for t he oper at or.
Further studies
To make t he cont our fully usable in pr act ical
applicat ions, a number of small cont r olling fea-
t ur es should be developed, e.g., let t ing t he con-
t our be inat ed in one dir ect ion, or xing cer t ain
cont r ol point s.
7.4 FURTHER SUGGESTIONS
Visualization
The main pur pose of act ive cont our s in t hr ee
dimensions is pr obably visualizat ion, which was
not t r eat ed in t his t hesis (t he AVS envir onment
did t his wor k). However, some aspect s could be
st udied fur t her. For example, how should a con-
t our passing empt y spaces in t he at t r act or image
2. For a complet e solut ion, a polyhedr on wit h adapt ive
r esolut ion is needed.
be visualized? Suggest ions ar e t hat it should
eit her be at t ened out , or t hat it should be t r ans-
par ent , depending on t he applicat ion.
Complex models
A key t o successful use of t he act ive cont our
model is t o have a good init ial suggest ion. Also,
new int er nal for ces could be added, keeping t he
cont our fr om diver t ing t oo much fr om t he sug-
gest ed model.
It is also possible t o dene t he int er nal for ces
differ ent ly in differ ent par t s of t he cont our. For
example, when visualizing vent r icles of t he hear t
in t ime-sequences, some par t s ar e known - in
advance - t o move mor e t han ot her s, and t hose
par t s should t hen be less r igid in t he t ime-dimen-
sion.
Four dimensional contours
The ult r a-sound volume used in Chapt er 6,
Exper iment s (t he hear t volume) is act ually a
volume sequence, i.e., a four dimensional image.
An ext ension of t he act ive cont our concept t o four
dimensions could be useful, for example t o meas-
ur e t he var iat ion of t he volume of a vent r icle in
t ime.
31
REFERENCES
[1] L. D. Cohen. On Act ive Cont our Models and Balloons, Computer
Vision, Graphics and Image Processing: Image Understanding,
Vol 53 No 2, pages 211-218, 1991.
[2] L. D. Cohen and I. Cohen. A nit e element met hod applied t o new
act ive cont our models and 3D r econst r uct ion fr om cr oss sect ions,
Proceedings of the International Conference on Computer Vision,
pages 587-591, 1990.
[3] I. Cohen, L. D. Cohen and N. Ayache. Using Defor mable Sur faces
t o Segment 3-D Images and Infer Differ ent ial St r uct ur es, Compu-
ter Vision, Graphics and Image Processing: Image Understanding,
Vol 56 No 2, pages 242-263, 1992.
[4] H. S. M. Coxet er. Regular polytopes, Dover Publicat ions, 1973.
[5] L. Eldn and L. Wit t meyer-Koch. Numerisk analys - en introduk-
tion, St udent lit t er at ur, 1987.
[6] G. H. Gr anlund and H. Knut sson. S ignal Processing for Computer
Vision, Kluwer Academic Pr ess, 1995.
[7] J. Hansson. S egmentering och visualisering av kryoanatomidata,
Mast er s Thesis, Repor t LiTH-ISY-EX-1135, Linkping Univer -
sit y, 1992.
[8] F. Her ber t . Chapter House Dune, New English Libr ar y, 1985.
[9] M. Kass, A. Wit kin and D. Ter zopoulos. Snakes: Act ive Cont our
Models, International Journal on Computer Vision, Vol 1, pages
321-331, 1988.
[10] A. Migdalas and M. Gt he-Lundgr en. Kombinatorisk optimering -
problem och algoritmer, Dept . of Mat hemat ics, Linkping Univer -
sit y, 1994.
[11] K. Nor dber g. S ignal Representation and Processing using Opera-
tor Groups, PhD Thesis, Disser t at ion No. 366, Linkping Univer -
sit y, 1994.
[12] G. Spar r. Kontinuerliga system, Dept . of Mat hemat ics, Linkping
Univer sit y.
[13] C. J. West elius. AVS for beginners, Int er nal r epor t , Comput er
Vision Lab., Linkping Univer sit y.
[14] G. Xu, E. Segawa and S. Tsuji. Robust Act ive Cont our s wit h
insensit ive par amet er s, Pattern Recognition, Vol 27 No 7, pages
879-884, 1994.
33
APPENDIX
A
AIMPLEMENTATION IN 2D
Early during the project, 2D active contours were implemented
allowing basic experiments. This appendix describes the imple-
mentation in detail, so that the experiments are easily reconstruc-
tible. An example of the usage of this implementation can be found
in Chapter 2.
A.1 COMMENTS ON IMPLEMENTING
CONTOURS
The cont r ol point s should have cont inuous
coor dinat es and so be able t o be sit uat ed
bet ween pixels. This is necessar y t o get a
st able solut ion, but it also makes it necessar y
t o int er polat e t he at t r act or image.
If no nor malizat ion of t he image for ce is done,
it may be necessar y t o set a maximum level
on t he inuence fr om t he at t r act or image.
A.2 AN IMPLEMENTATION IN MATLAB
The implement at ion is made in MATLAB 4.2c
using t he Image Processing Toolbox for showing
(imshow) and lt er ing (filter2) images.
Complex coor dinat es ar e used, i.e., t he coor di-
nat es (x, y) in t he image ar e r epr esent ed wit h t he
complex number x + iy. The r eason for t his is sim-
plicit y; t he gr adient vect or s ar e r epr esent ed by
one complex number each, and t he mat r ix indi-
ces become t he same in t he image and in t he vec-
t or eld.
Step 1: Suggesting the initial contour
To let t he user suggest a cont our, t he image is
displayed and t he funct ion getsnake is called:
>> load(blood)
>> imshow(blood)
>> v1 = getsnake(circ);
Suggest starting points with left
mouse button.
When finished, click right mouse button.
Calculating spline...
Placing points...
>> v2 = getsnake(circ);
Suggest starting points with left
mouse button.
When finished, click right mouse button.
Calculating spline...
Placing points...
The funct ion getsnake r eads t he coor dinat es of
mouse-clicks on t he image, and calculat es splines
bet ween t he click point s. Cont r ol point s ar e t hen
placed along t he splines appr oximat ely ever y
four t h pixel.
The ar gument t o getsnake can be circ or
line and det er mines whet her t he cont our is
t o be open or closed. getsnake r et ur ns a vect or
of cont r ol point s.
Step 2: Calculating the attractor image
Two gr adient lt er s, g
x
and g
y
, ar e used t o cr eat e
t he at t r act or image.
By weight ing t hese lt er s wit h unit lengt h
vect or s (i.e., complex number s) in t he appr opr i-
at e dir ect ions, one can cr eat e a gr adient lt er g:
>> g = gy + i*gx;
The at t r act or image, p, is t hen cr eat ed wit h
t he funct ion absgrad2 which lt er s t he image
wit h t he gr adient lt er in t wo scales. The r esult s
ar e added, nor malized and squar ed as shown in
Figur e A.1:
>> p = absgrad2(blood,g);
g
y
1 0 1
2 0 2
1 0 1
= g
x
1 2 1
0 0 0
1 2 1
=
34 APPENDIX A: IMPLEMENTATION IN 2D
Active Contours in Three Dimensions
Finally, t he image for ce is calculat ed as a vec-
t or eld:
>> imgf = filter2(g,p);
Step 3: Iterate
The it er at ion is car r ied out by t he funct ion
snake in t he following way:
>> u1 = snake(0.25, 0.005, 0.5, imgf,...
v1, 100, circ, 1, 4);
>> u2 = snake(0.25, 0.005, 0.5, imgf,...
v2, 100, circ, 1, 4);
The par amet er s t o t his funct ion ar e:
w_elast and w_rgd ar e t he - and t he -
funct ion (const ant s) t hat det er mine t he elas-
t icit y and r igidit y accor ding t o (2.2). Lar ger
values t han t he above given, 0.25 and 0.005
r espect ively, t end t o give unst able cont our s.
clip is t he maximum allowed level of image
for ce inuence.
imgf is t he gr adient of t he at t r act or image t o
be used (calculat ed in St ep 2 above).
v is t he or iginally suggest ed cont our (a vect or
of cont r ol point s) fr om St ep 1 above.
iterations det er mines t he number of it er a-
t ions t o be done.
snaketype is line or circ and det er -
mines if t he cont our is open or closed.
mind and maxd det er mine t he condit ions for
adding/r emoving cont r ol point s. mind should
be less t han half of maxd.
The funct ion snake uses t he funct ion snakemat,
which calculat es t he mat r ix A accor ding t o (2.8),
ip which makes t he int er polat ions of t he at t r ac-
t or image gr adient and t he funct ions mindist/
maxdist which r emove/add cont r ol point s.
Fi gur e A.2: The MATLAB function snake.
A.3 ESTIMATING LOCAL ORIENTATION
In Sect ion 3.3, At t r act ing t o Local Or ient at ion in
2D Images, t he magnit ude of local or ient at ion is
est imat ed in an image. This est imat e is calcu-
lat ed using t he MATLAB funct ion absorient
which wor ks accor ding t o t he same scheme as
absgrad2 (see Figur e A.1). However, t he oper a-
t ion is r eplaced wit h t he funct ion ori-
entv t hat calculat es t he or ient at ion vect or of
which t he lengt h equals t he expr ession given in
equat ion (3.7).
>> p = absorient(image,g1,g2,g3,g4);
The lt er s g1,..., g4 given as ar gument s should
be complex edge/line det ect or s, such as t he fol-
lowing:
f x ( )
2
f x ( )
2
LP-lt er
Subsample
Upsample
Nor malize
Squar e
Or iginal image
At t r act or image
Fi gur e A.1: The MATLAB-function
absgrad2.

snakemat ip It er at e
mindist
maxdist
snake
f x ( )
2
A.4 MATLAB SOURCE CODE 35
Computer Vision Laboratory, Linkping University
A.4 MATLAB SOURCE CODE
The sour ce code of all funct ions ment ioned in t his
appendix follows in t he or der t hey ar e t r eat ed
above.
Step 1: Suggesting the initial contour
MATLAB-function: getsnake
function u = getsnake(snaketype)
disp(Suggest starting points with left
mouse button.);
disp(When finished, click right mouse but-
ton.);
t=1;
while (t==1)
[x,y,t] = ginput(1);
u0 = [u0; x+i*y];
end
disp(Calculating spline...);
clicks = length(u0);
if snaketype == circ
u0(clicks) = u0(1);
elseif snaketype == line
clicks = clicks-1;
u0 = u0(1:clicks);
end
s = [0:clicks-1]/(clicks-1);
pp = spline(s,u0);
disp(Placing points...);
u = u0(1); n = 1;
for j = 2:clicks
dist = abs(u0(j) - u0(j-1));
steps = round(dist);
for k = 1:steps
unext = ppval(pp, ...
(j-2+k/steps)/(clicks-1));
if abs(u(n) - unext) > 3
u = [u; unext];
n = n+1;
end
end
end
end
Step 2: Calculating the attractor image
MATLAB-function: absgrad2
function energy = absgrad2(img,g)
energy = abs(filter2(g,img));
img2 = subsample(img);
energy2 = abs(filter2(g,img2));
energy2 = upsample(size(img),energy2);
energy = energy + energy2;
energy = (energy/max(max(energy))).^2;
end
MATLAB-function: subsample
function img = subsample(img)
sz = size(img);
img = filter2(ones(3,3)/9,img);
img = img(1:2:sz(1),1:2:sz(2));
end
MATLAB-function: upsample
function img = upsample(newsz,img);
sz = size(img);
x = newsz(1); y = newsz(2);
ipx = (x-1)*(0:sz(1)-1)/(sz(1)-1);
ipy = (y-1)*(0:sz(2)-1)/(sz(2)-1);
img = interp2(ipx,ipy,img,...
ones(x,1)*[0:x-1],...
[0:y-1]*ones(1,y));
end
Step 2: Iterate
MATLAB-function: snake
function v = snake(w_elast, w_rgd,...
clip_img, imgf,...
v,iterations,...
snaketype,mind,maxd)
for j=1:iterations
% Calculate the iteration matrix A
if (maxd>0 | mind>0 | j==1)
A = snakemat(w_elast,w_rgd,...
length(v),snaketype);
end
% Calculate grad(p(v,f)) by interpolation
imgfv = ip(imgf,v);
imgfv = min(clip_img*sign(imgfv),imgfv);
if(snaketype==line)
imgfv(1)=0; imgfv(length(imgfv))=0;
end
% The iteration step
v = v + imgfv - A*v;
% Add/remove control points
if mind>0; v = mindist(mind,v); end
if maxd>0; v = maxdist(maxd,v); end
end
g1
0 2 0
4 4 4
0 2 0
i
1 0 1
2 0 2
1 0 1
+ =
g2
2 0 4
0 4 0
4 0 2
i
0 1 2
1 0 1
2 1 0
+ =
g3
0 4 0
2 4 2
0 4 0
i
1 2 1
0 0 0
1 2 1
+ =
g4
4 0 2
0 4 0
2 0 4
i
2 1 0
1 0 1
0 1 2
+ =
36 APPENDIX A: IMPLEMENTATION IN 2D
Active Contours in Three Dimensions
MATLAB-function: snakemat
function A = snakemat(elast,rgd,n,snaketype)
B = [elast -rgd]*[0 -1 2 -1 0; 1 -4 6 -4 1];
B = ones(n,1)*B; d = -2:2;
if snaketype == circ
B = [B(:,5:-1:4) B B(:,2:-1:1)];
d = [2-n 1-n -2:2 n-1 n-2];
elseif ~(snaketype == line)
error(Use snaketype line or circ);
end
A = spdiags(B,d,spalloc(n,n,5*n)...
+sparse(1,1,1,n,n));
if snaketype == line
A(1,:) = zeros(1,n);
A(n,:) = zeros(1,n);
A(2,1:4) = elast*[-1 2 -1 0];
A(n-1,n-3:n) = elast*[0 -1 2 -1];
end
end
MATLAB-function: ip
function y = ip(img,coords)
sz = size(img);
y = interp2(1:sz(1),1:sz(2),img,...
real(coords),imag(coords));
end
MATLAB-function: mindist
function u = mindist(dist,u);
for j=2:length(u)-1
if(abs(u(j)-u(j-1)) < dist...
& abs(u(j)-u(j+1)) < dist)
u = remove(j,u);
u = mindist(dist,u);
break;
end
end
end
MATLAB-function: maxdist
function u = maxdist(dist,u);
L = length(u);
for j = 1:L-1
vector = u(j+1) - u(j);
q = abs(vector)/dist;
if q > 1
newpoints = floor(q);
newvector = vector/(newpoints+1);
for k=1:newpoints
u = insert(u(j)+k*newvector,j+k,u);
end
u = maxdist(dist,u);
break;
end
end
end
Estimating local orientation
MATLAB-function: absorient
function grad = absorient(img,g1,g2,g3,g4)
grad = abs(orientv(img,g1,g2,g3,g4));
img2 = subsample(img);
grad2 = abs(orientv(img2,g1,g2,g3,g4));
grad2 = upsample(size(img),grad2);
grad = grad + grad2;
grad = (grad/max(max(grad))).^2;
end
MATLAB-function: orientv
function or = orientv(img,g1,g2,g3,g4)
Q1 = abs(filter2(g1,img));
Q2 = abs(filter2(g2,img));
Q3 = abs(filter2(g3,img));
Q4 = abs(filter2(g4,img));
or = Q1-Q3 + i*(Q2-Q4);
end
37
APPENDIX
B
BIMPLEMENTATION IN 3D
This appendix is an overview of the software that was developed
while implementing 3D active contours. The class hierarchy is
explained, as well as some non-trivial algorithms for polyhedrons.
B.1 ENVIRONMENT
Some not es on t he envir onment s used ar e
included t o make t he r est of t he appendix under -
st andable.
Image catalogues
3D image volumes ar e st or ed in image cata-
logues. An image cat alogue is a dir ect or y which
cont ains sever al les; one for each dimension of
t he element s in t he image for each volume slice.
The gr adient eld of an image wit h t he size
will t her efor e be st or ed as 30 les.
This is, however, quit e t r anspar ent t o t he user.
GOP
The GOP, General Operator Processor, is a special-
ized comput er for image pr ocessing oper at ions.
The oper at ions ar e st ar t ed fr om a UNIX t er minal
wit h t he command run followed by mor e specic
or der s. The GOP per for ms it s oper at ions on image
cat alogues.
AVS
AVS, Application Visualization S ystem fr om
Advanced Visual S ystems, Inc., is a modular sys-
t em t hat let s t he user build net wor ks connect ing
modules each per for ming a specic t ask. The
modules can be pr edened, or t he user can wr it e
his own modules in C or For t r an. Ther e is a lar ge
amount of pr edened modules available for l-
t er ing images, pr esent ing dat a, per for ming
mat hemat ical oper at ions, et c.
An example of a ver y simple AVS net wor k is
shown in Figur e B.1, wher e t he pr edened mod-
ules animated integer, field math and
field to byte ar e used wit h t he module
AttractorImage (wr it t en as a par t of t his
pr oject ) and t he modules PickICimage and
eigenvectors pr ovided by t he Comput er Vision
Lab.
St ep t wo of t he segment ing pr ocess (see Sec-
t ion 2.3, The Cont our-t t ing Pr ocess), i.e., cal-
culat ing t he at t r act or image, is per for med par t ly
by an AVS net wor k. The t hir d st ep, t he it er at ion,
is per for med fully by an AVS module (Active-
Contour).
For infor mat ion on t he AVS dat a st r uct ur es,
see t he AVS Developer s Guide or [13].
B.2 CREATING THE ATTRACTOR IMAGE
The at t r act or image is cr eat ed accor ding t o t he
six st eps descr ibed in Sect ion 3.5, Cr eat ing t he
At t r act or Image.
Step 1: Tensor ltering
This st ep is per for med wit h t he GOP:
run trace in=original out=tensor, s16, s16,
s16, s16, s16, s16 krn=quad3D7a2b
The input is an image cat alogue, original.ic,
cont aining t he or iginal image. The out put is a
new image cat alogue, tensor.ic, wher e each
pixel has a six-dimensional value.
Step 2: Averaging
This st ep is per for med wit h t he GOP:
run saver3D in=tensor out=tensor_aver, s16,
s16, s16, s16, s16, s16 S16=1
10 10 10
38 APPENDIX B: IMPLEMENTATION IN 3D
Active Contours in Three Dimensions
Step 3: Eigenvalues
The t ensor-lt er ed image cat alogue is loaded int o
t he AVS envir onment and t he module eigenvec-
tors is used t o calculat e t he eigenvalues. The
AVS net wor k used is shown in Figur e B.1. The
module animated integer makes t he module
PickICimage t r aver se an image cat alogue and
send each image t o eigenvectors, which passes
t he vect or eld of eigenvalues on t o Attrac-
torImage.
Steps 4 and 5: Finding planar structure and
thresholding
The est imat e of planar st r uct ur e, as well as t he
t hr esholding, is made by t he AVS-module
AttractorImage in t he net wor k shown in Fig-
ur e B.1. Depending on t he par amet er Delta (a
t oggle but t on) t he user can choose which of t he
t wo suggest ed cer t aint y est imat es is used.
The module cont ains t he funct ion Compute
which is called each t ime t he value on t he input
por t is changed. This funct ion does it s comput a-
t ion on one slice of t he image and put s t he r esult
on t he out put por t .
Step 6: Gradient ltering
The gr adient lt er ing is most easily per for med
by t he GOP:
run grad3D in=attractorimage out=imageforce,
s16, s16, s16
B.3 THE ACTIVE CONTOUR MODEL
The act ive cont our model is implement ed as an
AVS module oper at ing on classes r epr esent ing
cont our s and vect or elds. The module is suit ably
included in a net wor k as t he one shown in Figur e
B.2. The Read IC modules r ead image cat a-
logues int o 3D elds - t he left hand module r eads
t he image for ce eld, and t he r ight hand module
r eads t he or iginal image for visualizat ion. The
out put (t hr ough t he geomet r y viewer ) is an
image such as t he one shown in Figur e 6.7.
The AVS module ActiveContour
The module ActiveContour can be compiled
int o t wo differ ent modules, ActiveTube and
ActiveSphere, using t he mesh and t he polyhe-
dr on r epr esent at ion of an act ive cont our r espec-
t ively.
The module has one input por t , t he image
for ce as a 3D eld of 3D vect or s, and t wo out put
por t s. The out put por t s bot h deliver t he cur r ent
shape of t he act ive cont our, one as a eld of 3D-
vect or s and t he ot her as an AVS geomet r y.
The modules par amet er s ar e cont r olled
t hr ough t he user-int er face shown in Figur e B.3.
Fi gur e B.1: The AttractorImage network.
AttractorImage
animated integer
eigenvectors
Pick IC image
Image to IC
Fi gur e B.2: The ActiveContour network.
Read IC
ActiveTube
Read IC
generate colormap orthogonal slicer orthogonal slicer
eld to mesh eld to mesh
geometry viewer
Field dat a
Color map
Geomet r y dat a
B.3 THE ACTIVE CONTOUR MODEL 39
Computer Vision Laboratory, Linkping University
Go one makes t he cont our it er at e once.
Go many st ar t s a chain of it er at ions.
Iterations t ells how many it er at ions should
be made when pr essing Go many.
Expand incr eases t he number of cont r ol
point s on t he cont our.
Clip Image Force det er mines t he maximum
inuence fr om t he image (measur ed in pix-
els).
Active elasticity (rigidity) det er mines if t he
elast icit y (r igidit y) for ce should be pr oject ed
on t he cont our s t angent , i.e t he par amet er

1
(
2
) in equat ion (6.4).
Elasticity is t he (nor malized) st r engt h of t he
elast icit y, i.e t he par amet er in equat ion
(6.4).
Rigidity is t he (nor malized) st r engt h of t he
r igidit y for ce, i.e t he par amet er in equa-
t ion (6.4).
Ination is t he st r engt h of t he inat ion for ce
(in pixels), i.e t he par amet er in equat ion
(6.4).
Fixed ends makes t he ends of t he cylinder-
shaped cont our be xed (only applicable on a
cont our r epr esent ed by a mesh).
Fixed Y makes t he cont r ol point s immovable
in t he y-dimension (only applicable on a
cont our r epr esent ed by a mesh).
Load loads a cont our fr om a le on disk int o
t he module.
Initial contour is a lebr owser t o choose t he
le t o load.
Save saves t he cur r ent cont our t o a le on
disk.
Resulting contour is a lebr owser t o choose
t he le t o load.
Fi gur e B.3: The user-interface of the ActiveContour module.
40 APPENDIX B: IMPLEMENTATION IN 3D
Active Contours in Three Dimensions
Overview of the class hierarchy
The act ive cont our model is implement ed using
six C++ classes. The r elat ionships bet ween t hese
classes ar e illust r at ed in Figur e B.4.
The main classes ar e t he t wo cont our classes,
Polyhedron and Mesh, which ar e used by t he
ActiveContour module for r epr esent ing t he
act ive cont our, and t he class Field, which is
used for r epr esent ing t he vect or elds such as
t he image for ce, t he elast icit y for ce, et c.
The pur pose and funct ion of t he classes ar e as
follows:
Class Field
This class is a basic st or age class for 2D elds
of 3D vect or s. It is used for st or ing t he com-
put ed values of t he for ces t hat inuence t he
cont our, as well as for st or ing t he dat a of t he
cont our it self. In addit ion, t he class cont ains
met hods for int er polat ion of vect or elds
(since t he image for ce eld needs t o be int er -
polat ed) and for pr oject ion of a vect or eld on
anot her (since t he elast icit y should be pr o-
ject ed on t he cont our s t angent plane).
Class Contour
This is a r epr esent at ion-independent abst r act
class for act ive cont our s pr oviding AVS com-
pat ibilit y. The class cont ains met hods for con-
ver t ing t he cont our t o an AVS geomet r y or an
AVS eld, and also met hods for t t ing spher es
t o set s of vect or s (used for appr oximat ing t an-
gent planes accor ding t o equat ion (5.12)).
The class Contour declar es met hods for
cr eat ing polygons (for visualizat ion), expand-
ing (upsampling) t he cont our ) and for det er -
mining which cont r ol point s t o use for
appr oximat ing t he t angent planes (using t he
spher e-t t ing met hod ment ioned above).
Since t hese met hods ar e dependent on t he
r epr esent at ion of t he cont our (mesh or polyhe-
dr on), t hey ar e only declar ed, not dened,
t hus making Contour an abst r act class.
The class Contour is a subclass of t he class
Field, fr om which all st or age handling is
inher it ed.
Class Mesh
The class Mesh is a subclass of t he class Con-
tour, i.e., it is t he mesh r epr esent at ion of an
act ive cont our. Repr esent at ion-independent
met hods ar e inher it ed fr om t he class Con-
tour, and t he r epr esent at ion-dependent
met hods (declar ed in t he class Contour) ar e
dened in t his class.
Class Polyhedron
The class Polyhedron is t he polyhedr on r ep-
r esent at ion of an act ive cont our and is a sub-
class of t he class Contour (t hus inher it ing
r epr esent at ion-independent met hods for
act ive cont our s).
The class Polyhedron cont ains met hods for
keeping t r ack of how t he ver t ices ar e con-
nect ed (using t he class Connection). In addi-
t ion, t he class denes t he r epr esent at ion-
dependent met hods declar ed in t he class Con-
t our.
Class Connection
This is a pr imit ive class keeping t r ack of how
t he ver t ices in a polyhedr on ar e connect ed.
Class Vector
The class Vector is used by all ot her classes
except Connection. It is a simple class for 3D
vect or ar it hmet ics.
Connection
Contour
Field
Mesh
Vector
Polyhedron
A
B
A
B
Aggr egat e,
i.e A consist s of B
B is a subclass of A
Fi gur e B.4: The class hierarchy.
B.3 THE ACTIVE CONTOUR MODEL 41
Computer Vision Laboratory, Linkping University
Compatibility with other visualization packages
The subclasses of class Contour (Mesh and Pol-
yhedron) have built -in met hods for conver t ing
t hemselves t o an AVS eld or an AVS geomet r y,
and all classes can wr it e/r ead t hemselves t o/fr om
a st r eam in ASCII-for mat . Ther e should be no
pr oblems adding IO-met hods for compat ibilit y
wit h any ot her visualizat ion package by adding
t he necessar y met hods t o t he classes Mesh and
Polyhedron.
Polyhedron expansion and connection ordering
For visualizat ion pur poses t he connect ion dat a
for each ver t ex in t he class Polyhedron is
or der ed count er-clockwise, i.e., if looking at t he
(visualizat ion of t he) polyhedr on, t he connect ion
list cor r esponding t o a ver t ex (cont r ol point ) v
j
should point out ver t ices sur r ounding v
j
in coun-
t er-clockwise or der.
To keep t his or der when expanding t he polyhe-
dr on, t he following algor it hm is used when
expanding:
1. Expand t he polyhedr on by placing a new ver -
t ex at t he middle of each edge, i.e., on t he
aver age bet ween t wo connect ed ver t ices.
2. For each old ver t ex (v
a
), r eplace each connec-
t ion t o anot her ver t ex (v
b
) wit h a connect ion t o
t he new ver t ex being t he aver age of v
a
and v
b
.
3. For each old ver t ex, t r aver se t he connect ion
list (now cont aining only new ver t ices). If t wo
ver t ices in t he (cyclic) connect ion list ar e
neighbour s t hen connect t hem t o each ot her.
4. For each new ver t ex, sor t t he connect ions so
t hat t he connect ions ar e neighbour s in t he
(cyclic) connect ion-list if and only if t he cor r e-
sponding ver t ices ar e connect ed.
5. For each new ver t ex v
i
, call t he t wo r st ver t i-
ces in it s connect ion list v
k
and v
l
. If v
i
pr e-
cedes v
l
in v
k
s connect ion list , t hen r ever se v
i
s
connect ion list .
The r eader is invit ed t o ver ify t he validit y of t he
algor it hm as an exer cise of geomet r y.
Second order connections
When comput ing t he r igidit y for ce in a polyhe-
dr on, t he aver age of all ver t ices on a dist ance of
t wo st eps fr om each ver t ex is needed. Ther efor e,
t he class Polyhedron for each ver t ex also st or es
a second or der connect ion list , keeping t r ack of
all ver t ices t wo st eps away. This connect ion list is
cr eat ed when expanding t he polyhedr on in t he
following way: For each ver t ex v
j
, for each ver t ex
v
k
connect ed t o v
j
, for each ver t ex v
l
connect ed t o
v
k
, if v
j
and v
l
ar e not connect ed and not equal,
t hen cr eat e a second or der connect ion bet ween
t hem.
Sammanfattning
Abstract
Nyckelord
Keywords
Rapporttyp
Report: category
Licentiatavhandling
C-uppsats
D-uppsats
vrig rapport
Sprk
Language
Svenska/Swedish
Engelska/English
ISBN
Serietitel och serienummer
Title of series, numbering
URL fr elektronisk version
Titel
Title
Frfattare
Author
Datum
Date
Avdelning, Institution
Division, department
Department of Electrical Engineering
ISRN
Examensarbete
ISSN
LiTH-ISY-EX-1708
9
5
-
1
1
-
0
1
/
l
l
i
Computer Vision Laboratory
Aktiva konturer i tre dimensioner
Active Contours in Three Dimensions
To find a shape in an image, a technique called snakes or active contours can be used. An active
contour is a line that moves towards the sought-for shape in a way controlled by internal forces -
such as rigidity and elasticity - and an image force. The image force should attract the contour to
certain features, such as edges, in the image. This is done by creating an attractor image, which
defines how strongly each point in the image should attract the contour.
In this thesis the extension to contours (surfaces) in three dimensional images is studied. Methods
of representation of the contour and computation of the internal forces are treated.
Also, a new way of creating the attractor image using the orientation tensor to detect planar struc-
ture in 3D images is studied. The new method is not generally superior to those already existing,
but still has its uses in specific applications.
During the project, it turned out that the main problem of active contours in 3D images was insta-
bility due to strong internal forces overriding the influence of the attractor image. The problem
was solved satisfactory by projecting the elasticity force on the contours tangent plane, which
was approximated efficiently using sphere-fitting.
active contours, snakes, balloons, deformable models, local orientation
1996-09-30
Jrgen Ahlberg
http://www.isy.liu.se/cvl/ScOut/
Masters/

Anda mungkin juga menyukai