230 likes | 258 Views
Graphic User Interface. Review of Lecture 1 to Lecture 6 C.F. Lu. Basic idea of GUI. LECTURE 1. Example: grandmom = figure; mom = axes( ‘parent’ ,grandmom); child = image( ‘parent’ ,mom);. Root. Figures. UI controls. Axes. UI Menus. Images. Lines. Patches. Surfaces. Texts.
E N D
Graphic User Interface Review of Lecture 1 to Lecture 6 C.F. Lu
Basic idea of GUI LECTURE 1
Example: grandmom = figure; mom = axes(‘parent’,grandmom); child = image(‘parent’,mom); Root Figures UI controls Axes UI Menus Images Lines Patches Surfaces Texts Lighting
Your Good Friendsin command window • help • help function_name, ex:help min • set • set(handle), ex: set(uicontrol) • get • get(handle), ex: get(axes)
Callback property LECTURE 2
Your Good Friendsin Callback • global • global variables, ex:global handle Data • uicontrol • uicontrol(‘Callback’, ‘function_name(“action”)’) ex: uicontrol(‘Callback’,’GUI(“quit”)’) • if…elseif…end • elseif strcmp(action, ’quit’)
Popup uicontrol & filters LECTURE 3
Your Good Friendsin popup uicontrol • uicontrol(‘Style’,…,’String’,…,’Callback’,…) • ex: uicontrol(‘Style’, ’popup’,… ’String’, ‘ I love you | I hate you’,… ‘Callback’, ‘GUI(“pop”)’) • switch…case…end • ex: switch get(handle.pop,’value’) case 1 fprintf(‘Thank you. You are a good man.’) case 2 fprintf(‘Really? Me too.’) end
Your Good Friendsin filtering • filter array • smooth high pass • conv2(image,filter,’same’)
ROI rubber band & correlation LECTURE 4
Your Good Friendsin ROI rubber band • set(image, ’ButtonDownFcn’,…) set(figure, ’WindowButtonMotionFcn’,…) set(figure, ’WindowButtonUpFcn’,…) • set(line, ‘color’, ’b’ , ’lineStyle’, ‘--’,… ‘Xdata’, [pt1(1) pt2(1) pt2(1) pt1(1) pt1(1)],… ‘Ydata’, [pt1(2) pt1(2) pt2(2) pt2(2) pt1(2)],… ‘EraseMode’,’xor’) pt1 pt2
Your Good Friendsin ROI rubber band • pt1 = get(axes, ‘CurrentPoint’) pt1 = pt1(1,1:2) • Axes location Matrix index • x col • y row (x, y) (row, col) x y (reversed)
Tag & UserData properties LECTURE 5
Your Good Friendsin information communication • global handles and variables • Tag property handles • set(axes, ’Tag’, ’sub1’) • sub1=findobj(gcf, ’Tag’, ‘sub1’) • UserData property variables • set(gcf, ’UserData’, Data) • Data = get(gcf, ’UserData’)
Slider & re-contrast with histogram LECTURE 6
Your Good Friendsin slider bar • uicontrol(‘Style’,’slider’,… ‘Min’, 1,’Max’, 100,… ‘SliderStep’,[ 1 10],… ‘Value’,20) • get(handle_slider,’value’) • round(get(handle_slider,’value’))
Your Good Friendsin axes & line • Set(axes, ’Xlim’,[0 100], ‘Ylim’, [0 1000],… ‘XColor’, ’blue’, ’YColor’, ’red’,… ‘XTickmode’, ’manual’,… ‘XTick’,[0:10:100]) • set(line, ’ButtonDownFcn’,…) set(figure, ’WindowButtonMotionFcn’,…) set(figure, ’WindowButtonUpFcn’,…)
Your Good Friendsin re-contrast • Image=image-newmin; • Image=image/(newmax-newmin); newmin newmax
THE END Thanks for your attention^^