Anda di halaman 1dari 36

Analisa Citra Medis berdasar Warna

MATERIKULIAH– [8]:
PENGEMBANGAN APLIKASI INFORMATIKA MEDIS
Tim Pengajar:

Chanifah Indah Ratnasari


Izzati Muhimmah
Rahadian Kurniawan
Sri Kusumadewi
Sasaran
• Mahasiswa mengenal konsep warna untuk
analisa citra medis
• Mahasiswa mendapat gambaran penggunaan
rentang warna untuk isolasi objek

Referensi Utama
 Scott Bezan. Image Processing using MATLAB.
Outline

Pengenalan konsep warna untuk analisa citra


medis
Seleksi threshold untuk isolasi objek
Kasus : Sel darah marah (erythrocytes)

Citra Mikroskopis
• Citra erythrocytes normal
terlihat dalam pengamatan
mikroskop
• Medical Technologist
biasanya ditugaskan untuk
menghitung banyaknya sel
darah dan menganalisa
komponen sel darah
Brain Teaser
Citra Mikroskopis
• Apa ciri untuk menentukan
objek sel darah pada citra
mikroskopis di samping?
• Bagaimana cara mengambil
hanya (mengisolasi) objek
sel darah?
Brain Teaser
Citra Mikroskopis
• Apa ciri untuk menentukan
objek sel darah pada citra
mikroskopis di samping?
• Bagaimana cara mengambil
hanya (mengisolasi) objek
sel darah?
Konsep warna
Citra Mikroskopis
• Apa ciri untuk menentukan
objek sel darah pada citra
mikroskopis di samping?
– Sel darah berwarna lebih
gelap daripada background
– Sel darah berbentuk lingkaran
Konsep warna
Citra Mikroskopis
• Apa ciri untuk menentukan
objek sel darah pada citra
mikroskopis di samping?
– Sel darah nampak lebih gelap
daripada background
– Sel darah berbentuk lingkaran
Konsep warna: RGB vs Graylevel
Citra RGB Citra Graylevel
%memanggil file citra RGB, disimpan sbg matriks %mengubah citra RGB menjadi citra graylevel
A = imread('Normal-bovine-erythrocytes.jpg'); B = rgb2gray(A);

%menyimpan hasil konversi sebagai citra .jpg


imwrite(B,'grayErythrocytes.jpg');
Algoritma Konversi
Statistik warna (image histogram)
• Citra grayErythrocytes mempunyai
karakteristik distribusi warna bi-modal
• Dari citra tersebut, sel darah nampak lebih
gelap daripada background
Statistik warna (image histogram)
• Distribusi bi-modal ditandai dengan grafik dua
bukit
Brain Teaser
Histogram
• Apa ciri untuk menentukan
objek sel darah pada citra
mikroskopis di samping?
• Bagaimana cara mengambil
hanya (mengisolasi) objek
sel darah?
Thresholding

• Prinsip Kerja
Thresholding
• Gambar A: kasus bi-modal seperti pada citra
grayErythrocytes

• Untuk mengisolasi objek sel darah :

– Pilih satu nilai T yang memisahkan objek dengan


background
– Dengan kata lain, untuk setiap piksel (x,y) yang nilai
intensitasnya f(x,y) < T merupakan bagian dari objek
sel darah.
Thresholding
• Gambar B: Contoh kasus multi-modal
(multilevel thresholding)

• Sehingga: suatu piksel (x,y) dikelompokkan


menjadi:

– anggota objek 1 jika T1<f(x,y)≤T2


– anggota objek 2 jika f(x,y)>T2
– anggota background jika f(x,y)≤T1
Thresholding

• Proses segmentasi citra berdasar nilai threshold:

1 if f ( x, y ) < T (objek sel darah)


g ( x, y ) =  (background)
0 if f ( x, y ) ≥ T
Penentuan Threshold
• Tebakan: nilai terendah diantara dua bukit
Segmentasi berdasar threshold
Segmentasi berdasar threshold
• Hasil segmentasi: objek berwarna putih dan
background berwarna hitam
Brain Teaser
• Bagaimana jika objek sel darah ditampilkan
berwarna abu-abu?
• Bagaimana jika objek sel darah ditampilkan
berwarna?
• Mengapa di beberapa sel darah nampak
berlubang?
Optimal Thresholding
• Setiap bukit dalam histogram bimodal dapat
dipandang sebagai estimasi fungsi probability
density p(z):

– Sehingga, suatu histogram bimodal merupakan


jumlahan ( mixture) dari fungsi kerapatan (density)
unimodal (satu untuk daerah terang, satu untuk
daerah gelap).
Optimal Thresholding
Optimal Thresholding
• Parameter campuran ini sebanding dengan
luasan (atau banyaknya total piksel) dari
setiap bukit.

• Jika pola kerapatan diketahui atau dapat


diasumsikan, maka penentuan threshold yang
optimal (nilai error nya minimum) akan
menjadi mungkin.
Detail matematis Otsu’s
• Dengan menggunakan nilai histogram
• Mencari nilai t yang meminimalkan varians
dalam suatu bukit
• Dan memaksimalkan varians antar bukit
• Dirancang untuk histogram bimodal
Otsu’s Thresholding Method (1979)
• Based on a very simple idea: Find the
threshold that minimizes the weighted
within-class variance.
• This turns out to be the same as maximizing
the between-class variance.
• Operates directly on the gray level
histogram [e.g. 256 numbers, P(i)], so it’s
fast (once the histogram is computed).
Otsu: Assumptions
• Histogram (and the image) are bimodal.
• No use of spatial coherence, nor any other
notion of object structure.
• Assumes stationary statistics
• Assumes uniform illumination (implicitly), so
the bimodal brightness behavior arises from
object appearance differences only.
The weighted within-class variance is:

2 2 2
σ (t ) = q1 (t ) σ (t ) + q 2 (t )σ (t )
w 1 2

Where the class probabilities are estimated as:


t I

q1 (t) = ∑ P(i) q2 (t) = ∑ P(i)


i =1 i = t +1

And the class means are given by:

t I
iP(i) iP(i)
µ1 (t) = ∑ µ2 (t) = ∑
i =1 q1 (t) i =t +1 q2 (t )
Finally, the individual class variances are:

t
P(i)
σ (t) = ∑[i − µ1 (t)]
2
1
2

i=1 q1 (t)
I
P(i)
σ (t) = ∑ [i − µ 2 (t)]
2
2
2

i =t +1 q2 (t)

Now, we could actually stop here. All we need to do is just run through the full
2
range of t values [1,256] and pick the value that minimizesσ w (t) .
But the relationship between the within-class and between-class variances can
be exploited to generate a recursion relation that permits a much faster
calculation.
Between/Within/Total Variance
• The book gives the details, but the basic
idea is that the total variance does not
depend on threshold (obviously).
• For any given threshold, the total variance is
the sum of the within-class variances
(weighted) and the between class variance,
which is the sum of weighted squared
distances between the class means and the
grand mean.
After some algebra, we can express the total variance as...
2 2 2
σ = σ (t) + q1 (t)[1 − q1 (t)][µ1 (t) − µ2 (t)]
w

Within-class,
from before Between-class, σ B2 (t)

Since the total is constant and independent of t, the effect of changing the
threshold is merely to move the contributions of the two terms back and forth.
So, minimizing the within-class variance is the same as maximizing the between-
class variance.
The nice thing about this is that we can compute the quantities in σ B2 (t)
recursively as we run through the range of t values.
Finally...
Initialization... q1 (1) = P(1) ; µ1 (0) = 0

Recursion...
q1 (t + 1) = q1 (t) + P(t + 1)

q1 (t) µ1 (t) + (t + 1)P(t + 1)


µ1 (t + 1) =
q1 (t + 1)

µ − q1 (t + 1)µ1 (t + 1)
µ2 (t + 1) =
1 − q1 (t + 1)
Yang tinggal pakai ;-)
Brain Teaser
• Lakukan segmentasi citra grayErythrocytes
dengan menggunakan nilai t sesuai algoritma
Otsu’s
Perbandingan hasil segmentasi
Terima kasih

izzati@uii.ac.id

Anda mungkin juga menyukai