Diabetic retinopathy - matlab图像处理 - 谷速源码
下载频道> 资源分类> matlab源码> 图像处理> Diabetic retinopathy

标题:Diabetic retinopathy
分享到:

所属分类: 图像处理 资源类型:程序源码 文件大小: 19.85 KB 上传时间: 2019-08-06 04:51:51 下载次数: 2 资源积分:1分 提 供 者: ilambaruthi Diabetic retinopathy
内容:
Diabetic retinopathy
function varargout = retinmain(varargin)
% RETINMAIN M-file for retinmain.fig
%      RETINMAIN, by itself, creates a new RETINMAIN or raises the existing
%      singleton*.
%
%      H = RETINMAIN returns the handle to a new RETINMAIN or the handle to
%      the existing singleton*.
%
%      RETINMAIN('CALLBACK',h ,eventData,handles,...) calls the local
%      function named CALLBACK in RETINMAIN.M with the given input arguments.
%
%      RETINMAIN('Property','Value',...) creates a new RETINMAIN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before retinmain_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to retinmain_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 retinmain
 
% Last Modified by GUIDE v2.5 24-Apr-2013 13:16:19
 
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @retinmain_OpeningFcn, ...
                   'gui_OutputFcn',  @retinmain_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 retinmain is made visible.
function retinmain_OpeningFcn(h , eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% h     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 retinmain (see VARARGIN)
 
% Choose default command line output for retinmain
handles.output = h ;
 
% Update handles structure
guidata(h , handles);
 
% UIWAIT makes retinmain wait for user response (see UIRESUME)
% uiwait(handles.figure1);
 
 
% --- Outputs from this function are returned to the command line.
function varargout = retinmain_OutputFcn(h , eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% h     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(h , eventdata, handles)
% h     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 filename
global pathname
global name
global image
[filename pathname]= uigetfile('*.jpg','*.png','Select Image File');
complete = strcat(pathname,filename);
image=imread(complete);
axes(handles.axes1);
imshow(image); ('Original Image1','fontsize',14,'fontname','monotype corsiva','color','red');
axis equal;axis off;
 
 
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(h , eventdata, handles)
% h     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 image gimage
rimage=image(:,:,1);
gimage=image(:,:,2);
bimage=image(:,:,3);
gray=rgb2gray(image)
figure,imshow(rimage); ('red channel');
figure,imshow(bimage); ('Blue channel');
axes(handles.axes2)
imshow(gimage); ('green channel','fontsize',14,'fontname','monotype corsiva','color','red');
axes(handles.axes3)
imshow(gray); ('Gray Image','fontsize',14,'fontname','monotype corsiva','color','red');
axis off;
 
 
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(h , eventdata, handles)
% h     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 image
[m n c]=size(image);
if c==3
gimage=rgb2gray(image);
else 
    gimage=image;
end
x=gimage;
GLCM2 = graycomatrix(x,'Offset',[2 0;0 2]);
stats = GLCM_Features1(GLCM2,0);
v1=stats.autoc(1);
v2=stats.contr(1);
v3=stats.corrm(1);
v4=stats.corrp(1);
v5=stats.cprom(1);
v6=stats.cshad(1);
v7=stats. dissi(1);
v8=stats.energ(1);
v9=stats.entro(1);
v10=stats. homom(1);
v11=stats.homop(1);
v12=stats.maxpr(1);
testfea(1,1:12)=[v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12]; 
save testfea testfea
set(handles.uitable1,'Data',testfea);
 
 
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(h , eventdata, handles)
% h     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 class
load trainfea
load target
load testfea
input=trainfea';
numHiddenNeurons = 20;  % Adjust as desired
net = cascade(input,target,numHiddenNeurons);
net.divideParam.trainRatio = 80/100;  % Adjust as desired
net.divideParam.valRatio = 10/100;  % Adjust as desired
net.divideParam.testRatio = 10/100;  % Adjust as desired
% Train and Apply Network
[network,tr] = train(net,input,target);
load network
prediction = sim(network,testfea');
class=round(prediction);
if class==0
    msgbox('Hemorrhages');
end
if class==1
    msgbox('Microneursym');
end
 
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(h , eventdata, handles)
% h     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 class image name 
global maskErode
fim=mat2gray(image);
level=graythresh(fim);
bwfim=im2bw(fim,0.1);
[bwfim0,level0]=adaptivethresh(fim,0);
[bwfim1,level1]=adaptivethresh(fim,1);
if class==0
    gray=rgb2gray(image);
rimage=image(:,:,1);
gimage=image(:,:,2);
bimage=image(:,:,3);
im1=medfilt2(gimage);
 
figure,imshow(im1);
('Green channel with Median filter','fontsize',14,'fontname','monotype corsiva','color','red');
 
img=imsubtract(gray,im1);
figure,imshow(img);
('Subtracted Image','fontsize',14,'fontname','monotype corsiva','color','red');
% img1=im2bw(img);
% figure,imshow(img1);
 
e = find(img>30);
mask = zeros(size(img));
mask(e) = 255;
% Region erosion through math morph
se = strel('disk',3);
maskErode = imerode(mask,se);
figure,imshow(maskErode);
('Final Result','fontsize',14,'fontname','monotype corsiva','color','red');
end
if class==1
  detecmicro(image,name)  
end
 
 
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(h , eventdata, handles)
% h     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 class
global maskErode
global filename;
load trainfea
set(handles.uitable2,'Data',trainfea);
load trainfea
load target
E=filename;
input=trainfea';
numHiddenNeurons = 20;  % Adjust as desired
net = cascade(input,target,numHiddenNeurons);
net.divideParam.trainRatio = 80/100;  % Adjust as desired
net.divideParam.valRatio = 10/100;  % Adjust as desired
net.divideParam.testRatio = 10/100;  % Adjust as desired
% Train and Apply Network
[network,tr] = train(net,input,target);
load network
load TP
outputs = sim(network,input);
outputs=round(outputs);
E=str2num(E(1));
 plotperf(tr)
plotconfusion(target,outputs)
sen=0;
spe=0;
if class==0
    [m n]=size(maskErode);
    k=1;
    for i=1:m
        for j=1:n
            if maskErode(i,j)==255
                k=k+1;
            end
        end
    end
    TP=TP(E);
    TN=(m*n)-TP;
    FP=k;
    FN=((m*n)-k)-(TN);
    sen=TP/(TP+FN);
    spe=TN/(TN+FP);
end
set(handles.text7,'string',num2str(sen));
    set(handles.text9,'string',num2str(spe));
 
 
 
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(h , eventdata, handles)
% h     handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.uitable1,'Data',0);
set(handles.uitable2,'Data',0);
axes(handles.axes1)
imshow(0);
axes(handles.axes2)
imshow(0);
axes(handles.axes3)
imshow(0);
 

关键词: Diabetic retinopathy

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved