DTU Informatics Introduction to Medical Image Analysis Rasmus R. Paulsen DTU Informatics rrp@imm.dtu.dk TexPoint fonts.

Post on 01-Apr-2015

218 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

Transcript

DTU Informatics

Introduction to Medical Image AnalysisRasmus R. PaulsenDTU Informatics

rrp@imm.dtu.dk

http://www.imm.dtu.dk/courses/02511

DTU Informatics

1/4/2009Introduction to Medical Imaging2 DTU Informatics, Technical University of Denmark

Lecture 9 – Pixel Classification

9.00 Lecture

Exercises

12.00 – 13.00 Lunch break

13.00 Lecture ?

Exercises

DTU Informatics

1/4/2009Introduction to Medical Imaging3 DTU Informatics, Technical University of Denmark

What can you do after today? Describe the concept of pixel classification Use Matlab to select pixel training data Compute the pixel value ranges in a minimum distance

classifier Implement and use a minimum distance classifier Describe how a pixel value histogram can be

approximated using a Gaussian distribution Describe how the pixel value ranges can be selected in a

parametric classifier Implement and use a parametric classifier Explain the concept of Bayesian classification

DTU Informatics

1/4/2009Introduction to Medical Imaging4 DTU Informatics, Technical University of Denmark

Classification Take a measurement and put it into a class

?Wheels: 2

HP: 50

Weight: 200

• Bike

• Truck

• Car

• Motorbike

• Train

• Bus

Measurement Classes

Classifier

DTU Informatics

1/4/2009Introduction to Medical Imaging5 DTU Informatics, Technical University of Denmark

General Classification Multi-dimensional measurement Pre-defined classes

– Can also be found automatically – can be very difficult!

DTU Informatics

1/4/2009Introduction to Medical Imaging6 DTU Informatics, Technical University of Denmark

Pixel Classification Classify each pixel

– Independent of neighbours Also called labelling

– Put a label on each pixel We look at the pixel value

and assign them a label Labels already definedCT scan of human head

Background

Soft-Tissue

Trabecular Bone

Hard Bone

Quiz: Two class classification with background and object?

DTU Informatics

1/4/2009Introduction to Medical Imaging7 DTU Informatics, Technical University of Denmark

Pixel Classification – formal definition

Pixel value (the measurement) v 2 R

C = c1; : : : ;ckk classes

Classification rule c : R ! f c1; : : :;ckg

DTU Informatics

1/4/2009Introduction to Medical Imaging8 DTU Informatics, Technical University of Denmark

Pixel Classification – example

Pixel value

v 2 [0;255]

C = fbackground;soft-tissue;trabeculae;bonegSet of 4 classes

Classification rule

c : v ! fbackground;soft-tissue;trabeculae;boneg

How do we construct a classification rule?

DTU Informatics

1/4/2009Introduction to Medical Imaging9 DTU Informatics, Technical University of Denmark

Pixel classification rule

background

soft-tissue

trabeculae

bone

How do we do this?

c : v ! fbackground;soft-tissue;trabeculae;boneg

DTU Informatics

1/4/2009Introduction to Medical Imaging10 DTU Informatics, Technical University of Denmark

Pixel classification rule – manual inspection

background soft-tissue trabeculae bone

c : v ! fbackground;soft-tissue;trabeculae;boneg

Looking at some few pixels

DTU Informatics

1/4/2009Introduction to Medical Imaging11 DTU Informatics, Technical University of Denmark

Pixel classification rule – manual inspection

background soft-tissue trabeculae bone

c : v ! fbackground;soft-tissue;trabeculae;boneg

Looking at some few pixels New pixel – where do we put it?

DTU Informatics

1/4/2009Introduction to Medical Imaging12 DTU Informatics, Technical University of Denmark

Pixel classification rule – manual inspection

background soft-tissue trabeculae bone

c : v ! fbackground;soft-tissue;trabeculae;boneg

Looking at some few pixels New pixel – where do we put it?

• Measure the “distance” to the other classes

• Select the closest class

db dst

Minimum distance classification

DTU Informatics

1/4/2009Introduction to Medical Imaging13 DTU Informatics, Technical University of Denmark

Pixel classification ruleMinimum Distance Classification

background soft-tissue trabeculae bone

The possible pixel values are divided into ranges

Here the distance to “background” is equal to “soft-tissue”

Background

range

soft-tissue

range

Trabecular

range

Bone

range

DTU Informatics

1/4/2009Introduction to Medical Imaging14 DTU Informatics, Technical University of Denmark

Pixel classification ruleMinimum Distance Classification

background soft-tissue trabeculae bone

Background

range

soft-tissue

range

Trabecular

range

Bone

range

c(v) =

8>><

>>:

background if v · (4+ 67)=2soft-tissue if (4+ 67)=2< v · (67+ 95)=2trabeculae if (67+ 95)=2< v · (95+ 150)=2bone if v > (95+ 150)=2

DTU Informatics

1/4/2009Introduction to Medical Imaging15 DTU Informatics, Technical University of Denmark

Pixel classification rule For all pixel in the image do

c(v) =

8>><

>>:

background if v · (4+ 67)=2soft-tissue if (4+ 67)=2< v · (67+ 95)=2trabeculae if (67+ 95)=2< v · (95+ 150)=2bone if v > (95+ 150)=2

DTU Informatics

1/4/2009Introduction to Medical Imaging16 DTU Informatics, Technical University of Denmark

Pixel Classification example

Background

Soft-Tissue

Trabecular Bone

Hard Bone

CT scan of human head

DTU Informatics

1/4/2009Introduction to Medical Imaging17 DTU Informatics, Technical University of Denmark

Better range selection Guessing range values is not a

good idea Better to use “training data” Start by selecting representative

regions from an image Annotation

– To mark points, regions, lines or other significant structures

DTU Informatics

1/4/2009Introduction to Medical Imaging18 DTU Informatics, Technical University of Denmark

Classifier training - annotation An “expert” is asked how

many different tissue types that are possible

Then the expert is asked to mark representative regions of the selected tissue types

Background

Soft-Tissue

Trabecular Bone

Hard Bone

DTU Informatics

1/4/2009Introduction to Medical Imaging19 DTU Informatics, Technical University of Denmark

Classifier training – region selection Many tools exist Matlab tool roipoly

– Select closed regions using a piecewise polygon

Training is only done once!

Optimally, the training can be used on many pictures that contains the same

tissue types

DTU Informatics

1/4/2009Introduction to Medical Imaging20 DTU Informatics, Technical University of Denmark

Initial analysis - histograms

Gaussian

DTU Informatics

1/4/2009Introduction to Medical Imaging21 DTU Informatics, Technical University of Denmark

Initial analysis - histograms

Class separation

DTU Informatics

1/4/2009Introduction to Medical Imaging22 DTU Informatics, Technical University of Denmark

Simple pixel statistics Calculate the average (mean) and the standard

deviation of each class

Average

Standard deviation

DTU Informatics

1/4/2009Introduction to Medical Imaging23 DTU Informatics, Technical University of Denmark

DTU Informatics

1/4/2009Introduction to Medical Imaging24 DTU Informatics, Technical University of Denmark

Minimum distance classification

Any objections?

The pixel value ranges are not always in good correspondence with the histograms?

DTU Informatics

1/4/2009Introduction to Medical Imaging25 DTU Informatics, Technical University of Denmark

Exam question 09.15

DTU Informatics

1/4/2009Introduction to Medical Imaging26 DTU Informatics, Technical University of Denmark

Parametric classification Describe the histogram using

a few parameters Gaussian/Normal distribution

– Average– Standard deviation

Trabecular bone

f (x) =1

¾p

2¼exp

µ¡

(x ¡ ¹ )2

2¾2

¹¾

Only two values needed

DTU Informatics

1/4/2009Introduction to Medical Imaging27 DTU Informatics, Technical University of Denmark

Parametric classification

Trabecular bone f (x) =1

¾p

2¼exp

µ¡

(x ¡ ¹ )2

2¾2

¹̂ =1n

nX

i=1

vi

¾̂2 =1

n ¡ 1

nX

i=1

(vi ¡ ¹̂ )

v1;v2; : : : ;vn ;Training pixel values

Estimated average

Estimated

standard

deviation

DTU Informatics

1/4/2009Introduction to Medical Imaging28 DTU Informatics, Technical University of Denmark

Parametric classification Fit a Gaussian to the training pixels for all classes

What do we see here?

What is the difference between the two classes?

Trabeculae has much higher variation in the pixel values

DTU Informatics

1/4/2009Introduction to Medical Imaging29 DTU Informatics, Technical University of Denmark

Parametric classification New pixel with value

78– Is it soft-tissue or

trabecular bone? Minimum distance

classifier?– Soft-tissue

Is that fair?– Soft-tissue Gaussian

says “Extremely low probability that this pixel is soft-tissue”

v = 78

DTU Informatics

1/4/2009Introduction to Medical Imaging30 DTU Informatics, Technical University of Denmark

Parametric classification – repeat the question

New pixel with value 78– Is it soft-tissue or

trabecular bone?– Most probably

trabecular bone Where should we set

the limit?– Where the two

Gaussians cross!

v = 78

DTU Informatics

1/4/2009Introduction to Medical Imaging31 DTU Informatics, Technical University of Denmark

Parametric classification – ranges The pixel value ranges

depends on– The average– The standard

deviation Compared to the

minimum distance classifier– Only the average

Soft-tissue Trabecular bone

DTU Informatics

1/4/2009Introduction to Medical Imaging32 DTU Informatics, Technical University of Denmark

Parametric classification – how to Select training pixels for each class Fit Gaussians to each class Use Gaussians to determine pixel value ranges Little bit difficult with the Gaussians

DTU Informatics

1/4/2009Introduction to Medical Imaging33 DTU Informatics, Technical University of Denmark

Parametric classifier - ranges We want to compute

where they cross

f 1(x) =1

¾1p

2¼exp

µ¡

(x ¡ ¹ 1)2

2¾21

f 2(x) =1

¾2p

2¼exp

µ¡

(x ¡ ¹ 2)2

2¾22

f 1(x) > f 2(x)

f 1(x) < f 2(x)Create a lookup table:

• Run through all 256 possible pixel values

• Check which Gaussian is the highest

• Store the [value, class] in the table

DTU Informatics

1/4/2009Introduction to Medical Imaging34 DTU Informatics, Technical University of Denmark

Alternatively – analytic solution

v =¾1

2¹ 2 ¡ ¾22¹ 1 §

r

¡ ¾12¾2

2³2¹ 2 ¹ 1 ¡ ¹ 2

2 ¡ 2¾22 ln

³¾2¾1

´¡ ¹ 1

2 + 2¾12 ln

³¾2¾1

´´

¡ ¾22 + ¾1

2

1

¾1p

2¼exp

µ¡

(v ¡ ¹ 1)2

2¾21

¶=

1

¾2p

2¼exp

µ¡

(v ¡ ¹ 2)2

2¾22

¶The two Gaussians

Intercept at

Piece of cake!

DTU Informatics

1/4/2009Introduction to Medical Imaging35 DTU Informatics, Technical University of Denmark

Exam Question 09.2 and 09.19

DTU Informatics

1/4/2009Introduction to Medical Imaging36 DTU Informatics, Technical University of Denmark

Exercises

?

DTU Informatics

1/4/2009Introduction to Medical Imaging37 DTU Informatics, Technical University of Denmark

Bayesian Classification

Area = 1

Pure parametric classifier assumes equal amount of

different tissue types

DTU Informatics

1/4/2009Introduction to Medical Imaging38 DTU Informatics, Technical University of Denmark

Bayesian Classification

Area = 1

Much more soft-tissue than

trabecular bone

How do we handle that?

DTU Informatics

1/4/2009Introduction to Medical Imaging39 DTU Informatics, Technical University of Denmark

Bayesian Classification An expert tells us that a CT

scan of a head contains– 20% Trabecular bone– 50% Soft-tissue

Picking a random pixel in the image– 20% Chance that it is

trabecular bone– 50% Chance that it is soft-

tissue How do use that?

DTU Informatics

1/4/2009Introduction to Medical Imaging40 DTU Informatics, Technical University of Denmark

Bayesian Classification – histogram scaling

Parametric classifier Bayesian classifier

Scaled with 0.50

Scaled with 0.20

Little change in class border

(sometimes significant changes)

DTU Informatics

1/4/2009Introduction to Medical Imaging41 DTU Informatics, Technical University of Denmark

Formal definition Given a pixel value What is the probability that the pixel belongs to class

P (ci jv) =P (vjci )P (ci )

P (v)

vci

Example: If the pixel value is 78, what is the probability that the pixel is bone

DTU Informatics

1/4/2009Introduction to Medical Imaging42 DTU Informatics, Technical University of Denmark

Formal definition

P (ci jv) =P (vjci )P (ci )

P (v)

Constant – ignored from now on

DTU Informatics

1/4/2009Introduction to Medical Imaging43 DTU Informatics, Technical University of Denmark

Formal definition

P (ci jv) =P (vjci )P (ci )

P (v)

The a priori probability (what is known from before)

Example: From general biology it is known that 20% of a brain CT scan is trabecular bone. Therefore P(trabecular) = 0.20

DTU Informatics

1/4/2009Introduction to Medical Imaging44 DTU Informatics, Technical University of Denmark

Formal definition

P (ci jv) =P (vjci )P (ci )

P (v)

The class conditional probability Given a class, what is the probability of a pixel with value v

Example: If we consider class = soft-tissue. What is the probability that the pixel value is 78?

Very low

DTU Informatics

1/4/2009Introduction to Medical Imaging45 DTU Informatics, Technical University of Denmark

Formal definition – sum up

P (ci jv) =P (vjci )P (ci )

P (v)ci = trabeculae

DTU Informatics

1/4/2009Introduction to Medical Imaging46 DTU Informatics, Technical University of Denmark

Parametric classification – how to Select training pixels for each class Fit Gaussians to each class Ask an expert for the prior probabilities (how much

there normally is in total of each type) For each pixel in the image

– Compute for each class (the a posterior probability)– Select the class with the highest

P (ci jv)P (ci jv)

P (ci jv) =P (vjci )P (ci )

P (v)

DTU Informatics

1/4/2009Introduction to Medical Imaging47 DTU Informatics, Technical University of Denmark

When to use Bayesian classification The parametric classifier is good when there are

approximately the same amount of all type of tissues Use Bayesian classification if there are very little or

very much of some types

DTU Informatics

1/4/2009Introduction to Medical Imaging48 DTU Informatics, Technical University of Denmark

Exercises

?

top related