【細胞分割】基於matlab GUI形態學演算法紅細胞計數【含Matlab原始碼 638期】
一、簡介
很多臨床病症表現為白細胞數目增多、腫大或者白細胞中細胞核形狀與數目發生變化,所以對白細胞數目和形狀的研究有著重要意義。但是由於染色條件、塗片製備、影象來源、取樣光照條件的差異以及細胞間相互重疊、粘連情況的發生,使得對白細胞的計數和識別等後續分析變得困難。為此,將粘連細胞分割成為單個細胞,就成為醫學影象處理中必須解決的問題。本文基於MATLAB語言進行影象的處理以及分割,準確的處理圖片,採用分水嶺演算法和閾值分割來實現,在現有研究基礎之上,重點基於數字影象處理技術解決顯微影象細胞計數這一思路,結合血液紅細胞的主要特點,設定所要達到的目標和要求,設計和實現一個快速有效的血液顯微影象紅細胞數量自動統計系統。
1 課程設計任務
細胞數目檢測在現實生活中的意義主要體現在醫學上的作用,可通過細胞數目的檢測來檢視並估計病人或動物的血液中細胞數,如估測血液中紅細胞、白細胞、血小板、淋巴細胞等細胞的數目,同時也可檢測癌細胞的數目來檢視醫療效果,根據這一系列的指標來對病人或動物進行治療。
(1)對細胞影象進行預處理;
(2)進行影象分割;
(3)統計細胞數目;
(4)要求自行設計方案,編寫程式碼實現上述功能,並設計細胞統計的軟體介面。
2 設計原理
影象分割是根據醫學影象的某個可以處理的特性(如光學密度值、灰度值、CT值、頻譜等),利用醫學影象區域內的相似性和區域間的差異性將醫學影象分割成若干個互不連通區域的過程。
將影象表示為物理上有意義的連通區域的集合,也就是根據目標與背景的先驗知識,對影象中的目標、背景進行標記、定位,然後將目標從背景或其他偽目標中分離出來。由於這些被分割的區域在某些特性上相近,因而,影象分割常用於模式識別與影象理解以及影象壓縮與編碼兩大類不同的應用目的。
3 設計流程
流程:首先將影象依次轉化為灰度影象,二值影象。然後對二值影象進行中值濾波,並刪除小面積物件(刪除白色底面裡面的黑色小點)。 其次,將影象反相,並刪除小面積物件(相當於刪除了二值影象裡面黑色底面的白色小點)。 再次,對影象進行形態學運算處理。最後,標記紅細胞,用貼標籤的方法統計紅細胞數目,目標實現。
二、原始碼
function varargout = untitled(varargin) % UNTITLED M-file for untitled.fig % UNTITLED, by itself, creates a new UNTITLED or raises the existing % singleton*. % % H = UNTITLED returns the handle to a new UNTITLED or the handle to % the existing singleton*. % % UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in UNTITLED.M with the given input arguments. % % UNTITLED('Property','Value',...) creates a new UNTITLED or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before untitled_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to untitled_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 untitled % Last Modified by GUIDE v2.5 02-Dec-2015 08:59:09 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @untitled_OpeningFcn, ... 'gui_OutputFcn', @untitled_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 untitled is made visible. function untitled_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 untitled (see VARARGIN) % Choose default command line output for untitled handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes untitled wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = untitled_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) axes(handles.axes1); I=imread('blood.BMP'); imshow(I); % 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) % --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) axes(handles.axes2); I=imread('blood.BMP'); imshow(I); gg=im2bw(I); imshow(gg) % 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) % --- Executes on button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) axes(handles.axes2); I=imread('blood.BMP'); imshow(I); gg=im2bw(I); imshow(gg) J=medfilt2(gg,[3 3]); imshow(J); % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) axes(handles.axes2); I=imread('blood.BMP'); imshow(I); gg=im2bw(I); imshow(gg) J=medfilt2(gg,[3 3]); imshow(J); M=gg|J; imshow(M); % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) axes(handles.axes2); I=imread('blood.BMP'); imshow(I); gg=im2bw(I); imshow(gg) J=medfilt2(gg,[3 3]); imshow(J); M=gg|J; imshow(M); R=~M; imshow(R) % hObject handle to pushbutton7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton8. function pushbutton8_Callback(hObject, eventdata, handles) axes(handles.axes2); I=imread('blood.BMP'); imshow(I); gg=im2bw(I); imshow(gg) J=medfilt2(gg,[3 3]); imshow(J); M=gg|J; imshow(M); R=~M; imshow(R) F=bwfill(R,'holes'); imshow(F);
三、執行結果
四、備註
版本:2014a
完整程式碼或代寫加1564658423