Anda di halaman 1dari 8

Deteccin de Huesos fracturados a partir de imgenes en radiografa Diagrama de flujos: Diagrama de flujos: Inicio

Cargar imagen

Analizar Imagen Determinar # de regiones

si
Regiones > 1

no

Mostrar: Si hay fractura Mostrar: No hay fractura

no Salir?

si fin

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:

Simulando el programa tenemos: Cargando la imagen a analizar

Para una que no tiene fractura:

Para una q tiene fractura en la muestra:

EL CODIGO DEL PROGRAMA ES:


function varargout = diagnostico(varargin) % DIAGNOSTICO M-file for diagnostico.fig % DIAGNOSTICO, by itself, creates a new DIAGNOSTICO or raises the existing % singleton*. % % H = DIAGNOSTICO returns the handle to a new DIAGNOSTICO or the handle to % the existing singleton*. % % DIAGNOSTICO('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in DIAGNOSTICO.M with the given input arguments. % % DIAGNOSTICO('Property','Value',...) creates a new DIAGNOSTICO or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before diagnostico_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application

% stop. All inputs are passed to diagnostico_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 diagnostico % Last Modified by GUIDE v2.5 19-Dec-2012 20:00:09 % Begin initialization code - DO NOT EDIT gui_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{:}); else gui_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 diagnostico handles.output = hObject; % Update handles structure guidata(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

% eventdata % handles

reserved - to be defined in a future version of MATLAB 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 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 imagen calle=imread(nombre); imshow(calle) %blanco y negro grises=rgb2gray(calle); imshow(grises) %segmentacion thresh=200; lineas=im2bw(grises,thresh/255); imshow (lineas) %limpiamos la imagen lineas=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 imagen stats=regionprops(L,'all'); %Individualizacion shapes=[stats.Eccentricity]; keepers=find(shapes>0.31); %desplegar seleccion imshow(grises) for index = 1:length(keepers) outline=B{keepers(index)}; line(outline(:,2),outline(:,1),'color','w','LineWidth',1) end %Resultados del Analisis if 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');

%%disp('No se ah detectado fractura en el hueso') end %%%%%%%%%%%%%%% handles.output = hObject; % Update handles structure guidata(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; end clear,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)

Anda mungkin juga menyukai