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

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

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

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

    [LV.1]初来乍到

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

    EDA365欢迎您登录!

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

    x

    $ [" I. A& n4 m( o) Q2 l6 |一、源代码0 l8 m; _9 E8 Q5 f
    • 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
    • 8 w5 t  u0 F& ?6 |( Z# [
    • % Edit the above text to modify the response to help CT_image_FCM

    • 5 w/ b4 P, Q4 n, W
    • % Last Modified by GUIDE v2.5 17-Apr-2020 00:06:23
    • 6 r& F  r  Q! \: b9 A" p2 T
    • % 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
    • 2 k5 I" P6 G  K& D& B. _
    • if nargout
    •     [varargout{1:nargout}] = gui_maiNFCn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT
    • 0 _3 ?) x1 b3 ]2 d

    • 5 Y. B, ^7 D7 q5 }
    • % --- 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)

    • 0 a: C$ e7 G6 O/ w
    • % Choose default command line output for CT_image_FCM
    • handles.output = hObject;
    • + E) O/ I  S/ D2 e3 d3 a: _
    • % Update handles structure
    • guidata(hObject, handles);

    • 1 _! E# D/ c$ ?! E; Z
    • % UIWAIT makes CT_image_FCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);
    • ; [! n8 S9 y$ B  J7 N/ Z# S; a6 }- x

    • . O# e1 W% J$ f
    • % --- 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)

    • ; N& o" k% Y# p  v  b
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;

    • $ `* r6 G9 |& U5 w+ M9 l- s
    • ; @( @8 q0 l& _
    • % --- 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('原图');
    • 3 \( v! E4 J2 i; G+ {9 k" t% f
    • % --- 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)

    • . D' R! B+ t) w* n7 N; J

    • + Z6 D: G  J4 N- M) D0 H! J3 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 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);
    • ( j' |: p& d7 ?. y7 n+ w

    • 1 d9 x" G3 e% d
    • % --- 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);

    • ) F# R7 O) R$ O! n

    • / e" e$ k1 Z' k8 h9 b: {
    • % --- 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);
    • : |4 D' L* y/ z6 @& B6 P
    • 2 ~3 I6 d( R, W4 \( O* ^" {6 ]
    • % --- 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);! l8 _! n3 |$ k$ N) g5 V8 R
                           . r* w- L! D  `$ \9 ?( h2 J" W
    % ~1 R* `# f1 C) d1 D( u- `- L0 M; `4 C

    & T1 [  \+ O' Q/ Y% B% c
    • 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
    • / S, s4 a1 K/ r% m. t  _
    • % Edit the above text to modify the response to help CT_image_GFCM

    • 4 h$ k5 c$ ~, c! y( [# o& t6 B
    • % Last Modified by GUIDE v2.5 13-Apr-2020 21:47:11
    • 1 ~( Q8 s# |- k6 x
    • % 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

    • , z2 N& k; Z- E$ ~5 E0 H: Y. H
    • if nargout
    •     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT
    •   Y4 _2 g6 I9 Y$ G5 Y

    • 0 k1 y$ _- o# W1 k; T1 J) M0 M
    • % --- 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)
    • 4 D2 [, s! H2 t5 j; h- S
    • % Choose default command line output for CT_image_GFCM
    • handles.output = hObject;

    •   o8 j6 w, `7 W2 C6 x: x* j6 A
    • % Update handles structure
    • guidata(hObject, handles);
    • - z$ m' m' A% _6 O! O% W$ \4 R
    • % UIWAIT makes CT_image_GFCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);
    • ) L7 K6 w0 r- l+ Q9 d' E
    • 7 o3 w7 k" ^* G/ J& u  o. a
    • % --- 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 j7 I9 L  }' s4 |
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;
    • + c! t1 R9 V- y: `; R9 q' q; v
    • - ~$ }+ ?; e: o" e
    • % --- 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('原图');
    • " U( F1 M$ o( T, k- H9 n
    • % --- 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)

    • ) _# Y. f  i, {( C0 H; L; S8 {9 `

    • * V: z1 q/ U; H* U* s6 ]
    • % --- 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);
    • ) x9 S2 I/ u: v4 l
    • 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)
    • 3 O( @) D. e+ w( H4 J) p' K
    • % --- 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)

    •   N$ z! ^7 {" o; E1 g" H  @
    • % --- 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)

    • % [# M+ L& Q6 n- p) [3 Q
    • % --- 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)# }8 |5 p  w) s' Y/ r3 ^+ C" K
                         
    5 t5 e* W5 k$ d! F! _8 b
    + l; C, K/ g. {* ^) c  g. b* {( \6 o$ o7 Y6 V$ V( ~" ^
    二、运行结果
    " y9 z- O3 ^6 S0 ?8 @9 v: M4 m* m5 z  b' z) }# S
    3 j/ x2 B+ O+ l& _
    8 e% Y$ x- \+ P: I% b8 Z. }
      Y$ ]2 ?/ H" s  b7 G

    该用户从未签到

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

    该用户从未签到

    3#
    发表于 2021-4-25 17:05 | 只看该作者
    收藏到源代码库
    / r4 {- ?8 C5 w* X
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-6-13 00:49 , Processed in 0.093750 second(s), 26 queries , Gzip On.

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

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

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