唐 山 学 院 毕 业 设 计
附录
%主界面程序
function varargout = proj(varargin) % PROJ M-file for proj.fig
% PROJ, by itself, creates a new PROJ or raises the existing % singleton*.
% H = PROJ returns the handle to a new PROJ or the handle to % the existing singleton*.
% PROJ('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in PROJ.M with the given input arguments. % PROJ('Property','Value',...) creates a new PROJ or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before proj_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to proj_OpeningFcn via varargin.
% *See GUI Options on GUIDE's Tools menu. Choose \% instance to run (singleton)\
% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help proj % Last Modified by GUIDE v2.5 21-Sep-2005 21:51:00 % Begin initialization code - DO NOT EDIT gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @proj_OpeningFcn, ... 'gui_OutputFcn', @proj_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin & isstr(varargin{1})
gui_State.gui_Callback = str2func(varargin{1}); end if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else
16
唐 山 学 院 毕 业 设 计
gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT addpath(pwd)
% --- Executes just before proj is made visible.
function proj_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to proj (see VARARGIN) % Choose default command line output for proj handles.output = hObject; handles.OAname='PSO'; handles.MIname='MI'; handles.NumOfVar=0; % set(handles.axes1,'','off'); % axes(handles.axes1) % I1=0; % imshow(I1) % axes(handles.axes2) % I2=0; % imshow(I2) % axes(handles.axes3) % I3=0; % imshow(I3)
guidata(hObject, handles);
% UIWAIT makes proj wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = proj_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
17
唐 山 学 院 毕 业 设 计
% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output;
% --- Executes during object creation, after setting all properties. function popupmenu1_CreateFcn(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc
set(hObject,'BackgroundColor','white'); else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
% --- Executes on selection change in popupmenu1. function popupmenu1_Callback(hObject, eventdata, handles) % hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) popupmenu1string=get(handles.popupmenu1,'string'); popupmenu1value=get(handles.popupmenu1,'value');
popupmenu1context=get(handles.popupmenu1,{'value','string'}); vvv1=deblank(popupmenu1context{2}(popupmenu1context{1})); handles.OAname=vvv1{1}; guidata(hObject,handles);
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu1 % --- Executes during object creation, after setting all properties. function popupmenu2_CreateFcn(hObject, eventdata, handles) % 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 CreateFcns called % Hint: popupmenu controls usually have a white background on Windows.
18
唐 山 学 院 毕 业 设 计
% See ISPC and COMPUTER. if ispc
set(hObject,'BackgroundColor','white'); else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
% --- 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 with handles and user data (see GUIDATA) popupmenu2string=get(handles.popupmenu2,'string'); popupmenu2value=get(handles.popupmenu2,'value');
popupmenu2context=get(handles.popupmenu2,{'value','string'}); vvv2=deblank(popupmenu2context{2}(popupmenu2context{1})); handles.NumOfVar=NumOfVar; handles.MIname=vvv2{1}; guidata(hObject,handles);
% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 % --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc
set(hObject,'BackgroundColor','white'); else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO)
19
唐 山 学 院 毕 业 设 计
% 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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double % --- Executes during object creation, after setting all properties. function edit2_CreateFcn(hObject, eventdata, handles) % hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc
set(hObject,'BackgroundColor','white'); else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end
function edit2_Callback(hObject, eventdata, handles) % hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double % --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) clc
set(handles.text6,'string','Result Of Registration & MI Value'); axesIbox=get(handles.axes2,'box'); axesJbox=get(handles.axes3,'box');
if strcmp(axesIbox,'off') | strcmp(axesJbox,'off') errordlg('请选择配准图像','′错误') error('未选择配准图像')
20