/
create_image.m
46 lines (35 loc) · 1.28 KB
/
create_image.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function result = create_image()
result = zeros(128);
for x = 1:128
for y = 1:128
% Create an ellipse, representing body contour
if (x-64)^2/40^2 + (y-64)^2/50^2 <= 1
result(x,y) = 40;
end
% Create an ellipse, representing left lung
if (x-64)^2/25^2 + (y-85)^2/20^2 <= 1
result(x,y) = 10;
end
% Create an ellipse, representing right lung
if (x-64)^2/24^2 + (y-43)^2/21^2 <= 1
result(x,y) = 10;
end
% Create a circle, representing lesion in the right lung
if (x-50)^2 + (y-43)^2 <= 5^2
result(x,y) = 80;
end
% Create a circle, representing another lesion in the right lung
if (x-70)^2 + (y-36)^2 <= 2^2
result(x,y) = 60;
end
% Create a circle, representing lesion in the left lung
if (x-73)^2 + (y-86)^2 <= 3^2
result(x,y) = 70;
end
% Create a square, representing lesion in the left lung
if x>70 && x<73 && y>70 && y<73
result(x,y) = 50;
end
end
end
end