醫(yī)學(xué)圖像預(yù)處理程序_第1頁
醫(yī)學(xué)圖像預(yù)處理程序_第2頁
醫(yī)學(xué)圖像預(yù)處理程序_第3頁
醫(yī)學(xué)圖像預(yù)處理程序_第4頁
醫(yī)學(xué)圖像預(yù)處理程序_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、function varargout = tuxiangyuchuli(varargin)%TUXIANGYUCHULI M-file for tuxiangyuchuli.fig% TUXIANGYUCHULI, by itself, creates a new TUXIANGYUCHULI or raises the existing% singleton*.% H = TUXIANGYUCHULI returns the handle to a new TUXIANGYUCHULI or the handle to% the existing singleton*.% TUXIANGYU

2、CHULI('Property','Value',.) creates a new TUXIANGYUCHULI using the% given property value pairs. Unrecognized properties are passed via% varargin to tuxiangyuchuli_OpeningFcn. This calling syntax produces a% warning when there is an existing singleton*.% TUXIANGYUCHULI('CALLBACK&#

3、39;) and TUXIANGYUCHULI('CALLBACK',hObject,.) call the% local function named CALLBACK in TUXIANGYUCHULI.M with the given input% arguments.% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".% See also: GUIDE, GUIDATA, GUIHANDLES %

4、 Edit the above text to modify the response to help tuxiangyuchuli % Last Modified by GUIDE v2.5 07-Sep-2014 18:05:07 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', tux

5、iangyuchuli_OpeningFcn, . 'gui_OutputFcn', tuxiangyuchuli_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mai

6、nfcn(gui_State, varargin:);end% End initialization code - DO NOT EDIT % - Executes just before tuxiangyuchuli is made visible.function tuxiangyuchuli_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to

7、 be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin unrecognized PropertyName/PropertyValue pairs from the% command line (see VARARGIN) % Choose default command line output for tuxiangyuchulihandles.output = hObject; % Update handles struct

8、ureguidata(hObject, handles); % UIWAIT makes tuxiangyuchuli wait for user response (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = tuxiangyuchuli_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning o

9、utput 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 structurevarargout1 = handles.output; % - Executes during object creation

10、, after setting all properties.function axes1_CreateFcn(hObject, eventdata, handles)% hObject handle to axes1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: place code in OpeningFcn to popula

11、te axes1 % - Executes on mouse press over axes background.function axes1_ButtonDownFcn(hObject, eventdata, handles)% hObject handle to axes1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on mouse

12、press over axes background.function axes5_ButtonDownFcn(hObject, eventdata, handles)% hObject handle to axes5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function Untitled_1_Callback(hObject, eventdata, h

13、andles)% 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) % -function Untitled_2_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2 (see GCBO)% eventdata reserved - t

14、o be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -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 handl

15、es and user data (see GUIDATA) % -%顯示灰度圖像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)handles.img=getimage(handles.axes1)

16、;axes(handles.axes2);if isrgb(handles.img);y=rgb2gray(handles.img);imshow(y);else handles.img=getimage(handles.axes1); axes(handles.axes2); imshow(handles.img);end % -%顯示直方圖function Untitled_31_Callback(hObject, eventdata, handles)% hObject handle to Untitled_31 (see GCBO)% eventdata reserved - to b

17、e defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)handles.img=getimage(handles.axes2);axes(handles.axes3);imhist(handles.img); % -function Untitled_32_Callback(hObject, eventdata, handles)% hObject handle to Untitled_32 (see GCBO)% eventdata reserved

18、- to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function Untitled_21_Callback(hObject, eventdata, handles)% hObject handle to Untitled_21 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with

19、handles and user data (see GUIDATA) % -function Untitled_22_Callback(hObject, eventdata, handles)% hObject handle to Untitled_21 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function Untitled_23_Callback(h

20、Object, eventdata, handles)% hObject handle to Untitled_22 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -%打開文件function Untitled_11_Callback(hObject, eventdata, handles)% hObject handle to Untitled_11 (see G

21、CBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)%選取圖片路徑filename,pathname=uigetfile('*.*','選取圖片');%合成路徑+文件名str=pathname filename; %讀取圖片im=imread(str); %使用第一個(gè)axesaxes(handles.axes1); %顯示圖片imshow(im) % -fu

22、nction Untitled_12_Callback(hObject, eventdata, handles)% hObject handle to Untitled_12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -%關(guān)閉程序function Untitled_13_Callback(hObject, eventdata, handles)% hObject

23、 handle to Untitled_13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)clc;close all;close(gcf); % -function Untitled_231_Callback(hObject, eventdata, handles)% hObject handle to Untitled_211 (see GCBO)% eventdat

24、a reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function Untitled_232_Callback(hObject, eventdata, handles)% hObject handle to Untitled_212 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles st

25、ructure with handles and user data (see GUIDATA) % -function Untitled_221_Callback(hObject, eventdata, handles)% hObject handle to Untitled_211 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -function Untitle

26、d_222_Callback(hObject, eventdata, handles)% hObject handle to Untitled_212 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -%上下翻轉(zhuǎn)function Untitled_211_Callback(hObject, eventdata, handles)% hObject handle to

27、Untitled_211 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)x=getimage(handles.axes1);axes(handles.axes4);if isrgb(x) for k=1:3 y(:,:,k)=flipud(x(:,:,k);%上下翻轉(zhuǎn)函數(shù)endimshow(y);else y=flipud(x); imshow(y);end% -%左右翻

28、轉(zhuǎn)function Untitled_212_Callback(hObject, eventdata, handles)% hObject handle to Untitled_212 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)x=getimage(handles.axes1);axes(handles.axes4);if isrgb(x) for k=1:3 y(:

29、,:,k)=fliplr(x(:,:,k);%左右翻轉(zhuǎn)函數(shù)endimshow(y);else y=flipud(x); imshow(y);end % -%任意角度旋轉(zhuǎn)function Untitled_213_Callback(hObject, eventdata, handles)% hObject handle to Untitled_213 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (

30、see GUIDATA)a=getimage(handles.axes1);axes(handles.axes4);prompt='輸入?yún)?shù)1:'defans='30'p=inputdlg(prompt,'輸入?yún)?shù)',1,defans);p1=str2num(p1);y=imrotate(a,p1); imshow(y);% -%顯示處理前圖像頻譜function Untitled_321_Callback(hObject, eventdata, handles)% hObject handle to Untitled_321 (see GCBO

31、)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)x=getimage(handles.axes2);axes(handles.axes5);if isrgb(x) m=fft2(x(:,:,1); y=fftshift(m); imshow(log(abs(y),);else m=fft2(x); y=fftshift(m); imshow(log(abs(y),);end % -%顯示處理

32、后圖像頻譜function Untitled_322_Callback(hObject, eventdata, handles)% hObject handle to Untitled_322 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(handles.axes4);axes(handles.axes6);if isrgb(a);x=rgb2gra

33、y(a);else x=getimage(handles.axes4); axes(handles.axes6);endif isrgb(x) m=fft2(x(:,:,1); y=fftshift(m); imshow(log(abs(y),);else m=fft2(x); y=fftshift(m); imshow(log(abs(y),);end % -%鄰近的兩點(diǎn)插值縮小function Untitled_2221_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2221 (see GCBO)% ev

34、entdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(handles.axes1);axes(handles.axes4);%鄰近插值放大prompt='輸入放大倍數(shù):'defans='0.2'p=inputdlg(prompt,'輸入放大倍數(shù)',1,defans);p1=str2num(p1);y=imresize(a,p1,'

35、nearest'); %鄰近的兩點(diǎn)插值縮小imshow(y); % -%線性插值縮小function Untitled_2222_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2222 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(handles.axes1

36、);axes(handles.axes4);%鄰近插值放大prompt='輸入放大倍數(shù):'defans='0.2'p=inputdlg(prompt,'輸入放大倍數(shù)',1,defans);p1=str2num(p1);y=imresize(a,p1,'bilinear'); %線性插值縮小imshow(y); % -%三次樣條插值縮小function Untitled_2223_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2223 (see G

37、CBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(handles.axes1);axes(handles.axes4);%鄰近插值放大prompt='輸入放大倍數(shù):'defans='0.2'p=inputdlg(prompt,'輸入放大倍數(shù)',1,defans);p1=str2num(p1);y=imresize(a,

38、p1,'bicubic'); %三次樣條插值放大imshow(y); % -%鄰近的兩點(diǎn)插值放大function Untitled_2211_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2211 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(han

39、dles.axes1);axes(handles.axes4);%鄰近插值放大prompt='輸入放大倍數(shù):'defans='2'p=inputdlg(prompt,'輸入放大倍數(shù)',1,defans);p1=str2num(p1);y=imresize(a,p1,'nearest'); %最近鄰插值法放大imshow(y);% -%線性插值放大function Untitled_2212_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2212

40、(see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(handles.axes1);axes(handles.axes4);%鄰近插值放大prompt='輸入放大倍數(shù):'defans='2'p=inputdlg(prompt,'輸入放大倍數(shù)',1,defans);p1=str2num(p1);y=imresiz

41、e(a,p1,'bilinear'); %線性插值放大imshow(y); % -%三次樣條插值放大function Untitled_2213_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2213 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)a=getimage(h

42、andles.axes1);axes(handles.axes4);%鄰近插值放大prompt='輸入放大倍數(shù):'defans='2'p=inputdlg(prompt,'輸入放大倍數(shù)',1,defans);p1=str2num(p1);y=imresize(a,p1,'bicubic'); %三次樣條插值放大imshow(y); % -%保存灰度圖像function Untitled_121_Callback(hObject, eventdata, handles)% hObject handle to Untitled_121 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)f,p=uiputfile('*.jpg','保存文件');str=strcat(p,f);pix=getframe(handles.axes2);imwrite(pix.cdata,str,'jpg'); % -%保存直方圖function Untitled_122_Ca

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論