You are on page 1of 85

‫جامعة دمشق‬

‫كلية الهندسة الميكانيكية والكهربائية‬


‫قسم الهندسة الطبية‬

‫استخالص الورم من صور الرنني المغناطيسي للدماغ وإظهاره‬


‫ثالثي األبعاد باستخدام بيئة الماتالب‬

‫أطروحة أعدت لنيل درجة اإلجازة بالهندسة الطبية‬

‫إعداد الطالب‪:‬‬

‫محمد بشري األحمر‬ ‫ياسر الحايك‬

‫بإشراف‬

‫األستاذ الدكتور المهندس‪:‬‬

‫معن عمار‬

‫العام الدراسي ‪2014 – 2013‬‬


‫أهلنا‬

‫أصدقاؤنا وزمالؤنا‬

‫معن عمار‬

‫م‪ .‬يوسف قزويين ‪ ،‬م‪ .‬نور الدين جالل‬


‫فهرس األشكال ‪.....................................................................................‬‬

‫‪1‬‬ ‫‪1‬‬
‫‪1‬‬ ‫‪1.1‬‬
‫‪1‬‬ ‫‪1.1‬‬
‫‪1‬‬ ‫‪1.1‬‬
‫‪2‬‬ ‫‪1.1‬‬
‫‪3‬‬ ‫‪1.1‬‬

‫‪5‬‬ ‫‪2‬‬
‫‪1.1‬‬
‫‪6‬‬
‫‪6‬‬ ‫‪1.1.1‬‬

‫‪6‬‬ ‫‪1.1.1‬‬
‫‪6‬‬ ‫‪1.1.1‬‬
‫‪1.1‬‬
‫‪7‬‬
‫‪7‬‬ ‫‪1.1.1‬‬
‫‪8‬‬ ‫‪1.1.1‬‬
‫‪9‬‬ ‫‪1.1‬‬

‫‪3‬‬
‫‪11‬‬ ‫‪1.1‬‬
‫‪11‬‬ ‫‪1.1.1‬‬
‫‪13‬‬ ‫‪1.1‬‬

‫‪11‬‬ ‫‪Magnet‬‬ ‫‪1.1.1‬‬


‫‪Gradient Coils‬‬ ‫‪1.1.1‬‬
‫‪11‬‬
‫‪16‬‬ ‫‪RF‬‬ ‫‪1.1.1‬‬

‫‪11‬‬ ‫‪4‬‬
‫‪21‬‬ ‫‪1.1‬‬
‫‪21‬‬ ‫‪1.1‬‬
‫‪22‬‬ ‫‪Tumors‬‬ ‫‪1.1‬‬
‫‪22‬‬ ‫‪1.1.1‬‬
‫‪22‬‬ ‫‪ 1.1.1.1‬األورام الدماغية الحميدة ‪...........................................................‬‬
‫‪23‬‬ ‫‪ 1.1.1.1‬األورام الدماغية الخبيثة ‪............................................................‬‬
‫‪25‬‬ ‫‪Tumors Types‬‬ ‫‪1.1.1‬‬
‫‪26‬‬ ‫‪4.4‬‬

‫‪22‬‬ ‫‪5‬‬
‫‪21‬‬ ‫‪1.1‬‬
‫‪21‬‬ ‫‪1.1‬‬
‫‪31‬‬ ‫‪1.1‬‬
‫‪31‬‬ ‫‪1.1.1‬‬
‫‪32‬‬ ‫‪ 1.1.1.1‬تنعيم الصورة ‪..........................................................................‬‬
‫‪33‬‬ ‫‪1.1.1‬‬
‫‪ 1.1.1.1‬كشف االنقطاعات‪31 ....................................................................:‬‬
‫‪ 1.1.1.1‬التعتيب ‪35 .................................................................................‬‬
‫‪ 1.1.1.1.1‬التعتيب باستخدام طريقة أوتسو‪37 ...................................................‬‬
‫‪11‬‬ ‫‪1.1.1‬‬
‫‪11‬‬
‫‪6‬‬
‫‪15‬‬ ‫‪6.1.1‬‬
‫‪11‬‬ ‫‪6.1.1‬‬
‫‪52‬‬ ‫‪6.1.1‬‬
51 6.1

51 7
61 1.1
61 1.1
61 1.1

61 1.1
62 1.1
62 1.6

62 1.1
63 1.8
63 1.9

64 8
75 9
‫الصفحة‬ ‫الشكل‬
‫الفصل الثاني‬
‫‪7‬‬ ‫‪ .1‬الشكل (‪ )1.1‬خطوات الخوارزمية‬
‫‪7‬‬ ‫‪ .1‬الشكل (‪ )1.1‬نتيجة تطبيق الخوارزمية على صورة اختيارية‬
‫‪8‬‬ ‫‪ .3‬الشكل (‪ )1.3‬خطوات الخوارزمية‬
‫الفصل الثالث‬
‫‪11‬‬ ‫‪ .4‬الشكل (‪ )3.1‬حالة التوازن للبروتونات‬
‫‪11‬‬ ‫‪ .5‬الشكل (‪ )3.1‬استرخاء البروتونات واصداره إشارة‬
‫‪14‬‬ ‫‪ .6‬الشكل (‪ )3.3‬مخطط توضيحي لنظام العمل في المرنان‬
‫‪15‬‬ ‫‪ .7‬الشكل( ‪)3.4‬ملف التدرج للحقل المغناطيسي على المحور ‪Z‬‬
‫‪15‬‬ ‫‪ 5.3‬ملف التدرج للحقل المغناطيسي على المحور ‪X‬‬ ‫‪.8‬‬
‫‪16‬‬ ‫‪ .9‬شكل( ‪)3.6‬الملف السطحي‬
‫‪17‬‬ ‫‪ .11‬االشكل‪Bird Cage Coil)7.3‬‬
‫‪17‬‬ ‫‪ .11‬لشكل (‪ )3.8‬ملف الصدر والرسغ‬
‫‪17‬‬ ‫‪ 11‬الشكل (‪Saddle Coil)3.8‬‬
‫الفصل الرابع‬
‫‪11‬‬ ‫‪ .13‬الشكل (‪ )1.3‬تشريح الدماغ‬
‫‪11‬‬ ‫‪2.3‬‬ ‫‪.31‬‬
‫‪13‬‬ ‫‪ 51‬الشكل (‪ )1.1‬ورم دماغي حميد‬
‫‪13‬‬ ‫‪ .31‬الشكل (‪ )4.3‬الورم الخبيث‬
‫‪14‬‬ ‫‪ .71‬الشكل (‪ )4.4‬الورم من الدرجة األولى‬
‫‪15‬‬ ‫‪ .18‬الشكل (‪ )4.5‬األورام الدبقية‬
‫الفصل الخامس‬
‫‪19‬‬ ‫‪ .19‬الشكل (‪ )5.1‬مصفوفة الصورة ]‪[1,8‬‬
‫‪31‬‬ ‫‪ .11‬الشكل (‪ )5.1‬يظهر أربع صور مع هيستوغرام كل منها‬
‫‪34‬‬ ‫‪ .11‬الشكل )‪ (5.3‬نافذة عامة لقياس ‪33‬‬
‫‪35‬‬ ‫‪ .11‬الشكل )‪ (5.4‬نافذة تستعمل لكشف نقاط معزولة مختلفة عن خلفية ثابتة‬
‫‪36‬‬ ‫‪ .13‬الشكل (‪ )5.5‬التعتيب باستخدام عتبة واحدة‬
‫‪36‬‬ ‫‪ .14‬الشكل (‪ )5.6‬التعتيب باستخدام عتبتين‬
‫‪38‬‬ ‫‪ .15‬الشكل (‪ )5.7‬مثال لصورة مع هيستوغرامها‬
‫‪38‬‬ ‫‪ .16‬الشكل (‪ )5.8‬هيستوغرام عناصر الخلفية‬
‫‪39‬‬ ‫‪ .17‬الشكل (‪ )5.9‬هيستوغرام عناصر جسم الصورة‬
‫‪41‬‬ ‫‪ .18‬الشكل (‪ )5.11‬الصورة المختارة ونتيجة تعتيبها باستخدام طريقة أوتسو‬
‫‪41‬‬ ‫‪ .19‬الشكل (‪ )5.11‬نتيجة عملية التعرية‬
‫‪41‬‬ ‫‪ .31‬الشكل (‪ )5.11‬نتيجة تطبيق عملية التمديد باستخدام عنصر تشكيل مربع ‪3*3‬‬
‫‪41‬‬ ‫‪ .31‬الشكل (‪ )5.13‬نتيجة تطبيق عملية الفتح على صورة اختيارية‬
‫‪43‬‬ ‫‪ .31‬الشكل (‪ )5.14‬نتيجة عملية اإلغالق على صورة اختيارية‬
‫الفصل السادس‬
‫‪45‬‬ ‫‪ .33‬الشكل (‪ )6.1‬خطوات الخوارزمية‬
‫‪46‬‬ ‫‪ .34‬الشكل(‪ )6.1‬المناطق الثالث الرئيسة في الهيستوغرام‬
‫‪46‬‬ ‫‪ .35‬الشكل (‪ )6.1‬عينة من الصور‬
‫‪47‬‬ ‫‪ .36‬الشكل (‪ )6.3‬مجال قيم العتبة (مجموعة الصور األولى)‬
‫‪47‬‬ ‫‪ .37‬الشكل (‪ )6.4‬يمثل قيم العتبة لكل صورة بعد استخدام طريقة اوتسو (المجموعة‬
‫األولى)‬
‫‪48‬‬ ‫‪ .38‬الشكل (‪ )6.5‬يمثل قيم العتبة لكل صورة بعد استخدام طريقة اوتسو (المجموعة‬
‫الثانية)‬
‫‪48‬‬ ‫‪ .39‬الشكل(‪ )6.6‬نتيجة التعتيب اآللي‬
‫‪49‬‬ ‫‪ .41‬الشكل (‪ )6.7‬منطقة الدماغ الرئيسية بعد التخلص من حواف الجمجمة‬
‫‪51‬‬ ‫‪ .41‬الشكل (‪ )6.8‬صور التجمعات الثالثة الناتجة عن تطبيق الـ ‪FCM‬‬
‫‪51‬‬ ‫‪ .41‬الشكل (‪ )6.9‬نتيجة استرجاع عناصر التجمعات الثالثة‬
‫‪ .43‬الشكل (‪ )6.11‬العناصر التي تمثل كل تجمع‬
‫‪51‬‬
‫‪ .44‬الشكل (‪ )6.11‬الصورة الناتجة عن تطبيق شرط التجمع األكبر‬
‫‪51‬‬
‫‪53‬‬ ‫‪ .45‬الشكل (‪ )6.13‬منطقة الورم بعد التخلص من المناطق المريبة‬
‫‪53‬‬ ‫‪ .46‬الشكل (‪ )6.14‬منطقة الورم بعد تطبيق المعالجة النهائية‬
‫‪53‬‬ ‫‪ .47‬الشكل (‪ )6.15‬الورم كقناع لصورة الدخل‬
‫الفصل السابع‬
‫‪61‬‬ ‫‪ .48‬الشكل (‪ )7.1‬الدماغ ثالثي األبعاد‬
‫‪61‬‬ ‫‪ .49‬الشكل (‪ )7.1‬الورم المستخلص ثالثي األبعاد‬
‫‪61‬‬ ‫‪ .51‬الشكل (‪ )7.3‬االظهار الشفاف للورم‬
‫‪61‬‬ ‫‪ .51‬الشكل (‪ )7.4‬القطع األفقي للدماغ‬
‫‪61‬‬ ‫‪ .51‬الشكل (‪ )7.6‬القطع األفقي العامودي‬
‫‪61‬‬ ‫‪ .53‬الشكل (‪ )7.6‬القطع األفقي العامودي‬
‫‪ .54‬الشكل (‪ )7.7‬البناء رباعي األبعاد للقولون‬
‫‪64‬‬
FCM
Chapter First: the Introduction

1.1
[11]

[3]

1.1

FCM 1

1.1

2
09 

1.1

8 29 
6 19 

1.1



3
Chapter First: the Introduction

4
Chapter Second: Review of old researches

1.2
[10]

1.2.2

1.2.1

1.2


1.2.2

6
‫التعتبيب باستخدام‬
‫دخل الخوارزمية‬ ‫حذف النقاط الشاذة‬
‫طريقة أوتسو‬

‫نستبدل القيم السوداء‬


‫تطبيق عملية كشف‬ ‫تمديد النتيجة السابقة‬
‫بالقيم الوسطى للسويات‬
‫الحواف‬ ‫باستحدام قرص‪5‬‬
‫الرمادية للدماغ والورم‬

‫استخدام الصورة‬
‫إجراء عملية التمديد‬ ‫انتقاء المركبة األكبر‬
‫االصلية كقناع للصورة‬
‫المورفولوجية‬ ‫وحساب مساحتها‬
‫الناتجة‬

‫]‪[10‬‬ ‫‪1.2‬‬

‫]‪[10‬‬ ‫‪1.1‬‬

‫‪1.1‬‬
‫]‪[7‬‬

‫‪1.1.2‬‬

‫‪7‬‬
Chapter Second: Review of old researches

1.1.1

[7] 1.2

8
: 1.1.2

.
( .
.

9
Chapter Third: Basic of MRI

1.3
Magnetic Resonance Imaging MRI
Nuclear Magnetic Resonance NMR NMR

NMR

spin 

NMR 

MRI

SPIN

MRI

MRI

x,y z

10
MRI

1.3.3



MRI

ρ 1

MRI 

ρ ρ 

B0

11
Chapter Third: Basic of MRI

[3] 1.1

coil

MRI

[3] 1.2

spin - lattice T1

12
spin - spin T2

M T1 , T2
B0

1.3

Magnet 
Gradient Coils 
RF 
ADC 

[3] 11

11
Chapter Third: Basic of MRI

Magnet 1.3.3


B0 
1 Tesla = 10000 Gauss Tesla 
(0.2~7)Tesla
B0 SNR 

Permanent Magnets 

(0.2~0.3T)
Resistive Magnets 

0.15 [ T ]
Superconducting Magnets 

17
T

(4.2 K)
( 77.4 K)
(293 K)

Gradient Coils 1.3.3

1~4 G/cm

14
B0

Z B0
antihelmholtz
B B0 B
4 1 B0

[3] Z 1.4

8 Y,X B0
X B0
1.5 Y

[3] X 5.3

15
Chapter Third: Basic of MRI

RF 1.3.1

tipping B1

1
2 pi LC
Larmor LC

B1
B0

RF

Multi Turn Solenoid 1


1.6 Surface Coil 2

[3] Surface Coil 1.6

16
1.7 Bird Cage Coil 1

[3] Bird Cage Coil 7.3

:Single Turn Coil 4


1.3

[3] Single Turn Coil 1.3

9 Saddle Coil 5

[3] Saddle Coil 1.3


17
Chapter Third: Basic of MRI

Phased-Array Coil 6
Litz Coil 7

Multi Turn Solenoid ,Bird Cage ,Saddle Single Turn Solenoid


Surface , Phased-Array RF

13
Chapter fourth: the Anatomy of tumor

1.4
:

(central nervous system) 


( peripheral nervous system) 

Skull 
Meningitis 
Cerebrospinal Fluid ‫ ا‬

[11] ‫) تشريح الدماغ‬1.3( ‫الشكل‬

20
‫‪Anatomy of The Brain‬‬ ‫‪1.4‬‬

‫‪0033‬‬ ‫‪053‬‬

‫‪Forebrain‬‬ ‫‪1‬‬

‫‪Diencephalon‬‬ ‫‪2‬‬

‫‪Mid Brain‬‬ ‫‪3‬‬

‫‪1.4.4‬‬

‫‪Telencephalon‬‬ ‫‪1.4.4.4‬‬

‫‪Lobes‬‬

‫‪ ‬الفصان الجبهي األيمن و األيسر‪ Frontal Lobes‬وفيها مركز الحركة و مركز أفكار‬
‫‪ ‬اإلنسان و ربطها بالعواطف ليصدر عنها القرار النهائي للعمل بعزم و حزم‪.‬‬
‫‪ ‬الفصان الصدغيان األيمن و األيسر‪ Temporel Lobes‬و فيهما مركز السمع و الشم‬
‫‪ ‬ولهما عالقة بالنطق‪.‬‬
‫‪ ‬الفصان الجداريان األيمن و األيسر‪ Parietal Lobes‬و يقعان في وسط الجمجمة حول‬
‫‪ ‬سقفها و فيهما مراكز الحس العام كالحس و الضغط و تكثر فيهما المناطق المشاركة المتصلة بكل‬
‫الفصوص‪.‬‬
‫‪ ‬الفصان القذاليان األيمن و األيسر ‪ Occipital Lobes‬و توجدان في مؤخرة الجمجمة و يقعان على‬
‫خيمة المخ و يحتويان على مراكز البصر‪.‬‬

‫‪21‬‬
Chapter fourth: the Anatomy of tumor

[11] 2.3

Tumors 1.4
,

1.3.4

:Benign Tumors 1.4.4.4


, ,

22
‫‪.‬‬

‫الشكل (‪ )1.1‬ورم دماغي حميد ]‪[11‬‬

‫‪Malignant Tumors‬‬ ‫‪1.4.4.4‬‬

‫‪.‬‬

‫‪.‬‬

‫]‪[11‬‬ ‫‪4.3‬‬

‫‪23‬‬
Chapter fourth: the Anatomy of tumor

Tumors Grade 1.4.4.4

: Grade I ‫أورام الدرجة االولى‬ 1.4.4.4.4


. ,

[11] 1.1

: Grade II ‫أورام الدرجة الثانية‬ 1.4.4.4.4


.

: Grade III 1.4.4.1


,
.
Grade IV 4-3-2-2

, ,

24
‫‪: Tumors Types‬‬ ‫‪2.1.4‬‬
‫‪,‬‬
‫‪,‬‬
‫‪.Glioma‬‬

‫‪:‬‬ ‫‪,‬‬

‫‪: astrocytoma‬‬ ‫‪3.4.3.4‬‬


‫‪,‬‬
‫‪.‬‬ ‫–‬ ‫–‬ ‫‪.‬‬

‫الشكل (‪ )2.4‬األورام الدبقية‬

‫‪: Meningioma‬‬ ‫‪3.4.3.3‬‬


‫‪,‬‬ ‫‪,‬‬

‫‪.‬‬

‫‪: Oligodendroglioma‬‬ ‫‪1.4.4.4‬‬


‫‪,‬‬

‫‪.‬‬ ‫‪,‬‬ ‫‪.‬‬

‫أما بالنسبة لالطفال ‪ ،‬فإن أكثر أنواع االورام انتشارًا هي‪:‬‬

‫‪25‬‬
Chapter fourth: the Anatomy of tumor

: Medulloblastoma 1.4.4.1
Grade I or II astrocytoma

astrocytoma juvenile pilocytic

: Ependymoma 1.4.4.4
,
. ,

: Brain stem glioma 3.4.3.4


. ,

: Risk Factors: 1.4.4.4

: Ionizing Radiation •
X-


,

. ,

: Tumor Symptoms 1.1


.
,
. ,

26
:



. , , •

. •
. •
. •
. •

27
1.5
X,Y f(X,Y)
1.5 f

[1,8] ‫) مصفوفة الصورة‬1.5( ‫الشكل‬

1.5
,K r𝑘 h(r𝑘 ) = n𝑘
n𝑘 k n𝑘
n
𝑃(r𝑘 ) k=0,5,…..,L-1 𝑃(r𝑘 ) = n𝑘 /𝑛
r𝑘

histogram

h(r𝑘 ) = n𝑘 r𝑘

29 1
Chapter 5th: Basic of Processing Digital Image

[8] 1.2

1.5

.1

30
.2

1.5.5

𝐠(𝐱, 𝐲) = 𝐓[𝐀(𝐱, 𝐲)]

A T g(x,y) A(x,y)
(x,y)

(T)
K

(x,y)
(x,y)

(g) (x,y)

A (g) (1*1) (T)


gray level transformation function T
mapping function

S=T(r)

35
Chapter 5th: Basic of Processing Digital Image

g(x,y) A(x,y) s (r)


(x,y)

Image Smoothing 1.5.5.5

Neighborhood Averaging 
NXN f(x,y)
(x,y) g(x,y)
(x,y) f

5
𝑔(𝑥, 𝑦) = ∑ 𝑓(𝑛, 𝑚)
𝑀
(𝑛,𝑚)∈𝑠

. x,y = 0,5,2........ ،N-1 ‫من أجل‬

g(x,y) thresholding

32
1 1
∑(m,n)∈s f(m, n) if |𝑓(𝑥, 𝑦) − ∑(m,n)∈s f(m, n)| > 𝑇
𝑀 𝑀

𝑔(𝑥, 𝑦)

𝑓(𝑥, 𝑦) otherwise

T
T

1.5.5

objects parts Segmentation

isolated points
edges lines

thresholding
region splitting and merging region growing

static images

33
Chapter 5th: Basic of Processing Digital Image

1.5.5.5

33
(5.3)

w1 w2 w3

w4 w5 w6

w7 w8 w9

[1] 33 (5.3)

33 w1, w2, …….., w9


x1, x2, …….., x9

w 
 1
w 
w   2
 
 
 w9 

x 
 1
x 
x   2
 
 
 x9 

x,w

w' x  w x  w x  w x
11 2 2 9 9

.1

(2-3)

34
(5.3)

-1 -1 -1

-1 8 -1

-1 -1 -1

(5.4)

w' x   x  x  x  x  8x  x  w  w  w
1 2 3 4 5 6 7 8 9

'0'
(x5)

w' x  T

T T

1.5.5.5

f(x,y) (5.5)

T
f(x,y)>T (x,y)

31
Chapter 5th: Basic of Processing Digital Image

(5.6)

f(x,y)>T2 T1<f(x,y)T2
f(x,y)T1

1.1

1.6

global

36
[8]

[4])OTSU( ‫التعتيب باستخدام طريقة أوتسو‬ 1.5.5.5.5

i [1, 2, ,L]
N = n1 + n2 +…… + nL ni

𝐿
𝑛𝑖
𝑝𝑖 = , 𝑝𝑖 ≥ 0, ∑ 𝑝𝑖 = 5
𝑁
𝑖=5

c0 c1 (class)

c1 K (object and background)

[1, , k] c0 [k + 1, , L]

ω0 = Pr(𝑐0 ) = ∑ 𝑝𝑖
𝑖=1

ω1 = Pr(𝑐1 ) = ∑ 𝑝𝑖
𝑖=𝑘+1

𝑘 𝑘

μ0 = ∑ i Pr (i /Co) = ∑ 𝑖 𝑝𝑖 /ω0
𝑖=1 𝑖=1

𝐿 𝐿

μ1 = ∑ i Pr (i /Ci) = ∑ 𝑖 𝑝𝑖 /ω1
𝑖=𝑘+1 𝑖=𝑘+1
37
Chapter 5th: Basic of Processing Digital Image

𝑘 𝑘

σ20 = ∑(i − μ0 )2 Pr (i /C0) = ∑(i − μ0 )2 𝑝𝑖 /ω0


𝑖=1 𝑖=1

𝑘 𝐿

σ12 = ∑(i − μ1 )2 Pr (i /C5) = ∑ (i − μ1 )2 𝑝𝑖 /ω1


𝑖=1 𝑖=𝑘+1

σ2𝑤 ( variance with class )

σ2𝑤 = ω0 σ20 + ω1 σ12

σ2𝑤

[12]
6 6 6

[12] 1.7

[12] 1.8
38
8+7+2
ω0 = = 0.4772
36
(0 ∗ 8) + (5 ∗ 7) + (2 ∗ 2)
μ0 = = 0.6475
57
(0 − 0.6475)2 ∗ 8 + ((5 − 0.6475)2 ) ∗ 7) + ((2 − 0.6475)2 ) ∗ 2
σ20 =
57
= 0.4637

[12] 1.9

6+9+4
ω1 = = 0.1278
36
(3 ∗ 6) + (4 ∗ 9) + (1 ∗ 4)
μ1 = = 3.8974
59
((3 − 3.8974)2 ) ∗ 6) + ((4 − 3.8974)2 ) ∗ 9) + ((1 − 3.8974)2 ) ∗ 4
σ12 = = 0.1512
59

σ2𝑤 = ω0 σ20 + ω1 σ12 = 0.4909

45

4 3 2 5

39 1 0 2
Chapter 5th: Basic of Processing Digital Image

0.6389 0.4722 0.4567 0.222 𝛚𝟎


5.2609 0.6475 0.4667 0 𝛍𝟎
5.4502 0.4637 0.2489 0 𝛔𝟐𝟎
0.3655 0.1278 0.1833 0.7778 𝛚𝟏
4.3077 3.8947 3.7543 3.0317 𝛍𝟏
0.2530 0.1512 0.7711 5.9639 𝛔𝟐𝟏
0.9779 0.4909 0.1165 5.1268 𝛔𝟐𝒘

[12] 1.50

1.5.5

40
1.5.5.5

5
1.55

[1][8] 1.55

5
1.52

45
Chapter 5th: Basic of Processing Digital Image

[1][8] 3 3 1.52

1.5.5.5


[1][8] 1.53

42
[1] 1.54

43
‫‪1.6‬‬

‫‪‬‬
‫‪‬‬
‫‪‬‬

‫استرجاع القيم‬ ‫تطبيق خوارزمية‬


‫مدخل الخوازمية‬ ‫األصلية للسويات‬ ‫منطقة الورم‬
‫الـ ‪FCM‬‬ ‫(الخرج)‬
‫الرمادية‬

‫اختيار أكبر‬ ‫استرجاع القيم‬


‫صورة الدماغ‬ ‫المركبات مساحة‬ ‫األصلية لعناصر‬
‫تطبيق عملية‬
‫(الدخل)‬ ‫المجموعات الثالثة‬
‫اإلغالق‬

‫التعتيب باستخدام‬ ‫استرجاع القيم‬ ‫تحديد المنطقة التي‬ ‫تطبيق عملية‬


‫طريقة أوتسو‬ ‫األصلية للدماغ‬ ‫تمثل الورم‬ ‫إغالق الثقوب‬

‫تطبيق عملية الفتح‬


‫ترقيم المركبات‬ ‫ترقيم المركبات‬ ‫اختيار المركبة‬
‫باستخدام قرص‬
‫المتصلة‬ ‫المتصلة‬ ‫األكبر مساحة‬
‫دائري‬

‫‪61.‬‬

‫‪1.6.6‬‬

‫‪45‬‬
Chapter Six: the Extract Algorithm

515
.1
.2
Back ground .3

615

615


46

1.6.6.6

515 45 66
[4]

615

45 65

70

68

66

64

62

60
1 2 3 4 5 6 7

614

47
Chapter Six: the Extract Algorithm

50

48

46

44

42

40

38

36
1 2 3 4 5 6 7

615

66

1.6.6.2

1.6.6.3

48
1.6.6.4

[8]

𝑓 (𝑥), if 𝑓𝐵 (𝑥) > 6


(5.1) 𝑓1 (x) = { 0
6, otherwise

𝑓1 (x)
𝑓0 (𝑥)
𝑓𝐵 (𝑥)

617

1.6.2

49
Chapter Six: the Extract Algorithm

[9][8]

Fuzzy clustering meaning FCM

FCM 1.6.2.6
FCM




FCM

.
5
5

FCM 618

1.6.2.2

619 (5.1)

56
619

1.6.2.3
FCM

61.6

61.6

5.
Chapter Six: the Extract Algorithm

[9] [8]

𝐾𝑏 > 𝐾𝑡

Kt
Kb
61..

6 ..

1.6.3

FCM
61..

61.5

55
61.5

[]
61.4

61.4

61.5

55
Chapter Six: the Extract Algorithm

1.2

54

55
Chapter Six: the Extract Algorithm

56

57
Chapter Six: the Extract Algorithm

58
Chapter Seven: the Result of 3D Visualization

1.7






1.7

1.7

60
1.7

1.7

[8]

1.7

1.7

1.7

67
Chapter Seven: the Result of 3D Visualization

1.7

1.7

1.7

1.6

1.1

67
1.7

FCM

1.7

67
Chapter Seven: the Result of 3D Visualization

1.1

1.1

67
‫ تابع التخلص من حواف الجمجمة‬.1

close all
x=imread('C:\Users\bme\Documents\MATLAB\new
folder (5)\bk00_0006.jpg');
imshow(x)
[~, ~,B]=size(x);
if B~=1
x=rgb2gray(x);
end
otsu=graythresh(x);
x1 = im2bw(x, otsu);
figure,imshow(x1)
se2=strel('disk',2);
x1=imopen(x1,se2);
figure,imshow(x1)
[L,num] = bwlabel (x1, 8);
RGB = label2rgb(L);
figure, imshow(RGB)
[M, N]=size(L);
Pixels =zeros (num, 2);
for i=1:num
Pixels(i,1)=i;
end;
for j=1:N
for i=1:M
if L(i,j)~=0 ; Pixels(L(i,j),2)= Pixels(L(i,j),2)
+1 ; end
end;
end;
Region=0;
Max=0;
for i=1:num
if (Pixels(i,2) > Max)

56
Max= Pixels(i,2);
Region=Pixels(i,1);
end
end;
for j=1:N
for i=1:M
if L(i,j)~=Region x1(i,j)=0; else x1(i,j)=1; end
end
end
FCM 2

function [ Unow, center, now_obj_fcn ] =


FCMforImage( img, clusterNum )
%
%
% img = double(imread('brain.tif'));
% clusterNum = 3;
% [ Unow, center, now_obj_fcn ] = FCMforImage(
img, clusterNum );
% figure;
% subplot(2,2,1); imshow(img,[]);
% for i=1:clusterNum
% subplot(2,2,i+1);
% imshow(Unow(:,:,i),[]);
% end

if nargin < 2
clusterNum = 2; % number of cluster
end

[row, col] = size(img);


expoNum = 2; % fuzzification parameter
epsilon = 0.001; % stopping condition
mat_iter = 100; % number of maximun iteration

% ³ ¼»¯ U
Upre = rand(row, col, clusterNum);
dep_sum = sum(Upre, 3);
dep_sum = repmat(dep_sum, [1,1, clusterNum]);
Upre = Upre./dep_sum;

center = zeros(clusterNum,1); % ´ ´¢µ µ µ

55
% ¼‫ہ‬ à µ
for i=1:clusterNum
center(i,1) =
sum(sum(Upre(:,:,i).*img))/sum(sum(Upre(:,:,i)));
end
% ¼
pre_obj_fcn = 0;
for i=1:clusterNum
pre_obj_fcn = pre_obj_fcn +
sum(sum((Upre(:,:,i) .*img - center(i)).^2));
end
fprintf('Initial objective fcn = %f\n',
pre_obj_fcn);

for iter = 1:mat_iter


%¸ü Unow( µ ¸ü )
Unow = zeros(size(Upre));
for i=1:row
for j=1:col
% µ µ Unow¸ü
for uII = 1:clusterNum
tmp = 0;
for uJJ = 1:clusterNum
disUp = abs(img(i,j) -
center(uII));
disDn = abs(img(i,j) -
center(uJJ));
tmp = tmp +
(disUp/disDn).^(2/(expoNum-1));
end
Unow(i,j, uII) = 1/(tmp);
end
end
end

now_obj_fcn = 0;
for i=1:clusterNum
now_obj_fcn = now_obj_fcn +
sum(sum((Unow(:,:,i) .*img - center(i)).^2));
end
fprintf('Iter = %d, Objective = %f\n', iter,
now_obj_fcn);
56
if max(max(max(abs(Unow-Upre))))<epsilon ||
abs(now_obj_fcn - pre_obj_fcn)<epsilon % ë2¸ ¶¨
break;
else
Upre = Unow.^expoNum;
% ‫ہ‬ à µ
for i=1:clusterNum
center(i,1) =
sum(sum(Upre(:,:,i).*img))/sum(sum(Upre(:,:,i)));
end
pre_obj_fcn = now_obj_fcn;
end
end
3

close all
img = im2double(x1);
clusterNum = 3;
[ Unow, center, now_obj_fcn ] = FCMforImage( img,
clusterNum );
img1=im2bw(Unow(:,:,1),graythresh(Unow(:,:,1)));

img2=im2bw(Unow(:,:,2),graythresh(Unow(:,:,2)));

img3=im2bw(Unow(:,:,3),graythresh(Unow(:,:,3)));

subplot(1,3,1) ,imshow(img1);
subplot(1,3,2),imshow(img2);
subplot(1,3,3),imshow(img3);
% figure;
% subplot(2,2,1); imshow(img,[]);
% for i=1:clusterNum
% subplot(2,2,i+1);
% imshow(img(:,:,i),[]);
% end
c1=0;

[M, N]=size(img1);
text1=zeros(M,N);
for j=1:M
for g=1:N

56
if img1(j,g)~=0;
text1(j,g)=img(j,g);
c1=c1+text1(j,g);

end
end
end
c2=0;
[M, N]=size(img2);
text2=zeros(M,N);
for j=1:M
for g=1:N
if img2(j,g)~=0;
text2(j,g)=img(j,g);
c2=c2+text2(j,g);
end
end
end
c3=0;
[M, N]=size(img3);
text3=zeros(M,N);
for j=1:M
for g=1:N
if img3(j,g)~=0;
text3(j,g)=img(j,g);
c3=c3+text3(j,g);
end
end
end
figure,
subplot(1,3,1) ,imshow(text1);
subplot(1,3,2),imshow(text2);
subplot(1,3,3),imshow(text3);
maxx=max([c1 c2, c3]);

if c1~=maxx && c1~=0


img=text1;
figure,imshow(text1);
else
if c2~=maxx && c2~=0
figure,imshow(text2);
img=text2;
else
56
figure, imshow(text3);
img=text3;
end
end
4
bwfim2=img

[L,num1] = bwlabel (bwfim2, 8);


RGB = label2rgb(L);
figure, imshow(RGB)
[M, N]=size(L);
Pixels =zeros (num1, 2);
for i=1:num1
Pixels(i,1)=i;
end;
for j=1:N
for i=1:M
if L(i,j)~=0 ; Pixels(L(i,j),2)= Pixels(L(i,j),2)
+1 ; end
end;
end;
Region=0;
Max=0;
for i=1:num1
if (Pixels(i,2) > Max)
Max= Pixels(i,2);
Region=Pixels(i,1);
end
end;
for j=1:N
for i=1:M
if L(i,j)~=Region
bwfim2(i,j)=0;
else bwfim2(i,j)=1;
end
end
end
6

BW2 = imfill(bwfim2,'holes');
figure,imshow(BW2);
fin=im2uint8(BW2);
se2=strel('disk',8);
67
fin=imclose(fin,se2);
figure,imshow(fin);
fin = imfill(fin,'holes');
for j=1:M
for i=1:N
if fin(j,i)~=0
fin(j,i)=x(j,i);
end
end
end
figure,imshow(fin);
subplot(1,3,1)
imshow(x);
subplot(1,3,2)
imshow(fin);
subplot(1,3,3)
imshow(x);
BW = im2double(fin);
hold on
[B,L] = bwboundaries(BW,'noholes');
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'b',
'LineWidth', 2)
end
hold off
5

clear s1
path(path,'C:\Users\bme\Documents\MATLAB\New
folder (4)')
fileFolder= fullfile('New folder (4)');
dirOutput = dir(fullfile(fileFolder,'bh0*.jpg'));
fileNames = {dirOutput.name}';
numFrames = numel(fileNames);

for p = 1:numFrames

I=imread(fileNames{p});
s1(:,:,p)=I;
end

67
image_num = 1;
image(s1(:,:,image_num))
axis image
% colormap(map)
x = xlim;
y = ylim;
contourslice(s1,[],[],image_num)
axis ij
xlim(x)
ylim(y)
daspect([1,1,.2])
% % colormap('default')
% phandles = contourslice(s1,[],[],[1:21],8);
% view(3); axis tight
% set(phandles,'LineWidth',2)
Ds = smooth3(s1);
hiso = patch(isosurface(Ds,5),...
'FaceColor',[1,.0,.0],...
'EdgeColor','none');
% hcap = patch(isocaps(s1,5),...
% 'FaceColor','interp',...
% 'EdgeColor','none');
% colormap(map)
view(45,30)
axis tight
daspect([1,1,.2])
lightangle(305,30);
% set(hcap,'AmbientStrength',.6)
% set(gcf,'Renderer','zbuffer'); lighting phong
isonormals(Ds,hiso)
set(hiso,'SpecularColorReflectance',0,'SpecularEx
ponent',50)
view(215,30);

67
‫بعض التوابع األساسية في الماتالب في مجال معالجة الصور‬

‫‪67‬‬
[1] R.C.Gonzalez,R.E.Woods,S.L.Eddins,"Digital Image Processing Using MATLAB"
,Second Edition, Gatesmark,2009.

[2] R.C.Gonzalez,R.E.Woods, "Digital Image Processing, third" ,Edition,Pearson.

[3] P.Suetens, "Fundamentals of Medical Imaging" ,Second Edition, Cambridge


University Press,2009

[4]N.Otsu, "A Tlreshold Selection Method from Gray-Level Histograms", 2EEE


TRANSACTIONS ON SYSTREMS, MAN, AND CYBERNETICS, VOL. SMC-9, NO. 1,
JANUARY 1979.

[5] J.BEzdEk,R.EHRLICH,W.FULL., "FCM", Computers& geosclences Vol.10,No.2-3


PP.191-203,1984. JAMES C. B

[6] D. Kleut, M. Jovanović, B.Reljin, " 3D Visualisation of MRI images using


MATLAB", JOURNAL OF AUTOMATIC CONTROL, UNIVERSITY OF BELGRADE, VOL.
16:1-3, 2006.

[7] “Sudipta Roy, Samir K. Bandyopadhyay "Detection and Quantification of


Brain Tumor from MRI of Brain and it’s Symmetric Analysis" Department of
Computer Science and Engineering, University of Calcutta, 92 A.P.C. Road, Kolkata-
700009, India. 2012

4102 [8]

[9]
4100

[10]
4102

[11] www.braintumor.org

[12] www.labbookpages.co.uk/software/imgProc/otsuThreshold.html

57
[13] Matlab, Help, sections: Visualizing MRI data: Volume Visualization

Techniques (3-D Visualization); Image Processing Toolbox;

57
Damascus University

Faculty of Mechanical & Electrical Engineering

Biomedical Engineering Department

Segmentation and 3D Visualization for Brain


Tumors from MRI Images

Thesis Prepared to Obtain a Bachelor's Degree of Biomedical


Engineering

BY

Yasser Alhayek M.Bashir Alahmar


Supervised by

Prof. Dr. Eng. Maan Ammar

Academic Year
2013-2014

You might also like