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

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

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

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

    [LV.1]初来乍到

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

    EDA365欢迎您登录!

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

    x

    * ^8 ?0 w" H# N( K% ~$ R一、源代码
    ( a6 c; s4 @0 c  E) O: L+ U, 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
    • 7 ?* `% g; t$ N$ p. V5 K
    • % Edit the above text to modify the response to help CT_image_FCM

    • & a% g4 g9 b* i
    • % Last Modified by GUIDE v2.5 17-Apr-2020 00:06:23
    • 6 j* ]: {; S; s- Z. Y( G7 V
    • % 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
    • * }4 S2 @" A% ^0 _
    • if nargout
    •     [varargout{1:nargout}] = gui_maiNFCn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT
    • 5 u0 e) h. T2 Z2 k9 S$ g
    • " t. d0 N  H8 i6 J. s9 c, ?7 }3 w
    • % --- 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)
    • 8 z6 ~  o+ Z$ u2 m
    • % Choose default command line output for CT_image_FCM
    • handles.output = hObject;
    • 4 {  b3 P5 C" E" c( L8 r
    • % Update handles structure
    • guidata(hObject, handles);
    • $ Z. B: J- R* a5 [# ]7 M
    • % UIWAIT makes CT_image_FCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);

    • / ^/ X1 g. Z1 ]- F/ e

    • 0 [/ K( u! [/ j9 b" J, u
    • % --- 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 a1 q* S' k3 g! Y2 M$ g+ Z7 X% E
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;
    •   X7 s& Q, l# S7 u

    • ' d9 b& f" ~. G7 L* b! {7 s4 h) O
    • % --- 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('原图');
    • / _8 I! Z4 s. I; c8 A9 ^/ `7 o
    • % --- 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)
    • 4 i' s' p3 L  y8 Z2 o' U

    • ) C9 q: U3 u. [& U0 F5 v$ i, _
    • % --- 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);

    • 0 t$ \( z* N9 [) N& W
    • $ Z4 {5 P# s6 b& r" F
    • % --- 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);

    • # Z" {% X0 J  \" O+ ]
    • 3 \  H: e/ `; B" ^5 S
    • % --- 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);

    • # l# v, g5 a6 w8 l% R+ Z3 h

    • 5 R9 v( U  O4 t7 {0 P3 r: i
    • % --- 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);4 o' S2 J+ F# t' F& ]6 n, i
                           
    * E8 C& z' x" S7 m' P7 D. a6 w# t' ?. J* C

    & A' ~) [6 `% u( s$ t
    • 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

    • 8 M- v1 I/ j0 X' {. f1 t/ I' c
    • % Edit the above text to modify the response to help CT_image_GFCM
    • 8 `5 B. a. w9 n5 e; {2 Y
    • % Last Modified by GUIDE v2.5 13-Apr-2020 21:47:11

    • $ d/ w0 Y" N- g4 M3 ]
    • % 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
    • ( O5 x. M" ^& q  ^: [( p
    • if nargout
    •     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    • else
    •     gui_mainfcn(gui_State, varargin{:});
    • end
    • % End initialization code - DO NOT EDIT
    • , Y$ O# M5 e/ L; n

    •   X+ G& i) m$ f
    • % --- 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)
    • 9 j! O0 _7 l$ q" I6 B4 B4 S
    • % Choose default command line output for CT_image_GFCM
    • handles.output = hObject;

    • % Q2 d, q) o3 Z/ T1 ~$ E1 Z, J
    • % Update handles structure
    • guidata(hObject, handles);
    • % C% F; }1 U$ o2 M
    • % UIWAIT makes CT_image_GFCM wait for user response (see UIRESUME)
    • % uiwait(handles.figure1);

    • ! ~: S+ o, S8 F' o4 O( X5 ^

    • % C0 Z8 a: j8 p/ i. N( h+ v0 f
    • % --- 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)
    • $ }' s. r& w9 |! h  m, P5 x! d) G0 `
    • % Get default command line output from handles structure
    • varargout{1} = handles.output;

    • # L7 B& Q- E7 ]" K( {( }! t4 V2 A
    • 9 N& z6 \# G& Q
    • % --- 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('原图');
    • % A  w% f* k6 v- O' e
    • % --- 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 w  Z3 G! |0 q* I. z
    • - S" g2 Z2 q( q: w. S
    • % --- 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);

    • ( Y8 Y' i# |! O5 S
    • 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)
    • # W' X, m2 i) B+ p9 j6 Q% E
    • % --- 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)
    • , B  G6 X* _( f$ Z7 O
    • % --- 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)

    • 9 z& C9 ?) A5 G; b3 {
    • % --- 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 Y8 _" W( ?5 O0 x# }' B# W
                         0 Y) i  Z2 H1 B- A' z0 d

    ( c1 p/ ?/ j# e; J: O7 }
    # T/ |+ X$ Z! {6 D2 n" T7 _二、运行结果' L- S' J" }2 m8 Y
    + k1 N0 f5 _; w
    4 Y/ A$ |$ ~: W( N3 e+ e! B3 v. ]
    3 t5 Q) a- `6 \+ T, }
    + A# q7 M; P- [/ @* X+ H% a

    该用户从未签到

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

    该用户从未签到

    3#
    发表于 2021-4-25 17:05 | 只看该作者
    收藏到源代码库% {8 s  n( F3 k8 Y! j2 }  ^  _
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-7-19 13:27 , Processed in 0.125000 second(s), 26 queries , Gzip On.

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

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

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