Aniso Diff Filtering

37
1 Segmentierung medizinischer Bilddaten Stefan Burkhardt 8 Anisotropic diffusion filtering 8 Anisotropic diffusion filtering Images contain of the image itself and noise Noise: random, little disturbances of the image To improve the segmentation: the noise should be reduced Condition: Remove noise But: keep the image information unchanged

Transcript of Aniso Diff Filtering

Page 1: Aniso Diff Filtering

1Segmentierung medizinischer BilddatenStefan Burkhardt

8 Anisotropic diffusion filtering

8 Anisotropic diffusion filtering

� Images contain of the image itself and noise

�Noise: random, little disturbances of the image

�To improve the segmentation: the noise should be reduced

�Condition:

•Remove noise

•But: keep the image information unchanged

Page 2: Aniso Diff Filtering

2Segmentierung medizinischer BilddatenStefan Burkhardt

8 Anisotropic diffusion filtering

Diffusion

�Physical process for balancing concentration changes

�Now:

• the image intensity can be seen as a “concentration”

•The noise can be modelled as little concentration inhomogeneities

�These inhomogeneities could be smoothed by diffusion

�Diffusion should only be perpendicular e.g. to edges

Page 3: Aniso Diff Filtering

3Segmentierung medizinischer BilddatenStefan Burkhardt

8.1 Physical background

Physical background of diffusion

�Given: a concentration distribution u

�Fick’s law:

�Concentration gradient causes a flux j

� j aims to compensate the gradient

�D: diffusion tensor, in general a positive definite, symmetric matrix

u∇⋅−= Dj

Page 4: Aniso Diff Filtering

4Segmentierung medizinischer BilddatenStefan Burkhardt

8.1 Physical background

Physical background of diffusion (2)

�Diffusion is mass transport without destroying mass or creating new mass

�Continuity equation

� t denotes the time, �tu the deviation of u with respect to t

���

����

∂∂+

∂∂−=−=∂

yxut

jjjdiv

Page 5: Aniso Diff Filtering

5Segmentierung medizinischer BilddatenStefan Burkhardt

8.1 Physical background

Physical background of diffusion (3)

�diffusion equation

�Application in many physical transport process, e.g. for heat transfer it is called heat-transfer-equation

� Image processing:

� Identify the concentration with the grey value at a certain location

( )uut ∇⋅=∂ Ddiv

Page 6: Aniso Diff Filtering

6Segmentierung medizinischer BilddatenStefan Burkhardt

8.1 Physical background

Physical background of diffusion (4)

�Diffusion tensor:

•Constant over the whole image: homogeneous (or linear) diffusion

•Often it is a function of the structure of the image itself: nonlinear diffusion

•Isotropic: j and the concentration gradient are parallel

•Anisotropic: otherwise

Page 7: Aniso Diff Filtering

7Segmentierung medizinischer BilddatenStefan Burkhardt

8.2 Linear diffusion

Linear isotropic diffusion

�Mostly used for smoothing images

�The image I itself is the initial starting for the diffusion process

�We use D = 1 since D only influences the speed of the diffusion

),()0,,(

div

yxIyxu

uut==∂

Page 8: Aniso Diff Filtering

8Segmentierung medizinischer BilddatenStefan Burkhardt

8.2 Linear diffusion

Linear isotropic diffusion (2)

t=4 t=8 t=12

t=20t=16 t=24 t=40

t=0

Page 9: Aniso Diff Filtering

9Segmentierung medizinischer BilddatenStefan Burkhardt

8.2 Linear diffusion

Linear isotropic diffusion (3)

�Advantages:

•Continuously simplifying of the image

•Reducing the noise in the image

�Disadvantages:

•Linear isotropic diffusion does not only reduce noise

•It also blues important features like edges

•No a-priori knowledge is taken into account

•Result: it makes edges harder to identify

Page 10: Aniso Diff Filtering

10Segmentierung medizinischer BilddatenStefan Burkhardt

8.3 Nonlinear diffusion

Nonlinear diffusion

� Improvement:

•Preservation of the edges, only smooting between edges

•Need to assign a position specific diffusivity

�Adapting the diffusivity g to the gradient in the actual image u(x,y,t)

�We obtain the equation

( )( )uuu ∇∇=∂ 2div gt

Page 11: Aniso Diff Filtering

11Segmentierung medizinischer BilddatenStefan Burkhardt

8.3 Nonlinear diffusion

0ufor1

ufor0

→∇→∞→∇→

g

g

Nonlinear diffusion (2)

�Conditions for g

�Perona& Malik:

( )2

2

2

1

1

λu

ug∇

+=∇

Page 12: Aniso Diff Filtering

12Segmentierung medizinischer BilddatenStefan Burkhardt

8.3 Nonlinear diffusion

Nonlinear diffusion (3)

t=4 t=8 t=12

t=20t=16 t=24 t=40

t=0

Page 13: Aniso Diff Filtering

13Segmentierung medizinischer BilddatenStefan Burkhardt

8.3 Nonlinear diffusion

Nonlinear diffusion (4)

t=4 t=20 t=40

t=40t=20t=4

Linear diffusion

Nonlineardiffusion

Page 14: Aniso Diff Filtering

14Segmentierung medizinischer BilddatenStefan Burkhardt

8.3 Nonlinear diffusion

Nonlinear diffusion (5)

�Advantages

•Steering of the diffusion at each point of the image is possible

•So diffusion can be reduced on edges

•The result: edge-preserving image smoothing

•But: the smoothing of the edges cannot be completely circumvented

�Next: anisotropic approaches

Page 15: Aniso Diff Filtering

15Segmentierung medizinischer BilddatenStefan Burkhardt

8.4 Nonlinear anisotropic diffusion

Nonlinear anisotropic diffusion

�Until now: determination of the amount of diffusion depending on local features (here: the gradient).

�Other features could be possible

� Idea: we could define the diffusion tensor so that the diffusion goes around some structures

�Here: diffusion should preserve edges

•On edges: no diffusion over edges, but diffusion parallel to edges should be enabled

Page 16: Aniso Diff Filtering

16Segmentierung medizinischer BilddatenStefan Burkhardt

8.4 Nonlinear anisotropic diffusion

Nonlinear anisotropic diffusion (2)

�Combination of two features

•Non-linearity

-The diffusion at border is much less than the diffusion elsewhere

•Anisotropy

-Diffusion should be perpendicular to edge

-No diffusion over edges

Page 17: Aniso Diff Filtering

17Segmentierung medizinischer BilddatenStefan Burkhardt

8.4 Nonlinear anisotropic diffusion

Nonlinear anisotropic diffusion (3)

�How to define the diffusion tensor D?

�Remember: D is a positive definite symmetric matrix

•It has two different eigenvalues and two eigenvectors

•Therewith the eigenvectors are perpendicular

•The eigenvectors gives the main diffusion direction

•The corresponding eigenvalues the strength of diffusion in the direction of the eigenvectors.

Page 18: Aniso Diff Filtering

18Segmentierung medizinischer BilddatenStefan Burkhardt

�Definition of the eigenvectors

�We want to stop the diffusion over the edge. Therewith we need as one eigenvector the direction of the gradient.

�The second is perpendicular and can be seen as the tangential vector to the edge

8.4 Nonlinear anisotropic diffusion

[ ][ ] ���

����

−=

∇∇=

x

y

v

vv

u

uv

1

12

1

Nonlinear anisotropic diffusion (4)

uv

uv

∇⊥∇

2

1 ||

Page 19: Aniso Diff Filtering

19Segmentierung medizinischer BilddatenStefan Burkhardt

�Definition of the eigenvalues

�First: We want to stop the diffusion over the edge (direction v1). We use the non-linearity and define

�Perpendicular to the edge the diffusion should not be stopped

8.4 Nonlinear anisotropic diffusion

( )2

1 ug ∇=λ

Nonlinear anisotropic diffusion (5)

12 =λ

Page 20: Aniso Diff Filtering

20Segmentierung medizinischer BilddatenStefan Burkhardt

�Now, we obtain D as

�Result is an edge-enhancing anisotropic diffusion

8.4 Nonlinear anisotropic diffusion

T

���

���

⋅���

����

�⋅���

���

=||

||

0

0

||

||

2

12121 vvvvD

λλ

Nonlinear anisotropic diffusion (6)

Page 21: Aniso Diff Filtering

21Segmentierung medizinischer BilddatenStefan Burkhardt

8.4 Nonlinear anisotropic diffusion

Nonlinear anisotropic diffusion (7)

t=4 t=8 t=12

t=20t=16 t=24 t=40

t=0

Page 22: Aniso Diff Filtering

22Segmentierung medizinischer BilddatenStefan Burkhardt

8.4 Nonlinear anisotropic diffusion

Nonlinear anisotropic diffusion (8)

t=4 t=20 t=40

t=40t=20t=4

Nonlineardiffusion

Nonlinearanisotropicdiffusion

Page 23: Aniso Diff Filtering

23Segmentierung medizinischer BilddatenStefan Burkhardt

8.5 Numerical implementations

Numerical implementation

�We have

�Looking for a solution u(x,y,t)

�Either for a specific t = t0

�Or for t��

�Problem: the equation cannot be analytically solved

�Numerical solution is necessary

),()0,,( yxIyxu =

Page 24: Aniso Diff Filtering

24Segmentierung medizinischer BilddatenStefan Burkhardt

�1. step: discretizing the time axis

•Determination of a time step ��

-�� dependson thenumerical stability

•only the times

are taken into account

�We obtain u(x,y,ti)

8.5 Numerical implementations

Numerical implementation (2)

τ∆⋅== itt i

Page 25: Aniso Diff Filtering

25Segmentierung medizinischer BilddatenStefan Burkhardt

�2. step: finding an approximation for the derivative with respect to t

�The Taylor serie for u(x,y,t) leads to

�Neglecting the remain and transform the equation leads to

8.5 Numerical implementations

( )ζττ Rtyxut

tyxutyxu +∂∂⋅∆+=∆+ ),,(),,(),,(

Numerical implementation (3)

),,(),,(),,( 1 iii tyxut

tyxutyxu∂∂⋅∆+=+ τ

Page 26: Aniso Diff Filtering

26Segmentierung medizinischer BilddatenStefan Burkhardt

�Conditions to the step size:

�Dimensions: m, grid width: h

�Costs per iteration: very low

�Efficiency: low (many iterations needed to get a result)

8.5 Numerical implementations

m

h

2

2

<∆τ

Numerical implementation (4)

Page 27: Aniso Diff Filtering

27Segmentierung medizinischer BilddatenStefan Burkhardt

�Until now we used the so-called explicit scheme

�Other notation

with

•I: identity matrix

•ui values of u(x,y,ti) stacked in vector form

•Al(uk) matrix version of the diffusion tensors

8.5 Numerical implementations

Notation

( ) im

l

il

i uuAIu ⋅��

���

� ⋅∆+= �=

+

1

1 τ

Page 28: Aniso Diff Filtering

28Segmentierung medizinischer BilddatenStefan Burkhardt

�Semi-implicit scheme

�Additive operator splitting

8.5 Numerical implementations

( ) im

l

il

i uuAIu ⋅��

���

� ⋅∆−=−

=

+ �1

1

1 τ

Improvements

( )( ) im

l

il

i mm

uuAIu ⋅⋅∆⋅−=−

=

+ �1

1

1 1 τ

Page 29: Aniso Diff Filtering

29Segmentierung medizinischer BilddatenStefan Burkhardt

�Semi-implicit scheme: We can write the derivative of uwith respect to t as

� Implicit: because ui+1 is used

�Semi-implicit: operator Al(ui) is combined with ui+1

�Transformation of the equation leads to

8.5 Numerical implementations

( ) 1

1

1+

=

+

⋅=∆

−� i

m

l

il

ii

A uuuu

τ

Semi-implicit scheme

( ) im

l

il

i uuAIu ⋅�

��

⋅∆−=−

=

+ �1

1

1 τ

Page 30: Aniso Diff Filtering

30Segmentierung medizinischer BilddatenStefan Burkhardt

�Features:

•Stable for ��< �, but: convergenceusually becomesslower for too large ��

•Cost per iteratorion: high, because thematrix must bebuilt and inverted in each iteration, O(n2)

•Efficiency: medium (better than theexplicit schemebecauseof thepossible larger �, but further improvementis possible)

�Question: How could the invertion of thematrix bemoreeffective

•Hint: each Al is a simple tri-diagonal matrix

8.5 Numerical implementations

Semi-implicit scheme (2)

Page 31: Aniso Diff Filtering

31Segmentierung medizinischer BilddatenStefan Burkhardt

�Objective: split the derivation operator for each spatial direction

�Then we get for each direction a simple tri-diagonal matrix

�Such matrices can be very efficiently inverted

�Advantage:

•Keep the unrestrictedness of ��

•Make thecalculation moreeffective

8.5 Numerical implementations

Additive operator splitting (AOS)

Page 32: Aniso Diff Filtering

32Segmentierung medizinischer BilddatenStefan Burkhardt

�One can write

as

8.5 Numerical implementations

( )�

��

⋅∆− �=

m

l

il

1

uAI τ

Additive operator splitting (2)

( )[ ]�=

⋅⋅∆−m

l

imm 1

1

1uAI τ

Page 33: Aniso Diff Filtering

33Segmentierung medizinischer BilddatenStefan Burkhardt

�For thecomputation of the inversematrix weuse theapproximation

�Thenow occuring error is

•only of second and higher order

•This means: the first derivatives haveno errors

8.5 Numerical implementations

( ) 111 −−− +≈+ BABA

Additive operator splitting (3)

Page 34: Aniso Diff Filtering

34Segmentierung medizinischer BilddatenStefan Burkhardt

�And weapproximate the inversematrix by

�Therewith weobtain theequation

8.5 Numerical implementations

( ) ( )[ ]1

11

1

1

1−

=

=�� ⋅⋅∆−≈�

��

⋅∆−m

l

im

l

il m

muAIuAI ττ

Additive operator splitting (4)

( )[ ] im

l

ii mm

uuAIu1

11

1 1−

=

+ � ⋅⋅∆−= τ

Page 35: Aniso Diff Filtering

35Segmentierung medizinischer BilddatenStefan Burkhardt

�Differencesand improvements

•A split in theoperator for each spatial direction has beenperformed

•Thepixels can bearranged for each operator separately

•As result each operator is tri-diagonal matrix and isinverted separately.

•Such 3-diagonal matrices can be inverted in linear time O(n), not in O(n2)

8.5 Numerical implementations

Additive operator splitting (5)

Page 36: Aniso Diff Filtering

36Segmentierung medizinischer BilddatenStefan Burkhardt

�Features

•Stable for ��< �

•Cost per iteratorion: low, but a littlehigher than for theexplicit scheme

�Efficiency: high

8.5 Numerical implementations

Additive operator splitting (6)

Page 37: Aniso Diff Filtering

37Segmentierung medizinischer BilddatenStefan Burkhardt

8.5 Numerical implementations

highlow��<�AOS

mediumhigh��<�Semi-implicit

lowvery lowexplicit

efficiencyCost per iteration

StabilityScheme

Conclusion

m

h

2

2

<∆τ