?? guimap.m
字號:
function guimap(action)% GUIMAP Handles initialization and GUI interface.% All the software included in this package is presented as is.% It may be distributed freely. The author can, however, not be% held responsible for any problems whatever.% % Designed by Johan Baeten.% Last updated: 22-03-2000% Johan.baeten@mech.kuleuven.ac.beglobal UICTRHANDLESglobal FITHANDLESglobal SUBMENUHANDLESglobal PIXFACTORglobal NR_OF_FITS;if nargin<1, action='initialize';end;if strcmp(action(1:4),'show'), if strcmp(action,'showmain'), setting('menubarenableon'); if strcmp(get(SUBMENUHANDLES(6),'enable'),'off'), pact = get(FITHANDLES(1,8),'string'); if strcmp(pact,'Stop Adding'), routine('stopadding'); elseif (strcmp(pact,'Cancel Delete')| strcmp(pact,'Stop Deleting')), routine('canceldelete') end routine('done'); end end [flag,fig]=figflag('GUI Info Window'); if flag, set(fig, 'visible','off'); end;elseif strcmp(action,'aboutgui'), ttlStr='About GUI...'; hlpStr= ... [' ' ' Contour Fitting ' ' Graphical User Interface. ' ' @1998 - 2000 ' ' ' ' ' ' ... View Images ... ' ' ... Grab "Real Time" Images ... ' ' ... Select Feature Points ... ' ' ... Compare Different Fit Models ... ' ' ' ' and more ' ' ' ' ' ' ' 'Johan Baeten, KULEUVEN PMA ' ' ' 'e-mail: johan.baeten@mech.kuleuven.ac.be ' ' ']; uitleg(ttlStr,hlpStr); elseif strcmp(action,'initialize'), oldRootUnits = get(0,'Units'); set(0, 'Units', 'pixels'); figurePos=get(0,'DefaultFigurePosition'); figurePos(3:4)=[900 685]; %old value [850 685] % Make sure the title bar of the window isn't off the screen % (position is [x(from left) y(bottom edge from bottom) width height] rootScreenSize = get(0,'ScreenSize'); PIXFACTOR = 0.8; if (rootScreenSize(4)> 685* PIXFACTOR) & (rootScreenSize(3)>900* PIXFACTOR), figurePos = figurePos * PIXFACTOR; figurePos (1) = rootScreenSize(3)/2 - 450* PIXFACTOR; figurePos (2) = rootScreenSize(4)/2 - 342* PIXFACTOR; set(0, 'Units', oldRootUnits); else PIXFACTOR = 72/get(0,'screenpixelsperinch'); figurePos = figurePos * PIXFACTOR; % check left edge and right edge if ((figurePos(1) < 1) ... | (figurePos(1)+figurePos(3) > rootScreenSize(3))) figurePos(1) = 30; end set(0, 'Units', oldRootUnits); if ((figurePos(2)+figurePos(4)+60 > rootScreenSize(4)) ... | (figurePos(2) < 1)) figurePos(2) = rootScreenSize(4) - figurePos(4) - 60; end end figNumber=figure( ... 'Visible','off', ... 'Name','Contour Fitting Graphical User Interface', ... 'NumberTitle','off', ... 'Color',[0.0 0.4 0.4], ... 'Resize','on', ... 'MenuBar','none', ... 'Position',figurePos, ... 'Pointer','watch'); axis off; guimenu(figNumber); % Commentaarbalk h = uicontrol(figNumber,'style','text',... 'HorizontalAlignment','left',... 'Position',[0 0 figurePos(3)+5 20]); UICTRHANDLES(1)=h; btw = 80; bth = 30; % Initialize map buttons FITHANDLES(1,9) = uicontrol(figNumber, ... 'style','frame', ... 'position',[620 360 (820-620) (610-325)]* PIXFACTOR); FITHANDLES(1,1) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[730 525 btw bth]* PIXFACTOR,... 'string','Clear All', ... 'tooltipString','Clear all points and fits',... 'callback','routine(''new'')'); FITHANDLES(1,2) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[630 605 btw bth]* PIXFACTOR,... 'interruptible','on',... 'string','Add Point', ... 'tooltipString','Add point in figure or list',... 'callback','routine(''add'')'); FITHANDLES(1,3) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[630 565 btw bth]* PIXFACTOR,... 'string','Delete', ... 'tooltipString','Delete point',... 'callback','routine(''delete'')'); FITHANDLES(1,4) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[730 605 btw bth]* PIXFACTOR,... 'string','Edit/Move', ... 'tooltipString','Drag point in figure or edit value in list',... 'callback','routine(''move'')'); FITHANDLES(1,5) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[730 565 btw bth]* PIXFACTOR,... 'string','Sort', ... 'tooltipString','Sort points descending in y',... 'callback','routine(''sort'')'); FITHANDLES(1,6) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[630 420 btw bth]* PIXFACTOR,... 'string','Fit', ... 'tooltipString','Calculate and show fit through points',... 'callback','routine(''fit'')'); FITHANDLES(1,7) = uicontrol(figNumber, ... 'style','popupmenu', ... 'position',[630 450 2*btw+20 bth]* PIXFACTOR,... 'HorizontalAlignment','left',... 'tooltipString','Select fit model type',... 'string',['1st order lines ';... 'Full 2nd order TLS ';... '3rd order Polynome ';... 'Cubic Splines ';... 'Matlab''s Splines ';... 'Smoothing Cubic Splines ';... 'Parametric Splines ';... 'Par. Natural Splines ';... 'Par. 3rd ord Polynome ';... 'Par. Arclen. Cub. Splines';... 'Par. Arclen. Nat. Splines';... 'Par. Arclen. 3rd ord. Pol']); FITHANDLES(1,8) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[660 370 btw+40 bth]* PIXFACTOR,... 'string','Close', ... 'callback','routine(''done'')'); FITHANDLES(1,10) = uicontrol(figNumber, ... 'style','frame', ... 'position',[620 75 (820-620) (310-40)]* PIXFACTOR); FITHANDLES(1,11) = uicontrol(figNumber, ... 'style','text', ... 'string','List of Points',... 'position',[622 323 196 20]* PIXFACTOR); FITHANDLES(1,12) = uicontrol(figNumber, ... 'style','text', ... 'string',' # x value y value ',... 'value',0,... % value give the actual number of points 'position',[624 307 190 20]* PIXFACTOR); FITHANDLES(1,13) = uicontrol(figNumber, ... 'style','frame', ... 'backgroundcolor',[.8 .8 .8],... 'position',[624 79 34 225]* PIXFACTOR); FITHANDLES(1,14) = uicontrol(figNumber, ... 'style','frame', ... 'backgroundcolor',[1 1 1],... 'position',[662 79 75 225]* PIXFACTOR); FITHANDLES(1,15) = uicontrol(figNumber, ... 'style','frame', ... 'backgroundcolor',[1 1 1],... 'position',[741 79 75 225]* PIXFACTOR); FITHANDLES(1,16) = uicontrol(figNumber, ... 'style','text', ... 'string','Fit points by ...',... 'position',[630 480 120 20]* PIXFACTOR); FITHANDLES(1,17) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[630 525 btw bth]* PIXFACTOR,... 'string','ISEF edge', ... 'tooltipString','Automatic edge point extraction',... 'callback','iseffnct(''start'')'); FITHANDLES(1,18) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[730 420 btw bth]* PIXFACTOR,... 'string','Clear Fit', ... 'tooltipString','Clear fit only',... 'callback','delete(findobj(gca, ''type'', ''line''));routine(''plotpunten'')'); FITHANDLES(1,19) = uicontrol(figNumber, ... 'style','frame', ... 'backgroundcolor',[1 1 1],... 'position',[630 510 180 2]* PIXFACTOR); FITHANDLES(1,20) = uicontrol(figNumber, ... 'style','frame', ... 'backgroundcolor',[1 1 1],... 'position',[630 408 180 2]* PIXFACTOR); % UICTRHANDLES(2) = uicontrol(figNumber, ...% 'style','pushbutton', ...% 'position',[0 655 btw bth]* PIXFACTOR,...% 'string','Open', ...% 'callback','ldimgff'); % UICTRHANDLES(3) = uicontrol(figNumber, ...% 'style','pushbutton', ...% 'position',[80 655 btw bth]* PIXFACTOR,...% 'string','Grab', ...% 'callback','grab1im'); % UICTRHANDLES(4) = uicontrol(figNumber, ...% 'style','pushbutton', ...% 'position',[160 655 btw bth]* PIXFACTOR,...% 'string','Capture', ...% 'callback','capture'); maxnrofpoints = 12; lbh = 18; lbw = 25; for i = 1:maxnrofpoints, FITHANDLES(2,i) = uicontrol(figNumber, ... 'style','pushbutton', ... 'position',[629 300-i*lbh lbw lbh]* PIXFACTOR,... 'string',num2str(i), ... 'callback','routine([''point'',get(gco,''string'')])'); end for i = 1:maxnrofpoints, FITHANDLES(3,i) = uicontrol(figNumber, ... 'style','text', ... 'backgroundcolor',[1 1 1],... 'position',[675 300-i*lbh 2*lbw lbh]* PIXFACTOR,... 'value',-1); % -1 means no valid value end for i = 1:maxnrofpoints, FITHANDLES(4,i) = uicontrol(figNumber, ... 'style','text', ... 'backgroundcolor',[1 1 1],... 'position',[754 300-i*lbh 2*lbw lbh]* PIXFACTOR,... 'value',-1); end set(FITHANDLES(2,1:maxnrofpoints),'enable','off'); set(FITHANDLES,'units','pixels','visible','off'); % Build start up screen beeld = ldimgff('bocht.pgm'); image(beeld), colormap(gray(255)); set(figNumber,'NextPlot','add','Visible','on','pointer','arrow'); setting('viewsize'); % allow resizing boxesNButtons set([FITHANDLES], 'Units', 'normalized'); set([UICTRHANDLES], 'Units', 'normalized'); routine('selectpoints'); NR_OF_FITS = 0; elseif strcmp(action,'suretoquit'), setting('menubarenableoff'); figurePos=get(0,'DefaultFigurePosition'); figurePos(3:4)=[220 40]; figNumber=figure( ... 'Name','Are you sure?', ... 'NumberTitle','off', ... 'Visible','off', ... 'Color',[0.5 0.5 0.5], ... 'MenuBar','none', ... 'Position',figurePos ... ); axis off; uicontrol(figNumber,'string','Yes, Quit',... 'HorizontalAlignment','center',... 'position',[25 10 100 20],... 'Callback','quit'); uicontrol(figNumber,'string','No !',... 'HorizontalAlignment','center',... 'position',[140 10 50 20],... 'Callback','delete(gcf); guimap(''showmain'')'); set(figNumber,'Visible','on');end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -