function varargout = MRI002(varargin)
% MRI002 MATLAB code for MRI002.fig
% MRI002, by itself, creates a new MRI002 or raises the existing
% singleton*.
%
% H = MRI002 returns the handle to a new MRI002 or the handle to
% the existing singleton*.
%
% MRI002('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MRI002.M with the given input arguments.
%
% MRI002('Property','Value',...) creates a new MRI002 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before MRI002_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to MRI002_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help MRI002
% Last Modified by GUIDE v2.5 22-Apr-2022 16:33:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @MRI002_OpeningFcn, ...
'gui_OutputFcn', @MRI002_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before MRI002 is made visible.
function MRI002_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 MRI002 (see VARARGIN)
% Choose default command line output for MRI002
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes MRI002 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = MRI002_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
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- 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)
global s %定义全局变量,为了后面的还原保存数据
[filename,pathname,filterindex]=...
uigetfile({'*.*';'*.bmp';'*.tif';'*.png';'*.jpg';'*.jpeg'},'select picture'); %选择图片路径
str=[pathname filename]; %合成路径+文件名
s=str;
handles.filebig=filterindex;
if filterindex==0
msgbox('选择图像失败!','error');
return
else
im=imread(str); %读取图片
end
axes(handles.axes5); %使用第一个axes
imshow(im); %显示图片
handles.img=im;
guidata(hObject,handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.img==0
msgbox('没有可保存的图像!','error');
return;
else
[filename,pathname,filterindex]=...
uiputfile({'*.bmp';'*.tif';'*.png';'*.jpg';'*.jpeg'},'save picture');%存储图片路径
end
if filterindex==0
return %如果取消操作,返回
else
str=[pathname filename]; %合成路径+文件名
axes(handles.axes2); %使用第二个axes
imwrite(handles.img,str); %写入图片信息,即保存图片
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc
clear
close(gcf)
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.pushbutton9,'visible','off');
set(handles.pushbutton1,'visible','on');
set(handles.pushbutton4,'visible','on');
set(handles.pushbutton5,'visible','on');
set(handles.pushbutton6,'visible','on');
set(handles.pushbutton7,'visible','on');
set(handles.pushbutton8,'visible','on');
set(handles.axes2,'visible','off');
set(handles.axes4,'visible','off');
set(handles.axes5,'visible','on');
set(handles.text2,'visible','off');
set(handles.pushbutton9,'visible','off');
set(handles.pushbutton11,'visible','off');
set(handles.pushbutton12,'visible','off');
set(handles.pushbutton13,'visible','off');
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.pushbutton4,'visible','on');
set(handles.pushbutton9,'visible','on');
set(handles.axes2,'visible','off');
set(handles.axes4,'visible','off');
set(handles.axes5,'visible','on');
set(handles.pushbutton1,'visible','on');
set(handles.pushbutton5,'visible','off');
set(handles.pushbutton6,'visible','off');
set(handles.pushbutton7,'visible','off');
set(handles.pushbutton8,'visible','off');
set(handles.pushbutton10,'visible','off');
set(handles.pushbutton11,'visible','off');
set(handles.pushbutton12,'visible','off');
set(handles.pushbutton13,'visible','off');
set(handles.pushbutton2,'visible','on');
set(handles.text2,'visible','off');
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.pushbutton10,'visible','on');
set(handles.pushbutton1,'visible','on');
set(handles.pushbutton2,'visible','on');
set(handles.pushbutton4,'visible','on');
set(handles.pushbutton5,'visible','off');
set(handles.pushbutton6,'visible','off');
set(handles.pushbutton7,'visible','off');
set(handles.pushbutton8,'visible','off');
set(handles.pushbutton9,'visible','off');
set(handles.pushbutton11,'visible','on');
set(handles.pushbutton12,'visible','on');
set(handles.pushbutton13,'visible','off');
set(handles.axes4,'visible','off');
set(handles.axes5,'visible','on');
% --------------------------------------------------------------------
function Untitled_4_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.pushbutton13,'visible','on');
set(handles.pushbutton1,'visible','on');
set(handles.pushbutton2,'visible','on');
set(handles.pushbutton4,'visible','on');
set(handles.axes4,'visible','off');
set(handles.axes5,'visible','on');
set(handles.pushbutton5,'visible','off');
set(handles.pushbutton6,'visible','off');
set(handles.pushbutton7,'visible','off');
set(handles.pushbutton8,'visible','off');
set(handles.pushbutton10,'visible','off');
set(handles.pushbut
评论1