【图像分割】基于模糊聚类FCM和改进的模糊聚类算法实现CT图像分割matlab代码

295 阅读4分钟

1 简介

医学影像分割的基本目标是将图像分割成不同的解剖组织,从而可以从背景中提取出感兴趣区域。因为图像的低分辨率和弱对比度,实现医学影像分割是一件具有挑战的任务。而且,这个任务由于噪声和伪阴影变得更加困难,这些干扰项可能是因器材限制、重建算法和患者移动等原因造成的。目前还没有通用的医学图像分割算法,算法的优点和缺点经常根据所研究的问题而变化。将分割概念具体到颅内出血 CT 图像上,就是将颅腔中的出血病灶区别于其他组织从图像中分割出来。图像分割有两大类方法 :一种是像素分类,另一种为追踪变化的边界。第一类分割方法假设在每个子类中像素具有几乎恒定的灰度值,这对于具有相似生理特性的解剖结构来说是合理的。这类方法可以同时检测出多个感兴趣的子类,但是该方法很容易受到环境噪声和图像不均匀性的影响。相比之下,追踪变化边界的分割方法要利用图像灰度信息和空间信息。因此,该子类必须是均匀的并且包围在一个特定的变化边界中。当应用于医学图像分割时,由于固有的噪声和伪阴影,它们都不具有普遍的适用性。

本文针对人脑CT图像的出血病灶区域,提出了一种改进的模糊C-均值(Fuzzy C-Means,FCM)算法进行颅脑内出血病灶的分割.首先对颅脑CT图像进行预分割,通过左右扫描算法和中值滤波算法将颅内结构从源CT图像中提取出来;然后对预分割而得到的颅内结构,利用在目标函数和隶属度函数中分别添加空间信息的改进FCM聚类算法进行出血病灶提取.通过对CT颅脑图像和添加椒盐噪声的CT颅脑图像进行病灶分割,结果显示本文算法对噪声不敏感,可以准确分割出出血病灶.

2 部分代码

function varargout = CT_image_KFCM(varargin)
% CT_IMAGE_KFCM MATLAB code for CT_image_KFCM.fig
%     CT_IMAGE_KFCM, by itself, creates a new CT_IMAGE_KFCM or raises the existing
%     singleton*.
%
%     H = CT_IMAGE_KFCM returns the handle to a new CT_IMAGE_KFCM or the handle to
%     the existing singleton*.
%
%     CT_IMAGE_KFCM('CALLBACK',hObject,eventData,handles,...) calls the local
%     function named CALLBACK in CT_IMAGE_KFCM.M with the given input arguments.
%
%     CT_IMAGE_KFCM('Property','Value',...) creates a new CT_IMAGE_KFCM or raises the
%     existing singleton*. Starting from the left, property value pairs are
%     applied to the GUI before CT_image_KFCM_OpeningFcn gets called. An
%     unrecognized property name or invalid value makes property application
%     stop. All inputs are passed to CT_image_KFCM_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 CT_image_KFCM

% Last Modified by GUIDE v2.5 14-Apr-2020 22:56:58

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                  'gui_Singleton',  gui_Singleton, ...
                  'gui_OpeningFcn', @CT_image_KFCM_OpeningFcn, ...
                  'gui_OutputFcn',  @CT_image_KFCM_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 CT_image_KFCM is made visible.
function CT_image_KFCM_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 CT_image_KFCM (see VARARGIN)

% Choose default command line output for CT_image_KFCM
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes CT_image_KFCM wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = CT_image_KFCM_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 I
[filename, pathname]= ...
   uigetfile({'*.*';'*.bmp';'*.tif';'*.png';'*.jpg'},'select picture');
str= [pathname filename];
I= imread(str);
axes(handles.axes1);
imshow(I);
title('原图');

% --- 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)



% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject   handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles   structure with handles and user data (see GUIDATA)
global I
cluster_n =4;                               %聚类数目
m=2;                                        %隶属度权重参数m
iter_max=150;                               %最大迭代次数
e=1e-5;                                     %停止阈值条件
delta=10;                                   %高斯核的delta值 5~15

Vinit=KFCM_init(I,cluster_n);              %聚类中心初始化
I=KFCM_Img(I,Vinit,cluster_n,m,iter_max,e,delta);
axes(handles.axes3);
imshow(I,[]);

% --- 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)
global I
axes(handles.axes4);
imshow(I==2);

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% 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)
global I
axes(handles.axes5);
imshow(I==3);

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% 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)
global I
axes(handles.axes6);
imshow(I==4);

3 仿真结果

4 参考文献

[1]姜春雨, 刘景鑫, 钟慧湘,等. 基于改进的FCM模糊聚类的颅内出血CT图像分割研究[J]. 中国医疗设备, 2018, 33(6):5.

**部分理论引用网络文献,若有侵权联系博主删除。**

5 MATLAB代码与数据下载地址

见博客主页