Detección de Huesos fracturados a partir de imágenes en radiografía
-
Upload
walter-mamani-ccasa -
Category
Documents
-
view
217 -
download
0
Transcript of Detección de Huesos fracturados a partir de imágenes en radiografía
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
1/8
Deteccin de Huesos fracturados a partir de imgenes en radiografa
Diagrama de flujos:
Diagrama de flujos:
Inicio
Cargar imagen
Regiones > 1
Analizar Imagen
Determinar # de regiones
Salir?
fin
si
si
no
no
Mostrar:
Si ha fractura
Mostrar:
No ha fractura
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
2/8
Programacin en guide:
Para la implementacin del proyecto usaremos el interfaz grfico (GUIDE) que nos proporciona el
software MATLAB como se puede apreciar en la siguiente figura:
Creacin del Entorno Grafico en GUIDE
Para crear un archivo en GUIDE realizamos los siguientes pasos:
Una vez seleccionado creamos una nueva aplicacin:
De donde obtenemos lo siguiente:
Desarrollando el programa tenemos:
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
3/8
Simulando el programa tenemos:
Cargando la imagen a analizar
Para una que no tiene fractura:
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
4/8
Para una q tiene fractura en la muestra:
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
5/8
EL CODIGO DEL PROGRAMA ES:
function varargout = diagnostico(varargin)% DIAGNOSTICO M-file for diagnostico.fig% DIAGNOSTICO, by itself, creates a new DIAGNOSTICO or raises theexisting% singleton*.%% H = DIAGNOSTICO returns the handle to a new DIAGNOSTICO or thehandle to% the existing singleton*.%% DIAGNOSTICO('CALLBACK',hObject,eventData,handles,...) calls thelocal
% function named CALLBACK in DIAGNOSTICO.M with the given inputarguments.%% DIAGNOSTICO('Property','Value',...) creates a new DIAGNOSTICO orraises the% existing singleton*. Starting from the left, property value pairsare% applied to the GUI before diagnostico_OpeningFcn gets called. An% unrecognized property name or invalid value makes propertyapplication
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
6/8
% stop. All inputs are passed to diagnostico_OpeningFcn viavarargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows onlyone% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help diagnostico
% Last Modified by GUIDE v2.5 19-Dec-2012 20:00:09
% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @diagnostico_OpeningFcn, ...'gui_OutputFcn', @diagnostico_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{:});
elsegui_mainfcn(gui_State, varargin{:});
end% End initialization code - DO NOT EDIT
% --- Executes just before diagnostico is made visible.function diagnostico_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 diagnostico (see VARARGIN)
% Choose default command line output for diagnosticohandles.output = hObject;
% Update handles structureguidata(hObject, handles);
% UIWAIT makes diagnostico wait for user response (see UIRESUME)% uiwait(handles.axes2);
% --- Outputs from this function are returned to the command line.function varargout = diagnostico_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
7/8
% 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 structurevarargout{1} = handles.output;
% --- Executes on button press in CARGAR.function CARGAR_Callback(hObject, eventdata, handles)% hObject handle to CARGAR (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Choose default command line output for diagnostico%deteccion de la imagen[nombre direccion]=uigetfile('*.jpg','Abrir Imagen');%cargamos la imagencalle=imread(nombre);imshow(calle)
%blanco y negrogrises=rgb2gray(calle);imshow(grises)%segmentacionthresh=200;lineas=im2bw(grises,thresh/255);imshow (lineas)%limpiamos la imagenlineas=bwareaopen(lineas,25);imshow(lineas)%Limpiar Bordes%%%lineas = imclearborder(lineas);%%%imshow(lineas)%hallar las lineas[B,L]=bwboundaries(lineas,'noholes');numRegions=max(L(:));imshow(label2rgb(L))%Analisis de la imagenstats=regionprops(L,'all');%Individualizacionshapes=[stats.Eccentricity];keepers=find(shapes>0.31);%desplegar seleccionimshow(grises)for index = 1:length(keepers)outline=B{keepers(index)};line(outline(:,2),outline(:,1),'color','w','LineWidth',1)
end%Resultados del Analisisif numRegions >1
warndlg('Se ha detectado una fractura en la muestra','*DIAGNOSTICO--PDI 2010-A');
%% disp('Se ah detectado fractura en el hueso')else
msgbox('No se ha detectado una fractura en la muestra','*DIAGNOSTICO--PDI 2010-A');
-
7/29/2019 Deteccin de Huesos fracturados a partir de imgenes en radiografa
8/8
%%disp('No se ah detectado fractura en el hueso')end
%%%%%%%%%%%%%%%handles.output = hObject;
% Update handles structureguidata(hObject, handles);
% --- Executes on button press in SALIR.function SALIR_Callback(hObject, eventdata, handles)% hObject handle to SALIR (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)opc=questdlg('Desea salir del programa?','SALIR','Si','No','No');if strcmp(opc,'No')
return;endclear,clc,close all
% --- 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)