# Visualization Of Ebi Spectroscopic Data Computer Science Essay

**Published:** **Last Edited:**

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Electrical Bioimpedance is the study of the opposition offered by biological material, such as human tissue, meat or wood, to the flow of electric charges.

EBI measurements are useful for several clinical applications, most of them for disease diagnosis, as an example, skin cancer detection, known as electronic biopsy (Find reference in my thesis), can be mentioned.

Into the field of Electrical Bioimpedance Spectroscopy (EBIS) measurements the most remarkable application is Total Body Composition (TBC) assessment, enabling the estimation of extracellular and intracellular water, as well as fat free mass.

One of the most usual artifacts caused by parasitic elements present on the measurement scenario on EBI measurements is the so-called Hook Effect, which presents a problem when analyzing the measured EBI spectrum or when performing a Cole fitting.

To avoid producing a wrong fitting or obtaining an erroneous spectral analysis of the measurement the Hook Effect must be corrected if possible or at least compensated prior any kind of analysis is performed on the EBI data.

1.2MOTIVATION:

Nowadays EBI technology is constantly upgrading and widely spreading technology used for the estimation of body composition, and provides detailed structure of fluid distribution of the body.

By using this estimation technique and signal analysis methods we can calculate the parameters of the Cole Equation, as well as the components of the electrical equivalent circuit of the cells.

Apart from the equivalent circuit components, the body features and by applying the mixture theory equations, the TBC can be estimated.

Matlab is probably the most spread and powerful signal processing software tool and EBIS analysis technique should have proper signal analysis software developed into Matlab. This lead us to develop a software suite using a correction method for the capacitive leakage artefact.

1.3GOAL:

The main goal of this thesis is to develop a software suite by implementing a Matlab tool that in a visual, easy and intuitive way, eliminate the stray capacitance estimated and compensate the Hook Effect, and show the results of the Cole fitting and the impedance features before and after the correction

1.4WORK DONE:

A software tool is developed using GUI tool of MATLAB. With this software suite, the files of .mfu extensions are loaded into the matlab. And they are processed in such a way the stray capacitance and the hook effect of the raw data are eliminated. The results appears in the GUI in such a way that the user can compare the raw data and the corrected data simultaneously. The processed data's are again saved back to .mfu extension which can be used by Bioimp software.

1.5STRUCTURE OF THE THESIS REPORT:

2.1 INTRODUCTION OF EBI:

Electrical Bioimpedance measures the electrical properties of the body composition and its tissue characteristics which is reacting to the applied external stimulus. EBI applications are widely spreaded and increasing but also under constant development. The application areas are widest in medical technology e.g. in psychophysiology, cardiology, neurology, surgery, cognitive sciences, physiotherapy, and sport medicines.{Sverre Grimnes , 2010 #1}

2.1.1. Electrical properties of tissue

The electric properties of body tissues and cell suspension have been used in analysing various diseases from a very long time and it is carried on till date. There are lots of research work done until now and has been still undergoing in this field which results in producing the EBI applications.

C:\Users\Vineel Kumar\Desktop\Animal cell.jpg

To analyse the response the applied electric current to the tissues, microscopic study of the cell is very essential. The cell consists of a cell membrane, a double layer of phospholipids (lipid bilayer), enclosing the cytoplasm, consisting of the cytosol within which the nucleus and all the other cell organelles reside. A general animal cell structure is shown in the Fig.2.1{Seoane, 2007 #2}

## 2.1.2. Equivalent circuit of a cell

The electrical behaviour of the single cell can be easily studied with the equivalent circuit model. This model represents the cell and tissue as a parallel connection of elements, representing the intracellular and the extracellular spaces as well as the plasma membrane. electrical properties of tissue are given by its constituents and the electrical behaviour can be represented with model which is given in figure 2.2

## Figure 2.3: Electrical Equivalent of cell. The circuit (a) is the one relying on cell membrane and the intra- and extra- environment of it. The circuit (b) is the equivalent of circuit (a) and the circuit (c) is the simplification of the circuit (b)

## 2.2 Hook Effect:

In EBI spectroscopy measurements, Hook effects are the most commonly founded measurement artefacts which is caused by stray capacitance. Hook effects are mostly caused by capacitance at high frequencies and gives a hook like deviation on the EBI data produced on the impedance plot , Reactance and Phase. (Buendia, 2009)

## Figure 2.2: The Hook effect to reactance (a) and phase (b)

## 2.3 Cole equation:

The Cole equation is a mathematical model that fits the measured EBI data to a suppressed semi-circle in the R-Xc plane, where the two intersections between the circle and the x-axis define the resistance at zero frequency, R0 and infinite frequency, R∞ (Figure 2.3). The Cole equation is as follows:

Figure 2.3 Cole suppressed semi circle.

The curve fitting procedure uses the least mean square method to minimize the variance of the distance between the centre of the circle and each plot of the actual measured impedance. This gives the coordinates for the centre of the circle and the radius. The Cole parameters, R0, R∞, and α are calculated as below (then τ or fc is obtained from Equation (2)):

## 2.4 Td Compensation:

Td compensation is the most widely used correction method for hook effect. It is obtained by multiplying the spectral EBI data with the complex exponential in the form of exp [jωTd].

## (

Where Zcorr ω is the corrected impedance, Zmeas ω is the measured impedance and e−jωTd is the exponential factor which uses the scalar Time Delay Td.

CHAPTER 3

3.1 General overview:

The main purpose of this thesis work is to produce a software tool which is used for EBI spectroscopy analysis. This application is developed in MATLAB with respective to GUI tool supplied by MATLAB.

Td Compensation is the widely spread technique used until now to remove Hook effect. But the usage of Td compensation method was not helpful in eliminating the hook effect accurately. So the Cpar estimation method is used as corrector function to eliminate the hook effect from the raw data.

This application is mainly focussed on correcting the hook effect with Cpar estimation technique. To remove the capacitive leakage ,which is formed during the EBI data measurement. The analysis tool provides the correction factor and the visualization of the data both in sense of raw and the corrected versions. In visualization part we show Resistance, Reactance, Cole, Conductance, Suspectance and Admittance with respect to raw as well as corrected data.

C:\Users\Vineel Kumar\Desktop\Untitled12.png

3.2 Functions for the Software Tool:

This section gives the flow structure of the analysis tool in a way it was designed. The flow analysis is clearly explained in each and every stage. And here follows the flow chart of the software to explain the work more clearly and to show how the work has been carried out.

Convert .mfu files to .mat files

Load and Read the raw data

Cpar Estimation and Hook effect

Hook correction

File storage and Visulization

Convert .mat files to .mfu files

3.3 Toolbox:

This software is developed using MATLAB as it simplifies the implementation of numerical linear algebra routines. And it is used to implement numerical algorithms for a wide range of applications. Many useful algorithms and high speed calculations in MATLAB has been highly helpful in developing functions of the software.

The functions can be explained in different stages as the software has been carried out.

File tools:

The EBI data files can be in different file extensions, here the files are in .mfu extension which are used in BIOIMP software. The .mfu files are read and converted into .mat file extension. This file has the patient information and the EBI measurements in a third dimensional matrix. A function called LOAD is implemented were these files are converted and being prepared to be processed and analysed.

Plotting tools:

Graphical visualization of the data's is very essential to study more about the data. The raw data is plotted first to give us the understanding about the data. Resistance, Reactance, Cole plot, Suspectance, Conductance and Admittance plot of the data are plotted. Here the raw data and the processed data are plotted against each other. This gives us clear comparison of the raw data and the processed data.

Processing tools:

Here some functions are implemented in order to correct the data and remove the artefacts from the measurement. So the processed data is free from artefacts and being ready for analyzing. The functions carried out for data processing are Cpar estimation, Hook effect and Hook correction. By using these functions we are minimizing the artefacts which are found in the data.

Conversion tools:

The processed data in .mat file extension is converted back to .mfu file extension in such a way to make sure the file can be used back in BIOIMP software for further analysis. The data's in third dimensional matrix is converted back to .mfu file back to its original format.

3.4 Graphical user interface:

The software tool is developed using GUI tool of MATLAB. We selected this method to make use of the most advantages of the MATLAB software and to our software more user interaction friendly.

The software screen consists of push buttons, plotting axes, slider tool, text boxes. These properties used in the software are very helpful to give user friendly application. In order to create the GUI software application the following ways are followed using these elements.

Components:

Pushbuttons, text boxes, slider tool, static text, plotting axes are the components which are used in this software. GUI gives the possibility of drag and drop option for designing the software using this components. It is then interfaced by uicontrol, uimenu and uicontextmenu functions. The graphical plotting is plotted using the axes function which is integrated to the plotting axes.

Figures:

Figure is the basic structure of the GUI panel which can hold all the components of any combination. Figure is the function which gives the blank template structure in GUI.

Call-backs:

This function plays a vital role in GUI in interfacing the components and the functions which can be called on a single mouse click. The MATLAB should respond to the special function which is being executed. The code to the specific function is being executed on every call to the function.

The implementation of GUI needs two files, one is .m file and a graphical fig. The .m file is being first developed in which all functions are programmed and executed on specific event. The graphic fig. is where all the components are placed and labelled. The sub routines are needed to link both these .m files and graphical fig.

CHAPTER 4.

ELECTRICAL BIOIMPEDANCE ANALYSIS TOOLBOX

4.1Genral overview:

In this chapter we discuss the functions and different tools which are developed in this software suite. The functions are developed and used according to the flow of the analysis process in a way the application is used. The user manual of the software suite is explained in detail in chapter 5. To give the better understanding of how the application works.

4.2 File Structure:

The EBI measurements can be from different formats. we have the measurements in MFU file format from the BIOIMP software. The measurements from MFU format must be extracted and converted to the .mat file format for easy and fast process in the software suite. .mat extension is widely used for its fast matrix calculation which is most suitable for all the functions in the EBI suite.

4.2.1Reading tools:

This section explains the function of Reading, Loading and Saving the EBI data's which file extensions are in the MFU. All the three functions are termed under one single function named Read_Improved. Firstly the EBI data's are selected from the folder using a MATLAB function uigetdir.

As soon as the Load pushbutton is executed, the Read_Improved function is called and executes. The pop up window pops out asking to select Cole parameter or the MFU file. When the MFU file is selected the code executes the other function.

The code proceeds in extracting the data from the MFU files and preparing to store in a 3-dimensional matrix array of .mat extension file. The data's are read, converted and stored in a .mat extension file which can be used easily by the software. The .mat extension file is saved in the name of matlab.mat.

The load function from the MATLAB software is used to load all the variables which is in the .mat file. The matlab.mat file is saved in the desired folder where the user wishes to save.

case 'mfu-file',

FileContent = dir(fullfile(FolderName, '*.mfu'));

NumberFiles= length(FileContent);

ZDataALL = zeros (256,3,NumberFiles);

Array = zeros (256,3,NumberFiles);

format long

%WD = cd;

cd (FolderName)

char FileName

for i=1:NumberFiles

FileName = FileContent(i).name

r = csvread(FileName,13,0);

Freq= r(:,1)* 1000;

Res= r(:,2);

Reac= r(:,3);

Ztusc1 = Res + Reac* j;

ZData =[Freq,Res,Reac];

ZDataALL(:,:,i)= ZData;

FileN = cell(1,i);

end

for i=1:NumberFiles

FileName = FileContent(i).name

FileN(i)=cellstr(FileName);

end

Person_1=ZDataALL;

Mean_Person_1= mean(ZDataALL,3);

uisave({'Person_1','Mean_Person_1','NumberFiles','FileN'},'matlab.mat');

end

4.3 Graphic plot tools:

The plotting functions are detailed in this section. The visualization part plays a major role in this software, as both raw and the processed data are plotted against each other. This gives a better understanding to the user about the EBI data. Resistance, Reactance, Cole, Admittance, Suspectance, Conductance are plotted for both raw and the corrected data.

C:\Users\Vineel Kumar\Desktop\Untitled12.png

C:\Users\Vineel Kumar\Desktop\admittance.png

There are six plots in the first frame of the software suite. Resistance, Reactance and Cole plot.

Resistance, the first plot of the main panel is plotted against frequency. The resistance plot of the raw data and the corrected data are plotted against each other. As the resistance increases the frequency decreases. The next is the reactance plot which is plotted against Reactance Vs Frequency. And the last plot is the Cole plot which is plotted against Reactance Vs Resistance. The Cole plot shows significant differences between the raw data plot and the corrected plot. Cole fitting plays a major role in correcting the data.

The next sets of graphical plots are executed when the admittance pushbutton in the main panel of the suite is executed on a single mouse click. Here the admittance, impedance and suspectance are plotted. The raw data of admittance is plotted against the corrected data of the admittance and the same happens with the conductance and suspectance too. These graphical plots plays a major role in explaining the results of the corrected data obtained by the software application.

ztemp =Person_1(:,2,:)+Person_1(:,3,:)*(sqrt(-1));

Z1=cat(2,Person_1(:,1,:),ztemp);

R1 = Person_1(:,1:2,:);

X1 = Person_1(:,1:2:3,:);

ztemp=1/Z1;

ztemp=ztemp(:,2,:);

Y1=cat(2,Person_1(:,1,:),ztemp);

ztemp=Y1(:,2,:);

ztemp=real(ztemp);

G1=cat(2,Person_1(:,1,:),ztemp);

ztemp=Y1(:,2,:);

ztemp=-imag(ztemp);

B1=cat(2,Person_1(:,1,:),ztemp);

%Resistance

axes(handles.Resistance_axes)

semilogx(R1(:,1,FileNum),R1(:,2,FileNum),'LineWidth',3)

title('Resistance')

xlabel('F(KHz)')

ylabel('R(\Omega)')

xlim([5e3,6e5]);

grid on

hold on

%Reactance

axes(handles.axes2)

semilogx(X1(:,1,FileNum),X1(:,2,FileNum),'LineWidth',3)

title('Reactance')

xlim([5e3,6e5]);

xlabel('F(KHz)')

ylabel('-X(\Omega)')

hold on

grid on

%Cole

axes(handles.axes3)

plot(R1(:,2,FileNum),X1(:,2,FileNum),'LineWidth',3)

xlabel('R(\Omega)')

ylabel('-X(\Omega)')

title('Cole')

hold on

grid on

%Conductance

%figure (4)

axes(handles.Resistance_axes)

cla

cla reset

cla(handles.Resistance_axes)

%cla(ax,'reset')

semilogx(G1(:,1,FileNum),G1(:,2,FileNum),'LineWidth',3)

title('Conductance')

xlabel('F(KHz)')

ylabel('G(\Omega)')

xlim([5e3,6e5]);

hold on

grid on

%Susceptance

%figure (5)

axes(handles.axes2)

cla

cla reset

cla(handles.axes2)

%cla(ax,'reset')

semilogx(B1(:,1,FileNum),B1(:,2,FileNum),'LineWidth',3)

title('Susceptance')

xlabel('F(KHz)')

ylabel('B(\Omega)')

xlim([5e3,6e5]);

hold on

grid on

% Admittance

%figure (6)

axes(handles.axes3)

cla

cla reset

cla(handles.axes3)

%cla(ax,'reset')

plot(G1(:,2,FileNum),B1(:,2,FileNum),'LineWidth',3)

title('Admittance')

xlabel('G(S)')

ylabel('B(S)')

hold on

grid on

This block of coding is given for plotting the raw data in six different graphic plots and placing the graphic plots in their specific axes.

## 4.4 Corrector factor:

In order to eliminate the hook effect factor which is present in the EBI data, Td compensate is the widely used method. But Td compensate method is done by multiplying the measured EBI data by a complex exponential method in the form of exp [jωTd]. Thus Td compensate is considered to be complete scalar. This method is called as Td compensate method which is followed for correcting the hook effect in EBI measurement.

The scalar Td compensate will reduce only the phase of , but since the exponent is imaginary the module is left unchanged.

## Figure 17 Module comparison multiplying the measured impedance by a scalar Td, note that Zmeas(ω) is overlapped

## Figure 18 Phase comparison multiplying the measured impedance by complex exponential with a

## scalar Td

Thus Td compensate should be complex in order to correct the data in both magnitude and phase. So, the real part will modify the phase and the imaginary part will modify module. In order to eliminate the hook effect completely the Td compensate should be a complex, or just more than a scalar. Thus another correction function is added together with the Td compensate to completely eliminate the hook effect from the EBI measurements. As the researches continued it was found that a mathematical expression would eliminate the impedance estimation error caused by the parasitic capacitance. So the hook effect will be completely removed.

## 4.5 correction function:

As discussed in the previous section, the mathematical expressions proved that by eliminating the stray capacitance will completely remove the hook effect from the EBI measurement data. The in equ (3) is a logarithmic complex function dependent on natural frequency (, and , this when substituted with the Td complex exponential exp(jTD) and multiply the complex EBI spectra ) produces the final expression for correcting the hook effect which is shown in the equation (4)

(3)

= * (4)

## Figure 27 Resistance of Ztissue(ω) gotten as a result of the product of the measured impedance and the correction function

## Figure 28 Reactance of Ztissue(ω) gotten as a result of the product of the measured impedance and the correction function

The above figures 28 shows that the reactance spectrum for the original Ztissue(ω) and the Ztissue(ω) is also obtained from using the equation (4). Thus in the figure 28 it is possible to see that both the spectra is complete at all frequencies. Thus we come to know that the hook effect can be completely removed with the help of the corrector function.

## 4.1 Estimation of the Parasitic Stray Capacitance:

As discussed in the previous topics, the parasitic stray capacitance should be estimated and to be eliminated to remove the hook effect completely from the EBI measurement. Mostly the EBI data is worked on impedance plane, defined with resistance and reactance. But the admittance contain the real part and the imaginary part same like the impedance. The real part is given by the conductance and denoted by G(ω) and the imaginary part is given by the suspectance and is denoted by S(ω). Thus the admittance is denoted by the mathematical expression

= +j......... (5)

Where the imaginary part of admittance is given by the equation 7

= + j ........(7)

## Figure 29 Tissue Electrical susceptance given by the following Cole parameters: Rο=449.6 _,

## R∞=449.6 _ Alpha=0.7186, fc=30.2 kHz, at high frequency, between 1MHz and 1GHz

The suspectance of the capacitance increases while the frequency decreases. The suspectance is very high at low frequencies. But in the figure 30 we can observe that when becomes zero then the measured suscpectance is completely linear with the slope value of .

## Figure 29 Tissue Electrical susceptance given by the following Cole parameters: Rο=449.6 _,

## R∞=449.6 _ Alpha=0.7186, fc=30.2 kHz, at high frequency, between 1MHz and 1GHz

## Implementing the correction function:

As discussed in the earlier topics we found that the best suiting corrector function to remove the hook effect completely from the measured EBI data. So we have used this method in our software suite to remove the hook effect completely

function [S]=Corrector_def()

load('matlab.mat')

Person_1(:,3,:)=-Person_1(:,3,:);

S=size(Person_1);

Person_1_Corr=zeros(S);

Person_1_Corr(:,1,:)=Person_1(:,1,:);

NM=S(3);

CparVector=zeros(NM,1);

Data=Person_1(:,:,1);

ZMatrix=(Data(:,2) + 1i*Data(:,3));

ZMatrix_real=(Data(:,2));

ZMatrix_imag=(Data(:,3));

F=Data(:,1);

[Cpar,d]=Cestimation_def(ZMatrix,F);

d

if(d>0)

CparVector(1)=Cpar;

ZMatrixCorr=CorrFunction_def(ZMatrix,Cpar,F);

Person_1_Corr(:,2,1)=real(ZMatrixCorr);

Person_1_Corr(:,3,1)=imag(ZMatrixCorr);

else

disp('Correction do not apply')

end

end

This block of code is used for correcting the EBI raw data. We also have two more functions which is used in the main function for Cpar estimation and corrector function. The below codes gives the structure in a way it was followed.

function ZMatrixCorr=CorrFunction_def(ZMatrix,Cpar,F)

w=F*2*pi;

Fcorr=-log(1-1i*w.*Cpar.*ZMatrix);

ZMatrixCorr=ZMatrix.*exp(Fcorr);

function [Cpar,d]=Cestimation_def(ZMatrix,F)

w=2*pi*F;

SMatrix=imag(1./ZMatrix);

limm=SMatrix./w;

d1=diff(SMatrix);

d=d1(255);

t=w(end-2:end);

% rel = [629 537 460 375 334 286 249 227] ;

rel=limm(end-2:end);

fh = @(x,p) p(1) + p(2)*exp(-x./p(3));

errfh = @(p,x,y) sum((y(:)-fh(x(:),p)).^2);

p0 = [mean(rel) (max(rel)-min(rel)) (max(t) - min(t))/2];

% search for solution

P = fminsearch(errfh,p0,[],t,rel);

% figure(3)

% % plot the result

## %

% figure(4)

% plot(t,rel,'bo',t,fh(t,P),'r-')

## %

t=6e6:100:5e7;%hold on

%plot(t,fh(t,P),'g-');

%Cpar=fh(1.5e7,P);

Cpartemp=fh(1.5e7,P);

Cpar=Cpartemp;

end