|
a |
|
b/All Matlab Code/Code for Semi-automatic Segmentations/snk.m |
|
|
1 |
%% Quantification of Trabeculae Inside the Heart from MRI Using Fractal Analysis |
|
|
2 |
|
|
|
3 |
%% This code is written by- |
|
|
4 |
%Md. Kamrul Hasan, M1 MAIA |
|
|
5 |
%Md. Fakrul Islam Tushar, M1 MAIA |
|
|
6 |
%% |
|
|
7 |
function varargout = snk(varargin) |
|
|
8 |
gui_Singleton = 1; |
|
|
9 |
gui_State = struct('gui_Name', mfilename, ... |
|
|
10 |
'gui_Singleton', gui_Singleton, ... |
|
|
11 |
'gui_OpeningFcn', @snk_OpeningFcn, ... |
|
|
12 |
'gui_OutputFcn', @snk_OutputFcn, ... |
|
|
13 |
'gui_LayoutFcn', [] , ... |
|
|
14 |
'gui_Callback', []); |
|
|
15 |
if nargin & isstr(varargin{1}) |
|
|
16 |
gui_State.gui_Callback = str2func(varargin{1}); |
|
|
17 |
end |
|
|
18 |
|
|
|
19 |
if nargout |
|
|
20 |
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
|
|
21 |
else |
|
|
22 |
gui_mainfcn(gui_State, varargin{:}); |
|
|
23 |
end |
|
|
24 |
|
|
|
25 |
function snk_OpeningFcn(hObject, eventdata, handles, varargin) |
|
|
26 |
handles.output = hObject; |
|
|
27 |
guidata(hObject, handles); |
|
|
28 |
set(handles.edit9,'string','1.00'); |
|
|
29 |
set(handles.edit5,'string','0.40'); |
|
|
30 |
set(handles.edit6,'string','0.20'); |
|
|
31 |
set(handles.edit7,'string','1.00'); |
|
|
32 |
set(handles.edit8,'string','0.15'); |
|
|
33 |
set(handles.edit11,'string','0.30'); |
|
|
34 |
set(handles.edit12,'string','0.40'); |
|
|
35 |
set(handles.edit13,'string','0.70'); |
|
|
36 |
|
|
|
37 |
set(handles.edit10,'string','200'); |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
set(handles.edit5,'Enable','off'); |
|
|
41 |
set(handles.edit6,'Enable','off'); |
|
|
42 |
set(handles.edit7,'Enable','off'); |
|
|
43 |
set(handles.edit8,'Enable','off'); |
|
|
44 |
set(handles.edit10,'Enable','off'); |
|
|
45 |
set(handles.edit11,'Enable','off'); |
|
|
46 |
set(handles.edit12,'Enable','off'); |
|
|
47 |
set(handles.edit13,'Enable','off'); |
|
|
48 |
set(handles.pushbutton2,'Enable','off'); |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
function varargout = snk_OutputFcn(hObject, eventdata, handles) |
|
|
52 |
% varargout cell array for returning output args (see VARARGOUT); |
|
|
53 |
% hObject handle to figure |
|
|
54 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
55 |
% handles structure with handles and user data (see GUIDATA) |
|
|
56 |
|
|
|
57 |
% Get default command line output from handles structure |
|
|
58 |
varargout{1} = handles.output; |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
% --- Executes during object creation, after setting all properties. |
|
|
62 |
function edit1_CreateFcn(hObject, eventdata, handles) |
|
|
63 |
% hObject handle to edit1 (see GCBO) |
|
|
64 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
65 |
% handles empty - handles not created until after all CreateFcns called |
|
|
66 |
|
|
|
67 |
% Hint: edit controls usually have a white background on Windows. |
|
|
68 |
% See ISPC and COMPUTER. |
|
|
69 |
if ispc |
|
|
70 |
set(hObject,'BackgroundColor','white'); |
|
|
71 |
else |
|
|
72 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
73 |
end |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
function edit1_Callback(hObject, eventdata, handles) |
|
|
78 |
% hObject handle to edit1 (see GCBO) |
|
|
79 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
80 |
% handles structure with handles and user data (see GUIDATA) |
|
|
81 |
|
|
|
82 |
% Hints: get(hObject,'String') returns contents of edit1 as text |
|
|
83 |
% str2double(get(hObject,'String')) returns contents of edit1 as a double |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
% --- Executes during object creation, after setting all properties. |
|
|
87 |
function edit2_CreateFcn(hObject, eventdata, handles) |
|
|
88 |
% hObject handle to edit2 (see GCBO) |
|
|
89 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
90 |
% handles empty - handles not created until after all CreateFcns called |
|
|
91 |
|
|
|
92 |
% Hint: edit controls usually have a white background on Windows. |
|
|
93 |
% See ISPC and COMPUTER. |
|
|
94 |
if ispc |
|
|
95 |
set(hObject,'BackgroundColor','white'); |
|
|
96 |
else |
|
|
97 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
98 |
end |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
function edit2_Callback(hObject, eventdata, handles) |
|
|
103 |
% hObject handle to edit2 (see GCBO) |
|
|
104 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
105 |
% handles structure with handles and user data (see GUIDATA) |
|
|
106 |
|
|
|
107 |
% Hints: get(hObject,'String') returns contents of edit2 as text |
|
|
108 |
% str2double(get(hObject,'String')) returns contents of edit2 as a double |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
% --- Executes during object creation, after setting all properties. |
|
|
112 |
function edit3_CreateFcn(hObject, eventdata, handles) |
|
|
113 |
% hObject handle to edit3 (see GCBO) |
|
|
114 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
115 |
% handles empty - handles not created until after all CreateFcns called |
|
|
116 |
|
|
|
117 |
% Hint: edit controls usually have a white background on Windows. |
|
|
118 |
% See ISPC and COMPUTER. |
|
|
119 |
if ispc |
|
|
120 |
set(hObject,'BackgroundColor','white'); |
|
|
121 |
else |
|
|
122 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
123 |
end |
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
function edit3_Callback(hObject, eventdata, handles) |
|
|
128 |
% hObject handle to edit3 (see GCBO) |
|
|
129 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
130 |
% handles structure with handles and user data (see GUIDATA) |
|
|
131 |
|
|
|
132 |
% Hints: get(hObject,'String') returns contents of edit3 as text |
|
|
133 |
% str2double(get(hObject,'String')) returns contents of edit3 as a double |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
% --- Executes during object creation, after setting all properties. |
|
|
137 |
function edit4_CreateFcn(hObject, eventdata, handles) |
|
|
138 |
% hObject handle to edit4 (see GCBO) |
|
|
139 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
140 |
% handles empty - handles not created until after all CreateFcns called |
|
|
141 |
|
|
|
142 |
% Hint: edit controls usually have a white background on Windows. |
|
|
143 |
% See ISPC and COMPUTER. |
|
|
144 |
if ispc |
|
|
145 |
set(hObject,'BackgroundColor','white'); |
|
|
146 |
else |
|
|
147 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
148 |
end |
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
function edit4_Callback(hObject, eventdata, handles) |
|
|
153 |
% hObject handle to edit4 (see GCBO) |
|
|
154 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
155 |
% handles structure with handles and user data (see GUIDATA) |
|
|
156 |
|
|
|
157 |
% Hints: get(hObject,'String') returns contents of edit4 as text |
|
|
158 |
% str2double(get(hObject,'String')) returns contents of edit4 as a double |
|
|
159 |
|
|
|
160 |
|
|
|
161 |
% --- Executes during object creation, after setting all properties. |
|
|
162 |
function edit5_CreateFcn(hObject, eventdata, handles) |
|
|
163 |
% hObject handle to edit5 (see GCBO) |
|
|
164 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
165 |
% handles empty - handles not created until after all CreateFcns called |
|
|
166 |
|
|
|
167 |
% Hint: edit controls usually have a white background on Windows. |
|
|
168 |
% See ISPC and COMPUTER. |
|
|
169 |
if ispc |
|
|
170 |
set(hObject,'BackgroundColor','white'); |
|
|
171 |
else |
|
|
172 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
173 |
end |
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
function edit5_Callback(hObject, eventdata, handles) |
|
|
178 |
% hObject handle to edit5 (see GCBO) |
|
|
179 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
180 |
% handles structure with handles and user data (see GUIDATA) |
|
|
181 |
|
|
|
182 |
% Hints: get(hObject,'String') returns contents of edit5 as text |
|
|
183 |
% str2double(get(hObject,'String')) returns contents of edit5 as a double |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
% --- Executes during object creation, after setting all properties. |
|
|
187 |
function edit6_CreateFcn(hObject, eventdata, handles) |
|
|
188 |
% hObject handle to edit6 (see GCBO) |
|
|
189 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
190 |
% handles empty - handles not created until after all CreateFcns called |
|
|
191 |
|
|
|
192 |
% Hint: edit controls usually have a white background on Windows. |
|
|
193 |
% See ISPC and COMPUTER. |
|
|
194 |
if ispc |
|
|
195 |
set(hObject,'BackgroundColor','white'); |
|
|
196 |
else |
|
|
197 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
198 |
end |
|
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
function edit6_Callback(hObject, eventdata, handles) |
|
|
203 |
% hObject handle to edit6 (see GCBO) |
|
|
204 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
205 |
% handles structure with handles and user data (see GUIDATA) |
|
|
206 |
|
|
|
207 |
% Hints: get(hObject,'String') returns contents of edit6 as text |
|
|
208 |
% str2double(get(hObject,'String')) returns contents of edit6 as a double |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
% --- Executes during object creation, after setting all properties. |
|
|
212 |
function edit7_CreateFcn(hObject, eventdata, handles) |
|
|
213 |
% hObject handle to edit7 (see GCBO) |
|
|
214 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
215 |
% handles empty - handles not created until after all CreateFcns called |
|
|
216 |
|
|
|
217 |
% Hint: edit controls usually have a white background on Windows. |
|
|
218 |
% See ISPC and COMPUTER. |
|
|
219 |
if ispc |
|
|
220 |
set(hObject,'BackgroundColor','white'); |
|
|
221 |
else |
|
|
222 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
223 |
end |
|
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
function edit7_Callback(hObject, eventdata, handles) |
|
|
228 |
% hObject handle to edit7 (see GCBO) |
|
|
229 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
230 |
% handles structure with handles and user data (see GUIDATA) |
|
|
231 |
|
|
|
232 |
% Hints: get(hObject,'String') returns contents of edit7 as text |
|
|
233 |
% str2double(get(hObject,'String')) returns contents of edit7 as a double |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
% --- Executes during object creation, after setting all properties. |
|
|
237 |
function edit8_CreateFcn(hObject, eventdata, handles) |
|
|
238 |
% hObject handle to edit8 (see GCBO) |
|
|
239 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
240 |
% handles empty - handles not created until after all CreateFcns called |
|
|
241 |
|
|
|
242 |
% Hint: edit controls usually have a white background on Windows. |
|
|
243 |
% See ISPC and COMPUTER. |
|
|
244 |
if ispc |
|
|
245 |
set(hObject,'BackgroundColor','white'); |
|
|
246 |
else |
|
|
247 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
248 |
end |
|
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
function edit8_Callback(hObject, eventdata, handles) |
|
|
253 |
% hObject handle to edit8 (see GCBO) |
|
|
254 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
255 |
% handles structure with handles and user data (see GUIDATA) |
|
|
256 |
|
|
|
257 |
% Hints: get(hObject,'String') returns contents of edit8 as text |
|
|
258 |
% str2double(get(hObject,'String')) returns contents of edit8 as a double |
|
|
259 |
|
|
|
260 |
|
|
|
261 |
% -------------------------------------------------------------------- |
|
|
262 |
function img_Callback(hObject, eventdata, handles) |
|
|
263 |
% hObject handle to img (see GCBO) |
|
|
264 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
265 |
% handles structure with handles and user data (see GUIDATA) |
|
|
266 |
|
|
|
267 |
|
|
|
268 |
% --- Executes on button press in pushbutton1. |
|
|
269 |
function pushbutton1_Callback(hObject, eventdata, handles) |
|
|
270 |
% hObject handle to pushbutton1 (see GCBO) |
|
|
271 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
272 |
% handles structure with handles and user data (see GUIDATA) |
|
|
273 |
|
|
|
274 |
sigma_val = str2double(get(handles.edit9,'String')); % gets sigma from text box |
|
|
275 |
y = By_this_you_can_do_Filtering(handles.image,sigma_val); % smooths the image |
|
|
276 |
axes(handles.axes1) |
|
|
277 |
imshow(y,[]); |
|
|
278 |
[xs, ys] = CLICK_FOR_Snake(y); % intializing the snake on the image |
|
|
279 |
|
|
|
280 |
handles.smth = y; |
|
|
281 |
handles.xs = xs; |
|
|
282 |
handles.ys = ys; |
|
|
283 |
guidata(hObject, handles); |
|
|
284 |
|
|
|
285 |
% Housekeeping |
|
|
286 |
set(handles.edit5,'Enable','on'); |
|
|
287 |
set(handles.edit6,'Enable','on'); |
|
|
288 |
set(handles.edit7,'Enable','on'); |
|
|
289 |
set(handles.edit8,'Enable','on'); |
|
|
290 |
set(handles.edit9,'Enable','off'); |
|
|
291 |
set(handles.edit10,'Enable','on'); |
|
|
292 |
set(handles.edit11,'Enable','on'); |
|
|
293 |
set(handles.edit12,'Enable','on'); |
|
|
294 |
set(handles.edit13,'Enable','on'); |
|
|
295 |
set(handles.pushbutton1,'Enable','off'); |
|
|
296 |
set(handles.pushbutton2,'Enable','on'); |
|
|
297 |
|
|
|
298 |
|
|
|
299 |
% --- Executes during object creation, after setting all properties. |
|
|
300 |
function edit9_CreateFcn(hObject, eventdata, handles) |
|
|
301 |
% hObject handle to edit9 (see GCBO) |
|
|
302 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
303 |
% handles empty - handles not created until after all CreateFcns called |
|
|
304 |
|
|
|
305 |
% Hint: edit controls usually have a white background on Windows. |
|
|
306 |
% See ISPC and COMPUTER. |
|
|
307 |
if ispc |
|
|
308 |
set(hObject,'BackgroundColor','white'); |
|
|
309 |
else |
|
|
310 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
311 |
end |
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
function edit9_Callback(hObject, eventdata, handles) |
|
|
316 |
% hObject handle to edit9 (see GCBO) |
|
|
317 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
318 |
% handles structure with handles and user data (see GUIDATA) |
|
|
319 |
|
|
|
320 |
% Hints: get(hObject,'String') returns contents of edit9 as text |
|
|
321 |
% str2double(get(hObject,'String')) returns contents of edit9 as a double |
|
|
322 |
|
|
|
323 |
|
|
|
324 |
% --- Executes during object creation, after setting all properties. |
|
|
325 |
function edit10_CreateFcn(hObject, eventdata, handles) |
|
|
326 |
% hObject handle to edit10 (see GCBO) |
|
|
327 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
328 |
% handles empty - handles not created until after all CreateFcns called |
|
|
329 |
|
|
|
330 |
% Hint: edit controls usually have a white background on Windows. |
|
|
331 |
% See ISPC and COMPUTER. |
|
|
332 |
if ispc |
|
|
333 |
set(hObject,'BackgroundColor','white'); |
|
|
334 |
else |
|
|
335 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
336 |
end |
|
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
function edit10_Callback(hObject, eventdata, handles) |
|
|
341 |
% hObject handle to edit10 (see GCBO) |
|
|
342 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
343 |
% handles structure with handles and user data (see GUIDATA) |
|
|
344 |
|
|
|
345 |
% Hints: get(hObject,'String') returns contents of edit10 as text |
|
|
346 |
% str2double(get(hObject,'String')) returns contents of edit10 as a double |
|
|
347 |
|
|
|
348 |
|
|
|
349 |
% --- Executes during object creation, after setting all properties. |
|
|
350 |
function edit11_CreateFcn(hObject, eventdata, handles) |
|
|
351 |
% hObject handle to edit11 (see GCBO) |
|
|
352 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
353 |
% handles empty - handles not created until after all CreateFcns called |
|
|
354 |
|
|
|
355 |
% Hint: edit controls usually have a white background on Windows. |
|
|
356 |
% See ISPC and COMPUTER. |
|
|
357 |
if ispc |
|
|
358 |
set(hObject,'BackgroundColor','white'); |
|
|
359 |
else |
|
|
360 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
361 |
end |
|
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
function edit11_Callback(hObject, eventdata, handles) |
|
|
366 |
% hObject handle to edit11 (see GCBO) |
|
|
367 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
368 |
% handles structure with handles and user data (see GUIDATA) |
|
|
369 |
|
|
|
370 |
% Hints: get(hObject,'String') returns contents of edit11 as text |
|
|
371 |
% str2double(get(hObject,'String')) returns contents of edit11 as a double |
|
|
372 |
|
|
|
373 |
|
|
|
374 |
% --- Executes during object creation, after setting all properties. |
|
|
375 |
function edit12_CreateFcn(hObject, eventdata, handles) |
|
|
376 |
% hObject handle to edit12 (see GCBO) |
|
|
377 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
378 |
% handles empty - handles not created until after all CreateFcns called |
|
|
379 |
|
|
|
380 |
% Hint: edit controls usually have a white background on Windows. |
|
|
381 |
% See ISPC and COMPUTER. |
|
|
382 |
if ispc |
|
|
383 |
set(hObject,'BackgroundColor','white'); |
|
|
384 |
else |
|
|
385 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
386 |
end |
|
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
function edit12_Callback(hObject, eventdata, handles) |
|
|
391 |
% hObject handle to edit12 (see GCBO) |
|
|
392 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
393 |
% handles structure with handles and user data (see GUIDATA) |
|
|
394 |
|
|
|
395 |
% Hints: get(hObject,'String') returns contents of edit12 as text |
|
|
396 |
% str2double(get(hObject,'String')) returns contents of edit12 as a double |
|
|
397 |
|
|
|
398 |
|
|
|
399 |
% --- Executes during object creation, after setting all properties. |
|
|
400 |
function edit13_CreateFcn(hObject, eventdata, handles) |
|
|
401 |
% hObject handle to edit13 (see GCBO) |
|
|
402 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
403 |
% handles empty - handles not created until after all CreateFcns called |
|
|
404 |
|
|
|
405 |
% Hint: edit controls usually have a white background on Windows. |
|
|
406 |
% See ISPC and COMPUTER. |
|
|
407 |
if ispc |
|
|
408 |
set(hObject,'BackgroundColor','white'); |
|
|
409 |
else |
|
|
410 |
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
|
|
411 |
end |
|
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
|
415 |
function edit13_Callback(hObject, eventdata, handles) |
|
|
416 |
% hObject handle to edit13 (see GCBO) |
|
|
417 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
418 |
% handles structure with handles and user data (see GUIDATA) |
|
|
419 |
|
|
|
420 |
% Hints: get(hObject,'String') returns contents of edit13 as text |
|
|
421 |
% str2double(get(hObject,'String')) returns contents of edit13 as a double |
|
|
422 |
|
|
|
423 |
|
|
|
424 |
% --- Executes on button press in pushbutton2. |
|
|
425 |
function pushbutton2_Callback(hObject, eventdata, handles) |
|
|
426 |
% hObject handle to pushbutton2 (see GCBO) |
|
|
427 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
428 |
% handles structure with handles and user data (see GUIDATA) |
|
|
429 |
|
|
|
430 |
%obtiaing various paramaeters form the text boxes |
|
|
431 |
alpha_val = str2double(get(handles.edit5,'String')); |
|
|
432 |
beta_val = str2double(get(handles.edit6,'String')); |
|
|
433 |
gamma_val = str2double(get(handles.edit7,'String')); |
|
|
434 |
kappa_val = str2double(get(handles.edit8,'String')); |
|
|
435 |
weline_val = str2double(get(handles.edit11,'String')); |
|
|
436 |
weedge_val = str2double(get(handles.edit12,'String')); |
|
|
437 |
weterm_val = str2double(get(handles.edit13,'String')); |
|
|
438 |
inter_val = str2double(get(handles.edit10,'String')); |
|
|
439 |
|
|
|
440 |
% housekeeping |
|
|
441 |
set(handles.pushbutton1,'Enable','off'); |
|
|
442 |
set(handles.pushbutton3,'Enable','off'); |
|
|
443 |
set(handles.pushbutton4,'Enable','off'); |
|
|
444 |
|
|
|
445 |
set(handles.pushbutton2,'Enable','off'); |
|
|
446 |
% Making the snake move |
|
|
447 |
Do_your_Iterations(handles.smth, handles.xs, handles.ys, alpha_val, beta_val, gamma_val, kappa_val, weline_val, weedge_val, weterm_val, inter_val); |
|
|
448 |
set(handles.pushbutton2,'Enable','on'); |
|
|
449 |
|
|
|
450 |
set(handles.pushbutton1,'Enable','on'); |
|
|
451 |
set(handles.pushbutton3,'Enable','on'); |
|
|
452 |
set(handles.pushbutton4,'Enable','on'); |
|
|
453 |
|
|
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
% --- Executes on button press in pushbutton3. |
|
|
458 |
function pushbutton3_Callback(hObject, eventdata, handles) |
|
|
459 |
% hObject handle to pushbutton3 (see GCBO) |
|
|
460 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
461 |
% handles structure with handles and user data (see GUIDATA) |
|
|
462 |
|
|
|
463 |
[filename, pathname] = uigetfile(... |
|
|
464 |
{'*.tif;*.jpg;*.pgm';'*.*'},'File Selector'); |
|
|
465 |
handles.filename = strcat(pathname,'\',filename); |
|
|
466 |
guidata(hObject, handles); |
|
|
467 |
handles.filename |
|
|
468 |
|
|
|
469 |
axes(handles.axes1) |
|
|
470 |
x = imread(handles.filename); |
|
|
471 |
imshow(x,[]); |
|
|
472 |
|
|
|
473 |
handles.image = x; |
|
|
474 |
guidata(hObject, handles); |
|
|
475 |
|
|
|
476 |
% Following code set the parameters according to the image selected |
|
|
477 |
if(strcmp(filename,'img1.tif')) |
|
|
478 |
set(handles.edit9,'string','2.00'); |
|
|
479 |
set(handles.edit5,'string','0.40'); |
|
|
480 |
set(handles.edit6,'string','0.20'); |
|
|
481 |
set(handles.edit7,'string','1.00'); |
|
|
482 |
set(handles.edit8,'string','0.15'); |
|
|
483 |
|
|
|
484 |
set(handles.edit11,'string','0.30'); |
|
|
485 |
set(handles.edit12,'string','0.40'); |
|
|
486 |
set(handles.edit13,'string','0.70'); |
|
|
487 |
|
|
|
488 |
set(handles.edit10,'string','200'); |
|
|
489 |
|
|
|
490 |
elseif(strcmp(filename,'img2.tif')) |
|
|
491 |
set(handles.edit9,'string','1.00'); |
|
|
492 |
set(handles.edit5,'string','0.40'); |
|
|
493 |
set(handles.edit6,'string','0.20'); |
|
|
494 |
set(handles.edit7,'string','1.00'); |
|
|
495 |
set(handles.edit8,'string','0.15'); |
|
|
496 |
|
|
|
497 |
set(handles.edit11,'string','0.30'); |
|
|
498 |
set(handles.edit12,'string','0.40'); |
|
|
499 |
set(handles.edit13,'string','0.70'); |
|
|
500 |
|
|
|
501 |
set(handles.edit10,'string','300'); |
|
|
502 |
|
|
|
503 |
elseif(strcmp(filename,'square.jpg')) |
|
|
504 |
set(handles.edit9,'string','1.00'); |
|
|
505 |
set(handles.edit5,'string','0.20'); |
|
|
506 |
set(handles.edit6,'string','0.20'); |
|
|
507 |
set(handles.edit7,'string','1.00'); |
|
|
508 |
set(handles.edit8,'string','0.1'); |
|
|
509 |
|
|
|
510 |
set(handles.edit11,'string','0.0'); |
|
|
511 |
set(handles.edit12,'string','0.40'); |
|
|
512 |
set(handles.edit13,'string','0.0'); |
|
|
513 |
|
|
|
514 |
set(handles.edit10,'string','450'); |
|
|
515 |
elseif(strcmp(filename,'circle.jpg')) |
|
|
516 |
set(handles.edit9,'string','1.00'); |
|
|
517 |
set(handles.edit5,'string','0.40'); |
|
|
518 |
set(handles.edit6,'string','0.20'); |
|
|
519 |
set(handles.edit7,'string','1.00'); |
|
|
520 |
set(handles.edit8,'string','0.05'); |
|
|
521 |
|
|
|
522 |
set(handles.edit11,'string','0.00'); |
|
|
523 |
set(handles.edit12,'string','0.40'); |
|
|
524 |
set(handles.edit13,'string','0.00'); |
|
|
525 |
|
|
|
526 |
set(handles.edit10,'string','200'); |
|
|
527 |
elseif(strcmp(filename,'heart.pgm')) |
|
|
528 |
set(handles.edit9,'string','2.00'); |
|
|
529 |
set(handles.edit5,'string','0.10'); |
|
|
530 |
set(handles.edit6,'string','0.05'); |
|
|
531 |
set(handles.edit7,'string','1.00'); |
|
|
532 |
set(handles.edit8,'string','0.1'); |
|
|
533 |
|
|
|
534 |
set(handles.edit11,'string','0.10'); |
|
|
535 |
set(handles.edit12,'string','0.70'); |
|
|
536 |
set(handles.edit13,'string','0.20'); |
|
|
537 |
|
|
|
538 |
set(handles.edit10,'string','200'); |
|
|
539 |
elseif(strcmp(filename,'room.pgm')) |
|
|
540 |
set(handles.edit9,'string','1.00'); |
|
|
541 |
set(handles.edit5,'string','0.40'); |
|
|
542 |
set(handles.edit6,'string','0.20'); |
|
|
543 |
set(handles.edit7,'string','1.00'); |
|
|
544 |
set(handles.edit8,'string','0.05'); |
|
|
545 |
|
|
|
546 |
set(handles.edit11,'string','0.40'); |
|
|
547 |
set(handles.edit12,'string','0.40'); |
|
|
548 |
set(handles.edit13,'string','0.30'); |
|
|
549 |
|
|
|
550 |
set(handles.edit10,'string','200'); |
|
|
551 |
elseif(strcmp(filename,'new.pgm')) |
|
|
552 |
set(handles.edit9,'string','5.00'); |
|
|
553 |
set(handles.edit5,'string','0.20'); |
|
|
554 |
set(handles.edit6,'string','0.20'); |
|
|
555 |
set(handles.edit7,'string','1.00'); |
|
|
556 |
set(handles.edit8,'string','0.15'); |
|
|
557 |
|
|
|
558 |
set(handles.edit11,'string','0.10'); |
|
|
559 |
set(handles.edit12,'string','0.70'); |
|
|
560 |
set(handles.edit13,'string','0.70'); |
|
|
561 |
|
|
|
562 |
set(handles.edit10,'string','200'); |
|
|
563 |
elseif(strcmp(filename,'chest.pgm')) |
|
|
564 |
set(handles.edit9,'string','1.00'); |
|
|
565 |
set(handles.edit5,'string','0.10'); |
|
|
566 |
set(handles.edit6,'string','0.10'); |
|
|
567 |
set(handles.edit7,'string','1.00'); |
|
|
568 |
set(handles.edit8,'string','0.15'); |
|
|
569 |
|
|
|
570 |
set(handles.edit11,'string','-0.20'); |
|
|
571 |
set(handles.edit12,'string','0.70'); |
|
|
572 |
set(handles.edit13,'string','0.70'); |
|
|
573 |
|
|
|
574 |
set(handles.edit10,'string','200'); |
|
|
575 |
end |
|
|
576 |
|
|
|
577 |
%housekeeping |
|
|
578 |
set(handles.edit5,'Enable','off'); |
|
|
579 |
set(handles.edit6,'Enable','off'); |
|
|
580 |
set(handles.edit7,'Enable','off'); |
|
|
581 |
set(handles.edit8,'Enable','off'); |
|
|
582 |
set(handles.edit9,'Enable','on'); |
|
|
583 |
set(handles.edit10,'Enable','off'); |
|
|
584 |
set(handles.edit11,'Enable','off'); |
|
|
585 |
set(handles.edit12,'Enable','off'); |
|
|
586 |
set(handles.edit13,'Enable','off'); |
|
|
587 |
set(handles.pushbutton2,'Enable','off'); |
|
|
588 |
set(handles.pushbutton1,'Enable','on'); |
|
|
589 |
|
|
|
590 |
|
|
|
591 |
% --- Executes on button press in pushbutton4. |
|
|
592 |
function pushbutton4_Callback(hObject, eventdata, handles) |
|
|
593 |
% hObject handle to pushbutton4 (see GCBO) |
|
|
594 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
595 |
% handles structure with handles and user data (see GUIDATA) |
|
|
596 |
|
|
|
597 |
axes(handles.axes1) |
|
|
598 |
imshow(handles.image,[]); |
|
|
599 |
|
|
|
600 |
% housekeeping |
|
|
601 |
set(handles.edit5,'Enable','off'); |
|
|
602 |
set(handles.edit6,'Enable','off'); |
|
|
603 |
set(handles.edit7,'Enable','off'); |
|
|
604 |
set(handles.edit8,'Enable','off'); |
|
|
605 |
set(handles.edit9,'Enable','on'); |
|
|
606 |
set(handles.edit10,'Enable','off'); |
|
|
607 |
set(handles.edit11,'Enable','off'); |
|
|
608 |
set(handles.edit12,'Enable','off'); |
|
|
609 |
set(handles.edit13,'Enable','off'); |
|
|
610 |
set(handles.pushbutton2,'Enable','off'); |
|
|
611 |
set(handles.pushbutton1,'Enable','on'); |
|
|
612 |
|
|
|
613 |
|
|
|
614 |
% --- Executes during object creation, after setting all properties. |
|
|
615 |
function axes4_CreateFcn(hObject, eventdata, handles) |
|
|
616 |
% hObject handle to axes4 (see GCBO) |
|
|
617 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
618 |
% handles empty - handles not created until after all CreateFcns called |
|
|
619 |
i=imread('logo-condorcet.jpg'); |
|
|
620 |
imshow(i); |
|
|
621 |
% Hint: place code in OpeningFcn to populate axes4 |
|
|
622 |
|
|
|
623 |
|
|
|
624 |
% --- Executes during object creation, after setting all properties. |
|
|
625 |
function axes5_CreateFcn(hObject, eventdata, handles) |
|
|
626 |
% hObject handle to axes5 (see GCBO) |
|
|
627 |
% eventdata reserved - to be defined in a future version of MATLAB |
|
|
628 |
% handles empty - handles not created until after all CreateFcns called |
|
|
629 |
i=imread('MAIA_LOGO.jpg'); |
|
|
630 |
imshow(i); |
|
|
631 |
|
|
|
632 |
% Hint: place code in OpeningFcn to populate axes5 |
|
|
633 |
|
|
|
634 |
%% END |