Professional Documents
Culture Documents
استخلاص الورم من صور الرنين المغناطيسي وإظهاره ثلاثي الأبعاد
استخلاص الورم من صور الرنين المغناطيسي وإظهاره ثلاثي الأبعاد
إعداد الطالب:
بإشراف
معن عمار
أصدقاؤنا وزمالؤنا
معن عمار
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 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نافذة عامة لقياس 33
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
التعتبيب باستخدام
دخل الخوارزمية حذف النقاط الشاذة
طريقة أوتسو
استخدام الصورة
إجراء عملية التمديد انتقاء المركبة األكبر
االصلية كقناع للصورة
المورفولوجية وحساب مساحتها
الناتجة
][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)
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
16
1.7 Bird Cage Coil 1
9 Saddle Coil 5
Phased-Array Coil 6
Litz Coil 7
13
Chapter fourth: the Anatomy of tumor
1.4
:
Skull
Meningitis
Cerebrospinal Fluid ا
20
Anatomy of The Brain 1.4
0033 053
Forebrain 1
Diencephalon 2
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
22
.
.
.
][11 4.3
23
Chapter fourth: the Anatomy of tumor
[11] 1.1
, ,
24
: Tumors Types 2.1.4
,
,
.Glioma
: ,
.
25
Chapter fourth: the Anatomy of tumor
: Medulloblastoma 1.4.4.1
Grade I or II astrocytoma
: Ependymoma 1.4.4.4
,
. ,
: Ionizing Radiation •
X-
•
,
. ,
26
:
•
•
. , , •
•
. •
. •
. •
. •
27
1.5
X,Y f(X,Y)
1.5 f
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)
S=T(r)
35
Chapter 5th: Basic of Processing Digital Image
Neighborhood Averaging
NXN f(x,y)
(x,y) g(x,y)
(x,y) f
5
𝑔(𝑥, 𝑦) = ∑ 𝑓(𝑛, 𝑚)
𝑀
(𝑛,𝑚)∈𝑠
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
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
33
(5.3)
w1 w2 w3
w4 w5 w6
w7 w8 w9
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]
i [1, 2, ,L]
N = n1 + n2 +…… + nL ni
𝐿
𝑛𝑖
𝑝𝑖 = , 𝑝𝑖 ≥ 0, ∑ 𝑝𝑖 = 5
𝑁
𝑖=5
c0 c1 (class)
[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
𝑘 𝑘
𝑘 𝐿
σ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
45
4 3 2 5
39 1 0 2
Chapter 5th: Basic of Processing Digital Image
[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
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]
𝑓1 (x)
𝑓0 (𝑥)
𝑓𝐵 (𝑥)
617
1.6.2
49
Chapter Six: the Extract Algorithm
[9][8]
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
if nargin < 2
clusterNum = 2; % number of cluster
end
% ³ ¼»¯ U
Upre = rand(row, col, clusterNum);
dep_sum = sum(Upre, 3);
dep_sum = repmat(dep_sum, [1,1, clusterNum]);
Upre = Upre./dep_sum;
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);
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]);
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.
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
57
Damascus University
BY
Academic Year
2013-2014