introduction to image segmentation (lecture...

Post on 16-Mar-2018

219 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Introduction to Image Segmentation

(Lecture #12)

Antonio Zanotti Radiology Department

11/09/2012

Lecture Outline

• The role of segmentation in medical imaging

• Thresholding

• Erosion and dilation operators

• Region growing

• Snakes and active contours

• Level set method

Why doing image segmentation?

• The goal of image segmentation is to partition a volumetric medical image into separate regions, usually anatomic structures (tissue types) that are meaningful for a specific task

• So image segmentation is sub- division of image in different regions

Examples

• Carotid wall in angiographic/neorological studies.

• Lesion’s quantification (neoplasia,schlerosys, etc)

• Simulation and planning of a surgery

• To measure perimeters, surfaces and volumes

Flow chart

Original image

Recognition

Dynamic reduction

Shape recognition

Application of the appropriate filter/algorithm

A segmented image is always binary (except in some cases)

Based on different models, like phantoms

Very important to understand

There is no optimal algorithm for image segmentation It depends on the type of image, what we are looking for, to the accuracy needed.

Global Thresholding

When we have a bimodal histogram, we can establish a threshold value, and every pixel up that value is the object and every pixel behind that value is the background

1 if (a[m,n] > T) g[m,n] = 0 if (a[m,n] ≤ T)

Matlab example >> A=imread('im_00004.jpg');

>> imagesc(A), colormap gray

>> figure

>> imhist(A)

>> level = graythresh(A)

level =

0.3412

>> level*255

ans =

87

>> BW = im2bw(A,level);

>> figure

>> imagesc(BW), colormap gray

>> A=imread('im_00004.jpg');

>> imagesc(A), colormap gray

>> figure

>> imhist(A)

>> [x,y]=find(A>=87);

>> clear BW

>> BW=zeros(512,512);

>> for i = 1:length(x)

BW(x(i),y(i))=1;

end

>> imagesc(BW), colormap

gray

Non-global threshold

)},(),,(,,{( yxIyxpyxfT

The threshold T is global if only depends on f(x,y)

If T depends also of p(x,y), is called local threshold. For example, It depends on

the outcome of a kernel applied to the image.

If T depends also of (x,y), the threshold is dinamic. It depends on the location of

the pixel.

Dot detection

The detection of isolated points in the image and very diverse of the background is done by the following filter

Laplacian filter

If R = sum of the values of the product between filter coefficients and image T = Threshold (NON NEGATIVE) A point is part of the image if |R|≥ T

Line detection

Using the appropriates filters is possible to detect discontinuities in a certain direction. GRADIENT FILTERS

Horizontal +45º

-45º Vertical

A B

C D

Line detection

Ri: sum of the values of the product and coefficients of the i-th filter and the image A point is on the i-th line if |Ri|>|Rj| ∀ i≠j

Horizontal Vertical +45º -45º

Line detection

RA=40 RB=22 RC=4 RD=172

Morphological operators

They are called like this because they were made to recognise forms, like triangles, circles, etc. They are local operators and there are several possible geometries (lines, circles, squares, rings,…) each one to adjust on the image.

0 0 0 0 0 0 0

0 0 1 1 1 0 0

0 1 1 1 1 1 0

0 1 1 1 1 1 0

0 1 1 1 1 1 0

0 0 1 1 1 0 0

0 0 0 0 0 0 0

Erosion

The value of the output pixel is the minimum between all the pixels selected in the input image by the structural element

1 0 0 0 0 0

0 1 0 0 0 0

0 1 0 1 1 0

0 1 1 1 0 0

0 0 0 1 1 0

0 0

0

0

0

0

1 1 1

Structuring element

Input image Output image

Example of erosion

originalBW = imread('circles.png');

se = strel('disk',11);

erodedBW = imerode(originalBW,se);

imshow(originalBW), figure,

imshow(erodedBW)

Dilation

1 0 0 0 0 0

0 1 0 0 0 0

0 1 0 1 1 0

0 1 1 1 0 0

0 0 0 1 1 0

1 1

1

1

1

0

1 1 1

Structuring element

Input image Output image

The value of the output pixel is the maximum between all the pixels selected in the input image by the structuring element

Example of dilation

originalBW = imread('circles.png');

se = strel('disk',11);

erodedBW = imdilate(originalBW,se);

imshow(originalBW), figure,

imshow(erodedBW)

Opening and Closing Using the erode and dilate operators, we can obtain others, eg Opening = erode, then dilate Closing = dilate, then erode

The structural element remains the same for the erosion and for the dilation. The opening removes the smallest objects of the structural element preserving the background. The closure removes the background in favor of the objects -> very used to make "hole filling “

Example of Closing

closeBW = imclose(originalBW,se);

figure, imshow(closeBW)

Example of Opening

closeBW = imopen(originalBW,se);

figure, imshow(closeBW)

Region Growing

•Group of pixels or sub-regions into larger regions when homogeneity criterion is satisfied. •Regions grows around the seed point based on similar properties (gray level, textures, colors) PROS: •Better in noisy images where edges are hard to identify

CONS: •Seed point must be specified •Different seed point will give different results

Matlab example

[x y]=find(A<=(value+ amplitudT/2)&A>=(value-

amplitudT/2));

BW=zeros(size(A));

for i=1:length(x)

BW(x(i),y(i))=1;

end

%figure, imagesc(BW), colormap gray

cc = bwconncomp(BW);

labeled = labelmatrix(cc);

regionLabel=labeled(seedx,seedy);

clear x y BW

BW=zeros(size(A));

[x y]=find(labeled==regionLabel);

for i=1:length(x)

BW(x(i),y(i))=1;

end

% function to implement region

growing

%

% BW=region(A,seedx,seedy)

%

% input parameters

% A image to implement the

region growing

% seedx & seedy coordenates of

the seed

% output parameters

% BW is the black&white image

function [BW] =

region(A,seedx,seedy)

value=A(seedx,seedy);

amplitudT = 40;

Example

Values of threshold- min=200 max=300

Deformable Models The snakes are deformable curves under the effect of. a. Internal forces because of the curve itself b. External forces because of experimental data

The balance between the two forces is what determinates the adjustment of the snake to certain forms, objects, edges, or another image feature. There are two types • Parametric active contours • Geometric active contours

Continuity controlled model

Internal forces prevent the curve to break (elasticity) or to roll (tightness) . The model adjusts the best it cans to edges respecting the constraints imposed about tightness and elasticity External forces Gradients that attracts or rejects the curve

Snakes Two problems • The result depends a lot of the initial conditions • Local minimums

Continuity controlled model Representation of the snake in planar curvilinear coordinates

]1,0[

)](),([)(:

s

sysxsvs

The function to minimize is:

1

0

22))(())('')('(

2

1dssvEsvsvE ext

Internal Energy Imposes the regularity of the snake

1

0

22))(())('')('(

2

1dssvEsvsvE ext

The α and β coefficients control the regularity of the curve and weigh the two contributions: a. α modulates the elasticity/stretching b. β modulates the stiffness/bending

External Energy

• Supose we have an image • Can compute the gradient •Edge strength at pixel (x,y) is •External energy of a contour point v=(x,y) could be:

•External energy term for the whole snake is:

),( yxI

),( yxI

),( yxI

22),()( yxIvIE

1

0

))(( dssvEE ext

Equation to minimize

1

0

22))(())('')('(

2

1dssvEsvsvE ext

Equivalent to say

0ds

dE

0int extFF

PROBLEM = LOCAL MINIMUM

Level Set Method Proposed by Osher and Sethian

nxxC :,0)(|

Level Set Method

The level set approach:

Define problem in 1 higher dimension Define level set function z = (x,y,t = 0) where the (x,y) plane contains the contour, and z = signed Euclidean distance transform value (negative means inside closed contour, positive means outside contour)

Level Set Method

Contour = cross section at z = 0, i.e.,

{(x,y) | (x,y,t) = 0}

Level Set Method

0y

Φ

x

ΦF

t

Φ

0ΦFt

Φ

2122

1. Define a velocity field, F, that specifies how contour points move in time. • Based on application-specific physics such as time, position, normal,

curvature, image gradient magnitude 2. Build an initial value for the level set function, (x,y,t=0), based on the initial

contour position 3. Adjust over time; contour at time t defined by (x(t), y(t), t) = 0

Level Set Method Constraint: level set value of a point on the contour with motion x(t) must always be 0

(x(t), t) = 0

By the chain rule t + (x(t), t) · x(t) = 0

Since F supplies the speed in the outward normal direction x(t) · n = F, where n = / ||

Hence evolution equation for is t + F|| = 0

Speed Function F Two terms, one to attract it to discontinuities and another to smooth.

Speed Function F

There are different ways to define the sped function. Another, is the one proposed by Chan and Vese that make the model independent of edges and gradients

C1 = mean value of the pixels inside C C2 = mean value of the pixels outside C

Level Set

top related