找回密码
 注册
关于网站域名变更的通知
查看: 262|回复: 2
打印 上一主题 下一主题

基于matlab FCM和改进的FCM脑部CT图像聚类

[复制链接]
  • TA的每日心情

    2019-11-20 15:22
  • 签到天数: 2 天

    [LV.1]初来乍到

    跳转到指定楼层
    1#
    发表于 2021-4-22 13:24 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

    EDA365欢迎您登录!

    您需要 登录 才可以下载或查看,没有帐号?注册

    x

    8 F; M2 x! I2 w' W" p& }一、源代码
    2 m2 ~' |5 [: t4 g) t' J1 n; f# k
    • function varargout = CT_image_FCM(varargin)
    • % CT_IMAGE_FCM MATLAB code for CT_image_FCM.fig
    • %      CT_IMAGE_FCM, by itself, creates a new CT_IMAGE_FCM or raises the existing
    • %      singleton*.
    • %
    • %      H = CT_IMAGE_FCM returns the handle to a new CT_IMAGE_FCM or the handle to
    • %      the existing singleton*.
    • %
    • %      CT_IMAGE_FCM('CALLBACK',hObject,eventData,handles,...) calls the local
    • %      function named CALLBACK in CT_IMAGE_FCM.M with the given input arguments.
    • %
    • %      CT_IMAGE_FCM('Property','Value',...) creates a new CT_IMAGE_FCM or raises the
    • %      existing singleton*.  Starting from the left, property value pairs are
    • %      applied to the GUI before CT_image_FCM_OpeningFcn gets called.  An
    • %      unrecognized property name or invalid value makes property application
    • %      stop.  All inputs are passed to CT_image_FCM_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

    • 3 y$ x1 a- v: I( O2 O
    • % Edit the above text to modify the response to help CT_image_FCM
    • 8 t/ \2 V+ M+ h3 w1 V: ~
    • % Last Modified by GUIDE v2.5 17-Apr-2020 00:06:23
    • 7 R8 P* z. l, J/ w! b3 k# ]
    • % Begin initialization code - DO NOT EDIT
    • gui_Singleton = 1;
    • gui_State = struct('gui_Name',       mfilename, ...
    •                    'gui_Singleton',  gui_Singleton, ...
    •                    'gui_OpeningFcn', @CT_image_FCM_OpeningFcn, ...
    •                    'gui_OutputFcn',  @CT_image_FCM_OutputFcn, ...
    •                    'gui_LayoutFcn',  [] , ...
    •                    'gui_Callback',   []);
    • if nargin && ischar(varargin{1})
    •     gui_State.gui_Callback = str2func(varargin{1});
    • end

    • 0 Z, Y3 @4 M  ]  b& c- U3 R4 G+ {
    • if nargout
    •     [varargout{1:nargout}] = gui_maiNFCn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT

    •   Q! @" [6 S0 o2 F
    • 1 j* H  U( ~& y' f" C- H# K+ y
    • % --- Executes just before CT_image_FCM is made visible.
    • function CT_image_FCM_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_FCM (see VARARGIN)

    • # q8 y( p& P3 U+ k
    • % Choose default command line output for CT_image_FCM
    • handles.output = hObject;
    • + u9 j6 Q) u! h2 G0 X, x
    • % Update handles structure
    • guidata(hObject, handles);
    • $ z7 J( k4 a' t. E
    • % UIWAIT makes CT_image_FCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);

    • . Q8 ~+ K, m, I; u' k

    • , j8 {' a  ?. e) }2 K
    • % --- Outputs from this function are returned to the command line.
    • function varargout = CT_image_FCM_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)

    • 2 F. p6 E6 a0 f' Y! Z: g
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;
    • ! g. d: q7 ?* T

    • 9 h5 Z, Q0 \" R8 e" b% p
    • % --- 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('原图');

    • ' e, r7 }4 M$ I/ r/ Q
    • % --- 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)

    • ; a6 p  o* |; n# I8 g
    •   |# o8 g9 {7 l! Y5 B8 S9 p
    • % --- 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 I0 A
    • [I2,clusterResult] = FCM1(I, 4,[0 80 160 255],2,150,1e-5);
    • axes(handles.axes3);
    • imshow(I2)
    • I0=I2;
    • A=unique(I0);
    • 9 O) s) F7 A- @4 u. C) R

    • : M. w$ E( ]2 t1 C+ A1 U
    • % --- 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 I0 A
    • I0_2=zeros(size(I0,1),size(I0,2));
    • for i=1:size(I0,1)
    •      for j=1:size(I0,2)
    •          if I0(i,j)==A(2)
    •              I0_2(i,j)=255;
    •          else I0_2(i,j)=0;
    •          end
    •      end
    • end
    • I0_2=uint8(I0_2);
    • axes(handles.axes4);
    • imshow(I0_2);

    • / Q" R; X0 u  q

    • % p$ q5 N$ }$ M
    • % --- 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 I0 A
    • I0_3=zeros(size(I0,1),size(I0,2));
    • for i=1:size(I0,1)
    •      for j=1:size(I0,2)
    •          if I0(i,j)==A(3)
    •              I0_3(i,j)=255;
    •          else I0_3(i,j)=0;
    •          end
    •      end
    • end
    • I0_3=uint8(I0_3);
    • axes(handles.axes5);
    • imshow(I0_3);
    • 5 E; o# Q& [& _9 d8 d, S

    • 0 F( F6 D: r: C
    • % --- 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 I0 A
    • I0_4=zeros(size(I0,1),size(I0,2));
    • for i=1:size(I0,1)
    •      for j=1:size(I0,2)
    •          if I0(i,j)==A(4)
    •              I0_4(i,j)=255;
    •          else I0_4(i,j)=0;
    •          end
    •      end
    • end
    • I0_4=uint8(I0_4);
    • axes(handles.axes6);
    • imshow(I0_4);$ l& d, d* [6 L' O" g; Z3 S
                           
    & J' b) p: D$ O+ h+ u6 X6 W! x' m* d
    % @7 U. G: Z2 F/ R5 l7 |; f6 C+ V) S
    • function varargout = CT_image_GFCM(varargin)
    • % CT_IMAGE_GFCM MATLAB code for CT_image_GFCM.fig
    • %      CT_IMAGE_GFCM, by itself, creates a new CT_IMAGE_GFCM or raises the existing
    • %      singleton*.
    • %
    • %      H = CT_IMAGE_GFCM returns the handle to a new CT_IMAGE_GFCM or the handle to
    • %      the existing singleton*.
    • %
    • %      CT_IMAGE_GFCM('CALLBACK',hObject,eventData,handles,...) calls the local
    • %      function named CALLBACK in CT_IMAGE_GFCM.M with the given input arguments.
    • %
    • %      CT_IMAGE_GFCM('Property','Value',...) creates a new CT_IMAGE_GFCM or raises the
    • %      existing singleton*.  Starting from the left, property value pairs are
    • %      applied to the GUI before CT_image_GFCM_OpeningFcn gets called.  An
    • %      unrecognized property name or invalid value makes property application
    • %      stop.  All inputs are passed to CT_image_GFCM_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
    • 9 r+ b4 l" C; ^6 S3 {
    • % Edit the above text to modify the response to help CT_image_GFCM

    • 9 k" G6 u# G8 i- c$ W
    • % Last Modified by GUIDE v2.5 13-Apr-2020 21:47:11
    • 8 A( |; _/ C6 e# ?
    • % Begin initialization code - DO NOT EDIT
    • gui_Singleton = 1;
    • gui_State = struct('gui_Name',       mfilename, ...
    •                    'gui_Singleton',  gui_Singleton, ...
    •                    'gui_OpeningFcn', @CT_image_GFCM_OpeningFcn, ...
    •                    'gui_OutputFcn',  @CT_image_GFCM_OutputFcn, ...
    •                    'gui_LayoutFcn',  [] , ...
    •                    'gui_Callback',   []);
    • if nargin && ischar(varargin{1})
    •     gui_State.gui_Callback = str2func(varargin{1});
    • end
    • , g- S& `8 c" {2 x
    • if nargout
    •     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT
    • . K' f4 I% d3 r* |3 w: Z

    • 1 `5 c# {( y& }& P+ S
    • % --- Executes just before CT_image_GFCM is made visible.
    • function CT_image_GFCM_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_GFCM (see VARARGIN)
    • # [& d- I7 `$ L
    • % Choose default command line output for CT_image_GFCM
    • handles.output = hObject;

    • - Q) z  T8 a$ M  ?* ?: l' m7 m
    • % Update handles structure
    • guidata(hObject, handles);

    • 2 |; I' I; v  C$ j. q
    • % UIWAIT makes CT_image_GFCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);

    • ! E* A  b; u. m; b/ M% }
    • 0 {0 e+ i: y& R
    • % --- Outputs from this function are returned to the command line.
    • function varargout = CT_image_GFCM_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)

    • 5 i0 m8 I4 P' O3 V3 T" S
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;
    • # M3 h- w7 M  ]( R/ G
    • 4 d! o+ a2 @1 g9 U; u
    • % --- 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('原图');
    • ; P3 T! u2 Y9 P' }% u* P9 X1 y
    • % --- 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)
    • global I
    • I=medfilt2(I,[3,3]);
    • axes(handles.axes2);
    • imshow(I)
    • # i+ L4 x+ F9 H9 x4 U$ \
    • ' d" Q; H  h% j2 b) M1 Y- ^( R
    • % --- 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 r c U
    • [r,c] = size(I);
    • data = zeros(r*c,1);
    • for i = 1:r
    •     for j = 1:c
    •         data((i-1)*c+j,1) = double(I(i,j));
    •     end
    • end
    • [center, U, obj_fcn] = GFCM(data,4,0.9);

    • , I. c7 @" Q4 I% e9 J6 G
    • for i = 1 : r
    •     for j = 1 : c
    •         temp = (double(I(i, j)) - center) .^ 2;
    •         [fmin pos] = min(temp);
    •         I(i, j) = uint8(pos * 255 / 4);
    •     end
    • end
    • axes(handles.axes3);
    • imshow(I)
    • ) n! U6 k1 T( i; o" ^0 O
    • % --- 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 r c U
    • I_seg2 = I*0;
    • for i = 1:r
    •     for j = 1:c
    •         if U(1,(i-1)*c+j)<U(2,(i-1)*c+j)
    •             I_seg2(i,j) =0 ;
    •         else
    •             I_seg2(i,j) =255;
    •         end
    •     end
    • end
    • axes(handles.axes4);
    • imshow(I_seg2)

    • 5 N0 E& X/ h: Q/ ~; D( G3 c6 q- E
    • % --- 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 r c U
    • I_seg3 = I*0;
    • for i = 1:r
    •     for j = 1:c
    •         if U(1,(i-1)*c+j)<U(3,(i-1)*c+j)
    •             I_seg3(i,j) =0 ;
    •         else
    •             I_seg3(i,j) =255;
    •         end
    •     end
    • end
    • axes(handles.axes5);
    • imshow(I_seg3)

    • & j3 t  X3 C4 b) {, w
    • % --- 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 r c U
    • I_seg4 = I*0;
    • for i = 1:r
    •     for j = 1:c
    •         if U(1,(i-1)*c+j)<U(4,(i-1)*c+j)
    •             I_seg4(i,j) =0 ;
    •         else
    •             I_seg4(i,j) =255;
    •         end
    •     end
    • end
    • axes(handles.axes6);
    • imshow(I_seg4)* y- r6 t6 t& ]6 }$ d# t
                         
    ) Q2 b8 P* q! v7 [
    1 u6 O& w: C5 Y  P! w. ^9 T4 X! v% ]7 D% s* a5 w1 G. s" M
    二、运行结果$ s* P4 P, T$ D) ?0 d% F& ^+ W, j* Z

    + A4 ~! j, J) m% ~ * O2 W/ \9 ?( u. S3 b

    $ Z7 z' s7 r, J: k0 f, T ' X4 T- G/ ~, y5 Y' M7 |8 X  R

    该用户从未签到

    2#
    发表于 2021-4-22 14:50 | 只看该作者
    基于matlab FCM和改进的FCM脑部CT图像聚类

    该用户从未签到

    3#
    发表于 2021-4-25 17:05 | 只看该作者
    收藏到源代码库
    ! j2 B% w( G# |4 \- {
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

    推荐内容上一条 /1 下一条

    EDA365公众号

    关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

    GMT+8, 2025-6-12 16:37 , Processed in 0.093750 second(s), 26 queries , Gzip On.

    深圳市墨知创新科技有限公司

    地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

    快速回复 返回顶部 返回列表