Identifikasi Fase Perkembangan Plasmodium Falciparum Dalam Sel Darah Merah Yang Terinfeksi Malaria Dengan Segmentasi Warna Adaptif Dan Klasifikasi Berbasis Pohon Keputusan


Berikut ini merupakan pemrograman GUI Matlab mengenai aplikasi pengolahan citra dan pengenalan pola untuk menganalisis citra sampel darah mikroskopis yang terjangkit parasit penyebab malaria.

GUI yang dirancang merupakan bagian dari penelitian yang berjudul Identification of Plasmodium Falciparum Development Phase in Malaria Infected Red Blood Cells using Adaptive Color Segmentation and Decision Tree based Classification

Tujuan dari penelitian ini antara lain adalah:
1. Mengidentifikasi jenis fase perkembangan plasmodium falciparum yang merupakan parasit penyebab malaria
2. Menghitung jumlah plasmodium falciparum pada masing-masing fase perkembangannya

Set-up alat akuisisi citra sel darah mikroskopis ditunjukkan pada gambar berikut ini:

Set-up alat akuisisi citra sel darah merah terinfeksi plasmodium falciparum

Sedangkan prosedur penelitian yang digunakan meliputi:
1. Akuisisi citra
Akuisisi citra dilakukan dengan menangkap citra dari preparat sel darah merah yang terinfeksi plasmodium falciparum menggunakan mikroskop dengan perbesaran 1000x dan USB kamera digital dengan resolusi 400 x 320 piksel.

2. Segmentasi Warna Adaptif
Segmentasi warna diawali dengan mengkonversi ruang warna citra yang semula RGB (Red, Green, Blue) menjadi HSV (Hue, Saturation, Value). Setelah itu, dilakukan operasi thresholding terhadap komponen Saturation.

3. Ekstraksi Ciri Morfologi
Parameter ciri morfologi yang digunakan untuk membedakan fase perkembangan plasmodium falciparum adalah rasio luas, rasio keliling, eccentricity, dan metric.

4. Klasifikasi Citra dengan Algoritma Pohon Keputusan
Perkembangan P. falciparum terdiri dari tiga fase yaitu fase trophozoite, fase shizont, dan fase gametocyte. Fase trophozoite memiliki ciri morfologi berukuran lebih kecil dibandingkan dengan fase schizont maupun fase gametocyte. Oleh sebab itu, pada penelitian ini parameter rasio luas dan rasio keliling digunakan untuk membedakan ukuran fase trophozoite dengan fase lainnya. Sedangkan parameter eccentricity dan metric digunakan untuk membedakan bentuk antara fase schizont dengan fase gametocyte, di mana fase schizont memiliki bentuk bulat sedangkan fase gametocyte memiliki bentuk lonjong. Proses identifikasi fase perkembangan plasmodium falciparum dilakukan dengan menggunakan kombinasi dua dari empat parameter morfologi sebagai masukan dalam algoritma pohon keputusan.

Tampilan GUI Matlab untuk menghitung dan mengidentifikasi fase perkembangan plasmodium falciparum adalah sebagai berikut:

1.Tampilan menu awal

2. Proses identifikasi plasmodium falciparum pada fase perkembangan trophozoite

3. Proses identifikasi plasmodium falciparum pada fase perkembangan trophozoite dan schizont

4. Proses identifikasi plasmodium falciparum pada fase perkembangan gametocyte dan trophozoite

Tampilan source code nya adalah:

function varargout = Malaria_1(varargin)
% MALARIA_1 MATLAB code for Malaria_1.fig
%      MALARIA_1, by itself, creates a new MALARIA_1 or raises the existing
%      singleton*.
%
%      H = MALARIA_1 returns the handle to a new MALARIA_1 or the handle to
%      the existing singleton*.
%
%      MALARIA_1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MALARIA_1.M with the given input arguments.
%
%      MALARIA_1('Property','Value',...) creates a new MALARIA_1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Malaria_1_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Malaria_1_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 Malaria_1

% Last Modified by GUIDE v2.5 23-Nov-2014 19:33:02

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @Malaria_1_OpeningFcn, ...
    'gui_OutputFcn',  @Malaria_1_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 Malaria_1 is made visible.
function Malaria_1_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 Malaria_1 (see VARARGIN)

% Choose default command line output for Malaria_1
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);
movegui(hObject, 'center');

% UIWAIT makes Malaria_1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Malaria_1_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)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- 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)
[nama_file,nama_path] = uigetfile({'*.jpg','*.*'});
if ~isequal(nama_file,0)
    Img = imread(fullfile(nama_path,nama_file));
    axes(handles.axes1)
    imshow(Img)
    title(nama_file,'FontName','Calibri','FontSize',14,'FontWeight','bold')
else
    return
end

handles.Img = Img;
handles.nama_file = nama_file;
guidata(hObject, handles)

% --- 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)
set(handles.edit1,'String','0')
set(handles.edit2,'String','0')
set(handles.edit3,'String','0')

Img = handles.Img;
HSV = rgb2hsv(Img);
S = HSV(:,:,2);
bw = im2bw(S);
bw2 = imfill(bw,'holes');
bw3 = bwareaopen(bw2,12);
bw4 = imclearborder(bw3);

axes(handles.axes2)
imshow(bw4)

[B,L] = bwboundaries(bw4,'noholes');
stats = regionprops(L,'Centroid','Area','Perimeter','Eccentricity');

[m,n] = size(Img);

for k = 1:length(B)
    boundary = B{k};
    Area_Ratio = (stats(k).Area)/(m*n);
    Perimeter_Ratio = (stats(k).Perimeter)/(2*(m+n));
    Eccentricity = stats(k).Eccentricity;
    
    Metric = 4*pi.*Area_Ratio/(Perimeter_Ratio.^2);
    
    %     % 1. Area-Perimeter
    %     if Area_Ratio < 0.00178906
    %         text(boundary(2,2)+10,boundary(1,1),'T','Color','g','FontWeight','bold');
    %     elseif Area_Ratio >= 0.00178906
    %         if Perimeter_Ratio < 0.0880576
    %             text(boundary(2,2)+10,boundary(1,1),'S','Color','y','FontWeight','bold');
    %         elseif Perimeter_Ratio >= 0.0880576
    %             text(boundary(2,2)+10,boundary(1,1),'G','Color','r','FontWeight','bold');
    %         end
    %     end
    %
    %     % 2. Area-Eccentricity
    %     if Area_Ratio < 0.00178906
    %         text(boundary(2,2)+10,boundary(1,1),'T','Color','g','FontWeight','bold');
    %     elseif Area_Ratio >= 0.00178906
    %         if Eccentricity < 0.787774
    %             text(boundary(2,2)+10,boundary(1,1),'S','Color','y','FontWeight','bold');
    %         elseif Eccentricity >= 0.787774
    %             text(boundary(2,2)+10,boundary(1,1),'G','Color','r','FontWeight','bold');
    %         end
    %     end
    %
    % 3. Area-Metric
    %     if Area_Ratio < 0.00178906
    %         text(boundary(2,2)+10,boundary(1,1),'T','Color','g','FontWeight','bold');
    %     elseif Area_Ratio >= 0.00178906
    %         if Metric < 0.58167
    %             text(boundary(2,2)+10,boundary(1,1),'G','Color','r','FontWeight','bold');
    %         elseif Metric >= 0.58167
    %             text(boundary(2,2)+10,boundary(1,1),'S','Color','y','FontWeight','bold');
    %         end
    %     end
    %
    %     % 4. Perimeter-Eccentricity
    if Perimeter_Ratio < 0.0405299
        text(boundary(2,2)+10,boundary(1,1),'T','Color','g','FontWeight','bold');
        val1 = str2double(get(handles.edit1,'String'));
        val4 = str2double(get(handles.edit4,'String'));
        set(handles.edit1,'String',1+val1)
        set(handles.edit4,'String',1+val4)
    elseif Perimeter_Ratio >= 0.0405299
        if Eccentricity < 0.787774
            text(boundary(2,2)+10,boundary(1,1),'S','Color','y','FontWeight','bold');
            val2 = str2double(get(handles.edit2,'String'));
            val5 = str2double(get(handles.edit5,'String'));
            set(handles.edit2,'String',1+val2)
            set(handles.edit5,'String',1+val5)
        elseif Eccentricity >= 0.787774
            text(boundary(2,2)+10,boundary(1,1),'G','Color','r','FontWeight','bold');
            val3 = str2double(get(handles.edit3,'String'));
            val6 = str2double(get(handles.edit6,'String'));
            set(handles.edit3,'String',1+val3)
            set(handles.edit6,'String',1+val6)
        end
    end
    %
    %     % 5. Perimeter-Metric
    %     if Perimeter_Ratio < 0.0405299
    %         text(boundary(2,2)+10,boundary(1,1),'T','Color','g','FontWeight','bold');
    %     elseif Perimeter_Ratio >= 0.0405299
    %         if Metric < 0.58167
    %             text(boundary(2,2)+10,boundary(1,1),'G','Color','r','FontWeight','bold');
    %         elseif Metric >= 0.58167
    %             text(boundary(2,2)+10,boundary(1,1),'S','Color','y','FontWeight','bold');
    %         end
    %     end
    %
    %     % 6. Eccentricity-Metric
    %     if Metric >= 0.970265
    %         text(boundary(2,2)+10,boundary(1,1),'T','Color','g','FontWeight','bold');
    %     elseif Metric < 0.970265
    %         if Eccentricity < 0.768523
    %             text(boundary(2,2)+10,boundary(1,1),'S','Color','y','FontWeight','bold');
    %         elseif Eccentricity >= 0.768523
    %             text(boundary(2,2)+10,boundary(1,1),'G','Color','r','FontWeight','bold');
    %         end
    %     end
end

function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- 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)
axes(handles.axes1)
cla('reset')
set(gca,'XTick',[])
set(gca,'YTick',[])

axes(handles.axes2)
cla('reset')
set(gca,'XTick',[])
set(gca,'YTick',[])

set(handles.edit1,'String','0')
set(handles.edit2,'String','0')
set(handles.edit3,'String','0')
set(handles.edit4,'String','0')
set(handles.edit5,'String','0')
set(handles.edit6,'String','0')

% --- 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)
axes(handles.axes2)
img = getframe(gca);
imwrite(img.cdata,handles.nama_file,'jpg')

filename = 'Data Malaria.xlsx';
No = xlsread(filename,'C:C');

if numel(No) ~= 0
    No = No(end)+1;
    Data = {No,datestr(clock,'ddd'),datestr(date),datestr(clock,'HH:MM:SS'),...
        handles.nama_file,get(handles.edit1,'String'),...
        get(handles.edit2,'String'),get(handles.edit3,'String')};
    T = table(Data);
    writetable(T,filename,'Sheet',1,'Range',strcat(['C',num2str(No+5)]),'WriteVariableNames',false)
    msgbox(strcat(strcat('Data No. ',num2str(No)),' berhasil disimpan'))
else
    No = 1;
    Data = {No,datestr(clock,'ddd'),datestr(date),datestr(clock,'HH:MM:SS'),...
        handles.nama_file,get(handles.edit1,'String'),...
        get(handles.edit2,'String'),get(handles.edit3,'String')};
    T = table(Data);
    writetable(T,filename,'Sheet',1,'Range','C6','WriteVariableNames',false)
    msgbox('Data No. 1 berhasil disimpan')
end

function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double


% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

Posted on August 10, 2015, in Pengenalan Pola, Pengolahan Citra and tagged , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink. 2 Comments.

  1. apa ini bisa diberikan source code nya?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: