《matlab毕业编程谷速软件动态轮廓地实施和测试平台地GUI.doc》由会员分享,可在线阅读,更多相关《matlab毕业编程谷速软件动态轮廓地实施和测试平台地GUI.doc(60页珍藏版)》请在课桌文档上搜索。
1、function varargout = ActiveCountorsGUI(varargin) ACTIVECOUNTORSGUI, by itself, creates a new ACTIVECOUNTORSGUI or raises the existing singleton*. H = ACTIVECOUNTORSGUI returns the handle to a new ACTIVECOUNTORSGUI or the handle to the existing singleton*. ACTIVECOUNTORSGUI(CALLBACK,hObject,eventData
2、,handles,.) calls the local function named CALLBACK in ACTIVECOUNTORSGUI.M with the given input arguments. ACTIVECOUNTORSGUI(Property,Value,.) creates a new ACTIVECOUNTORSGUI or raises the existing singleton*. Starting from the left, property value pairs are applied to the GUI before ActiveCountorsG
3、UI_OpeningFunction gets called. An unrecognized property name or invalid value makes property application stop. All inputs are passed to ActiveCountorsGUI_OpeningF via varargin. *See GUI Options on GUIDEs Tools menu. Choose GUI allows only one instance to run (singleton). See also: GUIDE, GUIDATA, G
4、UIHANDLES Edit the above NoiseLambdaText to modify the response to help ActiveCountorsGUI Last Modified by GUIDE v2.5 28-Jun-2011 11:26:19 Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct(gui_Name, mfilename, . gui_Singleton, gui_Singleton, . gui_OpeningF, ActiveCountorsGU
5、I_OpeningF, . gui_OutputF, ActiveCountorsGUI_OutputF, . gui_LayoutF, , . gui_Callback, );if nargin & ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);endif nargout varargout1:nargout = gui_mainf(gui_State, varargin:);else gui_mainf(gui_State, varargin:);end End initialization code - DO
6、 NOT EDIT - Executes just before ActiveCountorsGUI is made visible.function ActiveCountorsGUI_OpeningF(hObject, eventdata, handles, varargin) This function has no output args, see OutputF. hObject handle to figure eventdata reserved - to be defined in a future version of MATLAB handles structure wit
7、h handles and user data (see GUIDATA) varargin mand line arguments to ActiveCountorsGUI (see VARARGIN) Choose default mand line output for ActiveCountorsGUIhandles.output = hObject; subplot(Position,0.29,0.12,0.79,0.79);X=zeros(300,250,3);X(:,:,2)=200;imshow(uint8(X),Parent,handles.Axes);txt_hndl=ze
8、ros(1,2);txt_hndl(1)=text(20,146,Wele to our GUI!,. ,1. Choose image file for segmentation, using Load Image File button.,. ,2. Choose noise model parameters in , Noise Model panel.,. ,3. Choose the Gaussian blur filter Sigma value in , Blur denoise panel.,. ,4. Choose the color space and colr eleme
9、nt in , Color space panel.,. ,5. Choose the contour based segmentation algorithm , to apply and set desired algorithm parameters.,. ,6. Choose your display settings in the, Display Menu panel.,. ,7. Choose refresh rate of displayed images, and save rate of saved images.,. ,8. Choose output path for
10、saved images during, algorithm application (default - current directory).,. ,9. Finally, press Run below, and enjoy the magic.,. FontSize,12); txt_hndl(2)=text(50,308,copyright Nikolay S. & Alex B.,FontSize,10,FontAngle,italic,Color,r); set(txt_hndl,Units,Normalized);set(txt_hndl,FontUnits,Normalize
11、d); Update handles structureguidata(hObject, handles); UIWAIT makes ActiveCountorsGUI wait for user response (see UIRESUME) uiwait(handles.GUIfig); - Outputs from this function are returned to the mand line.function varargout = ActiveCountorsGUI_OutputF(hObject, eventdata, handles) varargout cell ar
12、ray for returning output args (see VARARGOUT); hObject handle to figure eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Get default mand line output from handles structurevarargout1 = handles.output; - Executes during object
13、 creation, after setting all properties.function GUIfig_CreateF(hObject, eventdata, handles) hObject handle to GUIfig (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called - Executes on button press in ShowCont
14、our.clc;clear all;warning off;fprintf(snn,Active Contours GUI started.); - Executes on selection change in popupmenu2.function popupmenu2_Callback(hObject, eventdata, handles) hObject handle to popupmenu2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure w
15、ith handles and user data (see GUIDATA) Hints: contents = get(hObject,String) returns popupmenu2 contents as cell array contentsget(hObject,Value) returns selected item from popupmenu2 - Executes during object creation, after setting all properties.function popupmenu2_CreateF(hObject, eventdata, han
16、dles) hObject handle to popupmenu2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called Hint: popupmenu controls usually have a white background on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,Bac
17、kgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end - Executes during object creation, after setting all properties.function OutDir_CreateF(hObject, eventdata, handles) hObject handle to OutDir (see GCBO) eventdata reserved - to be defined in a future version
18、 of MATLAB handles empty - handles not created until after all CreateFs calledhandles=guidata(hObject);directory_name=cd; default value is current directoryhandles.OutDirPath=directory_name;guidata(hObject,handles); - Executes on button press in OutDir.function OutDir_Callback(hObject, eventdata, ha
19、ndles) hObject handle to OutDir (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)handles=guidata(hObject);directory_name = uigetdir;handles.OutDirPath=directory_name;guidata(hObject,handles); - Executes on button pr
20、ess in LoadFileButton.function LoadFileButton_Callback(hObject, eventdata, handles) hObject handle to LoadFileButton (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)handles=guidata(hObject);FilterSpec=*.jpg;*.jpeg;
21、*.gif;*.bmp;*.png;*.tiff;*.tif,Image Files (*.jpg;*.jpeg;*.gif;*.bmp;*.png;*.tiff;*.tif); DialogTitle=Select image file; FileName,PathName = uigetfile(FilterSpec,DialogTitle); if (isequal(FileName,0) disp(File could not be loaded); return; endhandles.ImageFileAddr=PathName,FileName;guidata(hObject,h
22、andles);handles.ImageData=add_noise2image(hObject);set(handles.AlgParamsPanel,handles.AlgTypePanel,handles.NoiseModelPanel,. handles.DispMenuPanel,handles.RunPanel,handles.ColorSpacePanel,. handles.BlurUipanel,Visible,on); for each new image, demand a new mask definitionhandles.UserMask=;set(handles
23、.UserDefineMaskButton,String,Define Mask);guidata(hObject,handles);function MiuAlgEdit_Callback(hObject, eventdata, handles) hObject handle to MiuAlgEdit (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Hints: get(
24、hObject,String) returns contents of MiuAlgEdit as NoiseLambdaText str2num(get(hObject,String) returns contents of MiuAlgEdit as a doublehandles=guidata(hObject);set(hObject,Value,str2num(get(hObject,String); set value property equal to string numerical value propertyguidata(hObject,handles); - Execu
25、tes during object creation, after setting all properties.function MiuAlgEdit_CreateF(hObject, eventdata, handles) hObject handle to MiuAlgEdit (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called Hint: edit co
26、ntrols usually have a white background on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);endfunction NuAlgEdit_Callback(hObject, eventdata, handles) hObject handle to NuAlgEdit (see GCBO) eventdata
27、 reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Hints: get(hObject,String) returns contents of NuAlgEdit as NoiseLambdaText str2num(get(hObject,String) returns contents of NuAlgEdit as a doublehandles=guidata(hObject);set(hObject,Val
28、ue,str2num(get(hObject,String); set value property equal to string numerical value propertyguidata(hObject,handles); - Executes during object creation, after setting all properties.function NuAlgEdit_CreateF(hObject, eventdata, handles) hObject handle to NuAlgEdit (see GCBO) eventdata reserved - to
29、be defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called Hint: edit controls usually have a white background on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,Backgroun
30、dColor,white);endfunction DeltaTAlgEdit_Callback(hObject, eventdata, handles) hObject handle to DeltaTAlgEdit (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Hints: get(hObject,String) returns contents of DeltaTAl
31、gEdit as NoiseLambdaText str2num(get(hObject,String) returns contents of DeltaTAlgEdit as a doublehandles=guidata(hObject);set(hObject,Value,str2num(get(hObject,String); set value property equal to string numerical value propertyguidata(hObject,handles); - Executes during object creation, after sett
32、ing all properties.function DeltaTAlgEdit_CreateF(hObject, eventdata, handles) hObject handle to DeltaTAlgEdit (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called Hint: edit controls usually have a white back
33、ground on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);endfunction Lambda1AlgEdit_Callback(hObject, eventdata, handles) hObject handle to Lambda1AlgEdit (see GCBO) eventdata reserved - to be defi
34、ned in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Hints: get(hObject,String) returns contents of Lambda1AlgEdit as NoiseLambdaText str2num(get(hObject,String) returns contents of Lambda1AlgEdit as a doublehandles=guidata(hObject);set(hObject,Value,str2num(g
35、et(hObject,String); set value property equal to string numerical value propertyguidata(hObject,handles); - Executes during object creation, after setting all properties.function Lambda1AlgEdit_CreateF(hObject, eventdata, handles) hObject handle to Lambda1AlgEdit (see GCBO) eventdata reserved - to be
36、 defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called Hint: edit controls usually have a white background on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundC
37、olor,white);endfunction Lambda2AlgEdit_Callback(hObject, eventdata, handles) hObject handle to Lambda2AlgEdit (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Hints: get(hObject,String) returns contents of Lambda2A
38、lgEdit as NoiseLambdaText str2num(get(hObject,String) returns contents of Lambda2AlgEdit as a doublehandles=guidata(hObject);set(hObject,Value,str2num(get(hObject,String); set value property equal to string numerical value propertyguidata(hObject,handles); - Executes during object creation, after se
39、tting all properties.function Lambda2AlgEdit_CreateF(hObject, eventdata, handles) hObject handle to Lambda2AlgEdit (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles empty - handles not created until after all CreateFs called Hint: edit controls usually have a white
40、background on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);endfunction NAlgEdit_Callback(hObject, eventdata, handles) hObject handle to NAlgEdit (see GCBO) eventdata reserved - to be defined in a
41、 future version of MATLAB handles structure with handles and user data (see GUIDATA) Hints: get(hObject,String) returns contents of NAlgEdit as NoiseLambdaText str2num(get(hObject,String) returns contents of NAlgEdit as a doublehandles=guidata(hObject);set(hObject,Value,round(str2num(get(hObject,Str
42、ing); set value property equal to string numerical value propertyguidata(hObject,handles); - Executes during object creation, after setting all properties.function NAlgEdit_CreateF(hObject, eventdata, handles) hObject handle to NAlgEdit (see GCBO) eventdata reserved - to be defined in a future versi
43、on of MATLAB handles empty - handles not created until after all CreateFs called Hint: edit controls usually have a white background on Windows. See ISPC and PUTER.if ispc & isequal(get(hObject,BackgroundColor), get(0,defaultUicontrolBackgroundColor) set(hObject,BackgroundColor,white);end - Executes
44、 on button press in SegmentOn.function SegmentOn_Callback(hObject, eventdata, handles) hObject handle to SegmentOn (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA) Hint: get(hObject,Value) returns toggle state of SegmentOn - Executes on button press in EnergyOn.function EnergyOn_Callback(hObject, eventdata, handles) hObject handle to EnergyOn (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with