医学图像预处理程序.docx

上传人:b****6 文档编号:8229530 上传时间:2023-01-30 格式:DOCX 页数:12 大小:16.70KB
下载 相关 举报
医学图像预处理程序.docx_第1页
第1页 / 共12页
医学图像预处理程序.docx_第2页
第2页 / 共12页
医学图像预处理程序.docx_第3页
第3页 / 共12页
医学图像预处理程序.docx_第4页
第4页 / 共12页
医学图像预处理程序.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

医学图像预处理程序.docx

《医学图像预处理程序.docx》由会员分享,可在线阅读,更多相关《医学图像预处理程序.docx(12页珍藏版)》请在冰豆网上搜索。

医学图像预处理程序.docx

医学图像预处理程序

functionvarargout=tuxiangyuchuli(varargin)

%TUXIANGYUCHULIM-filefortuxiangyuchuli.fig

orraises

%TUXIANGYUCHULI,byitself,createsanewTUXIANGYUCHULItheexisting

%singleton*.

%

%H=TUXIANGYUCHULIreturnsthehandletoanewTUXIANGYUCHULIorthehandleto

%theexistingsingleton*.

%

anew

passedviasyntax

%TUXIANGYUCHULI('Property','Value',...)creates

TUXIANGYUCHULIusingthe

%givenpropertyvaluepairs.Unrecognizedpropertiesare%varargintotuxiangyuchuli_OpeningFcn.Thiscallingproducesa

%warningwhenthereisanexistingsingleton*.

%

and

thegiven

%TUXIANGYUCHULI('CALLBACK')TUXIANGYUCHULI('CALLBACK',hObject,...)callthe

%localfunctionnamedCALLBACKinTUXIANGYUCHULI.Mwithinput

%arguments.

%

%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone

%instancetorun(singleton)".

%

%Seealso:

GUIDE,GUIDATA,GUIHANDLES

%Edittheabovetexttomodifytheresponsetohelptuxiangyuchuli

%LastModifiedbyGUIDEv2.507-Sep-201418:

05:

07%Begininitializationcode-DONOTEDITgui_Singleton=1;

mfilename,...

gui_Singleton,...

@tuxiangyuchuli_OpeningFcn,

@tuxiangyuchuli_OutputFcn,

[],...

[]);

gui_State=struct('gui_Name',

'gui_Singleton''gui_OpeningFcn''gui_OutputFcn''gui_LayoutFcn''gui_Callback'ifnargin&&ischar(varargin{1})

gui_State.gui_Callback=str2func(varargin{1});

end

ifnargout

[varargout{1:

nargout}]=gui_mainfcn(gui_State,varargin{:

});else

gui_mainfcn(gui_State,varargin{:

});

end

%Endinitializationcode-DONOTEDIT

%---Executesjustbeforetuxiangyuchuliismadevisible.

functiontuxiangyuchuli_OpeningFcn(hObject,eventdata,varargin)

%Thisfunctionhasnooutputargs,seeOutputFcn.

%hObjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%vararginunrecognizedPropertyName/PropertyValuepairsfromthe

%commandline(seeVARARGIN)

%Choosedefaultcommandlineoutputfortuxiangyuchulihandles.output=hObject;

%Updatehandlesstructureguidata(hObject,handles);

%UIWAITmakestuxiangyuchuliwaitforuserresponse(seeUIRESUME)

%uiwait(handles.figure1);

%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=tuxiangyuchuli_OutputFcn(hObject,handles)

%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);

%hObjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;

%---Executesduringobjectcreation,aftersettingallproperties.functionaxes1_CreateFcn(hObject,eventdata,handles)

handles,

eventdata,

%hObjecthandletoaxes1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

called

%handlesempty-handlesnotcreateduntilafterallCreateFcns

%Hint:

placecodeinOpeningFcntopopulateaxes1

%---Executesonmousepressoveraxesbackground.functionaxes1_ButtonDownFcn(hObject,eventdata,handles)

%hObjecthandletoaxes1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%---Executesonmousepressoveraxesbackground.functionaxes5_ButtonDownFcn(hObject,eventdata,handles)

%hObjecthandletoaxes5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%functionUntitled_1_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%functionUntitled_2_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_2(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%

%显示灰度图像

functionUntitled_4_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)handles.img=getimage(handles.axes1);

axes(handles.axes2);

ifisrgb(handles.img);

y=rgb2gray(handles.img);

imshow(y);

else

handles.img=getimage(handles.axes1);

axes(handles.axes2);

imshow(handles.img);

end

%%显示直方图

functionUntitled_31_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_31(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)handles.img=getimage(handles.axes2);

axes(handles.axes3);imhist(handles.img);

%

functionUntitled_32_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_32(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%

functionUntitled_22_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_21(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%

functionUntitled_23_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_22(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%%打开文件

functionUntitled_11_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_11(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%选取图片路径

[filename,pathname]=uigetfile({'*.*'},'选取图片');%合成路径+文件名

str=[pathnamefilename];

%读取图片im=imread(str);

%使用第一个axesaxes(handles.axes1);

%显示图片imshow(im)

%

functionUntitled_12_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_12(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%关闭程序

functionUntitled_13_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_13(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)clc;

closeall;

close(gcf);

%functionUntitled_231_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_211(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%functionUntitled_232_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_212(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%functionUntitled_221_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_211(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%

%上下翻转

functionUntitled_211_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_211(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)x=getimage(handles.axes1);

axes(handles.axes4);

ifisrgb(x)

fork=1:

3

y(:

:

k)=flipud(x(:

:

k));%上下翻转函数

end

imshow(y);

else

y=flipud(x);

imshow(y);

end

%%左右翻转

functionUntitled_212_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_212(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)x=getimage(handles.axes1);

axes(handles.axes4);

ifisrgb(x)

fork=1:

3

y(:

:

k)=fliplr(x(:

:

k));%左右翻转函数

end

imshow(y);

else

y=flipud(x);

imshow(y);

end

%%任意角度旋转

functionUntitled_213_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_213(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)a=getimage(handles.axes1);

axes(handles.axes4);

prompt={'输入参数1:

'};defans={'30'};

p=inputdlg(prompt,'输入参数',1,defans);p1=str2num(p{1});

y=imrotate(a,p1);imshow(y);

%%显示处理前图像频谱

functionUntitled_321_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_321(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)x=getimage(handles.axes2);

axes(handles.axes5);

ifisrgb(x)

m=fft2(x(:

:

1));

y=fftshift(m);

imshow(log(abs(y)),[]);

else

m=fft2(x);

y=fftshift(m);

imshow(log(abs(y)),[]);

end

%%显示处理后图像频谱

functionUntitled_322_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_322(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)a=getimage(handles.axes4);

axes(handles.axes6);

ifisrgb(a);

x=rgb2gray(a);

else

x=getimage(handles.axes4);

axes(handles.axes6);

end

ifisrgb(x)m=fft2(x(:

:

1));y=fftshift(m);imshow(log(abs(y)),[]);

else

m=fft2(x);y=fftshift(m);imshow(log(abs(y)),[]);

end

%%邻近的两点插值缩小

functionUntitled_2221_Callback(hObject,eventdata,handles)

%hObjecthandletoUntitled_2221(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)a=getimage(handles.axes1);

axes(handles.axes4);

%邻近插值放大

prompt={'输入放大倍数:

'};

defans={'0.2'};

p=inputdlg(prompt,'输入放大倍数',1,defans);p1=str2num(p{1});

y=imresize(a,p1,'nearest');%邻近的两点插值缩小

imshow(y);

%%线性插值缩小

functionUntitled_2222_Callback(hObject,eventdata,handles)

%hObjecthandletoUnt

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1