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

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

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

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

    [LV.1]初来乍到

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

    EDA365欢迎您登录!

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

    x
    8 y2 I8 I* L9 H& B$ u2 E
    一、源代码
    0 D3 X& A& Y) y% T
    • 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
    • : Z. b& ]! P. m1 i7 G; A
    • % Edit the above text to modify the response to help CT_image_FCM

    • / F7 ]- k3 P8 o+ c0 T+ G* C
    • % Last Modified by GUIDE v2.5 17-Apr-2020 00:06:23
    • + A% j! W8 W' |& X1 d3 G5 `. n! e
    • % 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
    • ) N* O3 h) x* }6 ^$ l2 @$ S  m+ l
    • if nargout
    •     [varargout{1:nargout}] = gui_maiNFCn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT
    • ' [; n  d% T& f) c/ a/ |
    • 3 I2 X$ q$ j5 ^( Q
    • % --- 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 O0 k/ f/ {) g1 ?) k  N# j
    • % Choose default command line output for CT_image_FCM
    • handles.output = hObject;
    • # ]8 @: I+ p$ W+ V
    • % Update handles structure
    • guidata(hObject, handles);

    • 5 I2 h. @6 `" _5 _( w& q
    • % UIWAIT makes CT_image_FCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);
    • ( D, c) k8 ?6 b7 x
    •   q4 t; _) p- R: `  \% |+ w0 H
    • % --- 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)
    • / ^0 B/ R. k# y2 ]8 d3 Y
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;

    • $ w+ g* a" V3 k6 r4 S* W

    • 6 Q: P) O6 G0 E& c  k2 \
    • % --- 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('原图');
    • % L2 A4 I* t+ f. V- \; B3 ~2 k
    • % --- 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)

    • ( W3 A. |3 ~; Z' o5 X

    • 7 R0 C1 ~, O7 Q7 _/ t5 p, d. C4 ]
    • % --- 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);
    • " s1 F8 r6 n# c
    • ) n$ N, v6 Z: K. q7 ~
    • % --- 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);
    • ! h$ ~8 ~& O+ z  M' C
    • * Z( _7 |+ V- e/ Z$ k
    • % --- 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);
    • 0 x- {, [1 [. y- q7 X) _, G
    • ; R# W7 @  G+ P9 a* B+ V
    • % --- 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);/ R+ ]6 q; s7 q6 F
                           
    ' t9 K# S1 c7 a* a0 C5 R
    - K" s0 T, B/ e6 [  S3 \3 a& M' p0 ?* f$ `6 J" F+ N5 R* @
    • 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
    • * m. ^0 e: T" p
    • % Edit the above text to modify the response to help CT_image_GFCM
    • - K$ Z2 y+ g6 \4 X2 v  t
    • % Last Modified by GUIDE v2.5 13-Apr-2020 21:47:11
    • / v( m0 \: }  h$ p, a9 Y' V
    • % 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

    • & A% q& F. P1 h( G3 I
    • if nargout
    •     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT

    • . ^3 C$ j" d, B

    • 8 I# K& g# k* K' [  F) _8 N
    • % --- 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)
    • - H# r# W+ G8 l! l" `" A
    • % Choose default command line output for CT_image_GFCM
    • handles.output = hObject;
    • 2 |* o2 h( R) l! U6 K
    • % Update handles structure
    • guidata(hObject, handles);
    • 8 P( P! f+ S8 f$ L, a$ y1 t; Z' M
    • % UIWAIT makes CT_image_GFCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);
    • $ v. Z$ B0 s( `, L0 s( a1 b# G7 u# l

    • * X; \4 o3 x% _* y$ M
    • % --- 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)

    • ( K/ u& r' ?, w! P5 y
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;

    • : I9 f% J: I' ?2 Z
    • & e% a, R% V" m; c
    • % --- 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('原图');

    • ( h6 \% a4 M2 T
    • % --- 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)
    • 3 _+ l2 F5 C  g% [- j7 k- S
    • ( x' k% r+ X3 f( v% R# K+ O: k% Q
    • % --- 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);

    • $ q! U! A: g% C7 n( K% t4 B+ ?4 v
    • 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 i7 L! H9 ?2 d' 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)
    • * a, h. R6 b( Q
    • % --- 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)
    • / d  X- i5 S! C2 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 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)
      * D& v1 t/ z; X6 l! c( @
                         . D! U- g' u3 b2 U+ A" ?
    / i. O2 ^! o  c6 t# F+ b
    - W" p% `2 Y' C7 |5 j3 D
    二、运行结果
    * B1 `! G" q+ |. e2 t9 x* q+ q, E% p$ @$ \* z
    & O. p; k; g; O
    - O: t* l* p. C% q4 x
    1 G) s0 n; ^' S9 C. m1 h) y( I

    该用户从未签到

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

    该用户从未签到

    3#
    发表于 2021-4-25 17:05 | 只看该作者
    收藏到源代码库! F! r% d) ?3 h) X' v
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-10-30 13:57 , Processed in 0.187500 second(s), 27 queries , Gzip On.

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

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

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