THE DEVELOPMENT OF A BEDSIDE DISPLAY FOR THE ICU By YAWEI SUN Submitted in partial fulfillment of the requirements For the degree of Master of Science Thesis Advisor: Professor Kenneth A. Loparo, Ph.D. Department of Electrical Engineering and Computer Science CASE WESTERN RESERVE UNIVERSITY May 2014 CASE WESTERN RESERVE UNIVERSITY SCHOOL OF GRADUATE STUDIES We hereby approve the thesis/dissertation of Yawei Sun Candidate for the (signed) Master of Science degree *. Kenneth A. Loparo, Ph.D (Chair of the committee) Farhad Kaffashi, Ph.D Frank Jacono, Ph.D (date) 5/27/2014 *We also certify that written approval has been obtained for any proprietary material contained therein. 1 Table of Contents 1 Introduction ........................................................................................ 9 2 Data Structure Analysis of EDF file ............................................... 11 2.1 Introduction .............................................................................................................. 11 2.2 Background ............................................................................................................... 11 2.3 Data Structure for EDF file....................................................................................... 14 2.3.1 Basic Structure for EDF .................................................................................... 14 2.3.2 Data Analysis of EDF in MATLAB ................................................................. 16 3 Basic Ideas for the GUI of the ICU ................................................. 22 3.1 Introduction ................................................................................................................. 22 3.2 Components of the GUI .............................................................................................. 22 3.3 Data Selection ............................................................................................................. 23 3.4 Plot .............................................................................................................................. 24 3.5 Time setting ................................................................................................................ 25 3.6 Information ................................................................................................................. 25 3.7 Innovation Ideas .......................................................................................................... 26 3.7.1 Poincare Plot ........................................................................................................ 26 3.7.2 Histogram............................................................................................................. 28 4 Innovation GUI Development and Analytic Information Extraction ................................................................................................ 30 4.1 Introduction ................................................................................................................. 30 4.2 Related Prior Work ..................................................................................................... 31 4.2.1 Development environment ................................................................................... 31 4.2.2 Frame Design ....................................................................................................... 31 4.2.3 Data processing .................................................................................................... 32 4.3 Realization of GUI ...................................................................................................... 36 4.3.1 Data Selection ...................................................................................................... 36 4.3.2 Plot and Time setting ........................................................................................... 38 2 4.3.3 Information .......................................................................................................... 42 4.3.4 Innovation: Poincare Plot and Histogram ............................................................ 47 5 Real Time Analysis Mode Development ......................................... 55 5.1 Introduction ................................................................................................................. 55 5.2 Realization of Real Time Analysis Mode ................................................................... 55 5.3 Discussion and Future work........................................................................................ 60 Appendix .................................................................................................. 62 Bibliography ............................................................................................ 66 3 List of Figures Figure 2-1: Spacelabs 90396 monitor ................................................................ 12 Figure 2-2: Numeric Data from Spacelabs 90396 monitor ............................. 13 Figure 2-3: Philips Intellivue MP5 monitor ...................................................... 14 Figure 2-4: Header record structure for EDF file in MATLAB ..................... 16 Figure 2-5: The label of each channel of EDF file in MATLAB ..................... 17 Figure 2-6: The TransType of each channel of EDF file in MATLAB ........... 18 Figure 2-7: The Unit of each signal of EDF file in MATLAB ......................... 18 Figure 2-8: The Physical Min of each signal of EDF file in MATLAB .......... 19 Figure 2-9: The Physical Max of each signal of EDF file in MATLAB .......... 19 Figure 2-10: The Dimension Min of each signal of EDF file in MATLAB .... 20 Figure 2-11: The Digital Max of each signal of EDF file in MATLAB ........... 20 Figure 2-12: The number of samples in each data record of EDF file in MATLAB ..................................................................................................... 21 Figure 3-1: Poincare plot for a normal person ................................................. 28 Figure 4-1: Simplified frame of innovation GUI .............................................. 32 Figure 4-2: Data Selection for ECGL vs. ECGR .............................................. 36 Figure 4-3: Data selection for HR vs. Cannula Flow ....................................... 37 Figure 4-4: Time vs. Cannula Flow ................................................................... 37 Figure 4-5: Regular Data Comparison.............................................................. 38 Figure 4-6: Legend of plot .................................................................................. 39 Figure 4-7: Time Gap1 and Time Gap2 to change the time interval between each data ...................................................................................................... 40 Figure 4-8: Change the Data Length of each period by setting WindowLength ....................................................................................................................... 41 Figure 4-9: Information of Mean value and Standard Deviation of x axis and y axis ............................................................................................................. 43 Figure 4-10: Mean value of Distance, SD of Distance, and cluster selection . 44 Figure 4-11: Detect Respiration rate by setting a threshold for Time vs. Cannula Flow .............................................................................................. 45 Figure 4-12: Abnormal Respiration Rate, the value of Cannula flow is too low ....................................................................................................................... 46 Figure 4-13: Poincare´Plot of Heart Rate ........................................................ 48 Figure 4-14: Low Frequency Power and High Frequency Power of the Heart Beat ............................................................................................................... 50 Figure 4-15: Poincare´plot: Respiration Rate vs. Respiration Rate (1 sample) ....................................................................................................................... 50 Figure 4-16: Histogram for SaO2 vs. HR ......................................................... 51 Figure 4-17: Conventional SaO2 vs. HR scatterplot ........................................ 52 Figure 4-18: Histogram of SaO2 vs. SaO2 ......................................................... 52 Figure 5-1: Set the Path selection for users ...................................................... 56 Figure 5-2: Real Time Display of ECG(V1) and ECG(LL) signals(Ideal) ..... 57 Figure 5-3: Real Time Display of ECG(V1) and ECG(LL) signals (with 4 Artificial Points) .......................................................................................... 57 Figure 5-4: Switch to Analytic mode, ECGR vs. ECGL .................................. 58 Figure 5-5: Analytic mode, HR vs. ECGR ........................................................ 58 Figure 5-6: Switch Back to Real Time Analysis mode ..................................... 59 Figure 5-7: Stop the program ............................................................................ 59 Figure 5-8: Saved Data ....................................................................................... 60 5 List of Tables Table 2-1 : Physical Min and Max, Digital Min and Max ............................... 21 Table 4-1 : Physical Min and Max, Digital Min and Max ............................... 33 6 Acknowledgements: I would especially like to thank Dr. Kenneth Loparo for all of his guidance and all the support throughout my graduate career. Additionally, I would also like to thank the other members of my defense committee Dr. Frank Jacono and Dr. Farhad Kaffashi for taking their time to read and provide feedback. Finally, I must thank Dr. Farhad Kaffashi for all his assistance in understanding the data structure, set up of the GUI and for answering so many questions along the way. 7 The Development of a Bedside Display for the ICU Abstract by YAWEI SUN In this thesis, an innovative Graphical User Interface (GUI) for the next generation of bedside decision-support systems for the Intensive Care Unit (ICU) is developed. Functions of existing monitors in the ICU are integrated into a single bedside system. The bedside monitor is capable of visualizing real-time data streaming from a patient monitor, performing routine and novel signal analytics and also reading archived patient waveform data in European Data File (EDF) format. Signals such as Electrocardiograph (ECG) waveform, Heart Rate (HR), Oxygen Saturation (SaO2), etc. are available for visualization and analysis. Selection for three different period time data with flexible data length is also created. Novel analytics including Poincare´and histogram plots are available to investigate the variation and connections of different physiological signals. 8 1 Introduction In recent years, we have witnessed a significant increase in the instrumentation that is available in different hospital units, especially in the care of critically ill patients in the intensive care unit [1] where a variety of devices are used to monitor patient status. The bedside monitor developed in this work is intended as a tool managing the collection, integration, and visualization of all types of clinical data. The data originates from four major sources, (1) bedside medical devices, (2) local area network (LAN) of the ICU, (3) hospital information system (HIS) and (4) manual input [2]. All these sources are remarkably different in both the quality and quantity of data. However, the issue of data overload is the main problem for health care professionals making it difficult to make a decision. The massive clinical data from bedside medical devices with limited processing and analytics not only contributes to the data overload problem, but also increase the possibility of medical errors. In this thesis, we develop a bedside monitor that can get data in real-time, provide data visualization and analytics go support clinical decision-making at the bedside. Maintaining a balance between useful data and the limited space available for data display on a bedside monitor is a challenging question for improving the efficiency of health care. Further, providing a rich database and custom analytics to different users requires new concepts for data presentation and manipulation to support better clinical decisions [3]. The conventional patient monitor used in the ICU displays real-time signal plots, e.g. ECG, SaO2 and Non-Invasive Blood Pressure (NIBP) waveforms, as well as numeric such as HR and ABP. Raw data is not acquired at high sampling rates or archived to facilitate either real-time or off line analysis. This, traditional patient monitors interface only provide limited information, with no capability for even the simplest data analytics. In this thesis, we develop a bedside monitor that includes two panels for users to select different types of data displays, including both time and scatter plots, and also a variety of signal analytic methods that can be used for trend analysis to determine 9 when a change in patient state may have occurred. Users can select three separate 1-minute (default) data segments for comparative purposes and to facilitate further analysis, raw ECG data is to compute heart rate by detecting the R to R intervals and respiratory rate is determined from Cannula flow. The bedside monitor also includes some novel analytics, including Poincare´and Histogram plots. The Poincare´plot is a method to analyze the variability of a time series, usually between consecutive data samples. When we select the same signal for both the x-axis and y-axis data, the Poincare´plot will be activated. Using a single sample delay, the traditional Poincare´plot of the data is generated. We can visualize the changes in signal in consecutive or nonconsecutive time points. To quantify the variability, we compute SD1C (short term) and SD2C (long term) measures of variability by estimating the minor and major axes of a hypothetical ellipse that contains the scatter plot. We also include another measure of heart rate variability using the Lomb Periodogram for unevenly sampled time series data to calculate the Low Frequency Power (LPF) and High Frequency Power (HPF). We use the histogram to investigate the (distributional) connection between two different signals, instead of the cross-correlation hat is only intended to quantify the degree of linear dependence. The corresponding distribution of a signal is investigated by setting the high-low limits of the other signal. Specifically, when we set the limit for HR from 85 to 120, the corresponding distribution of SaO2 in this one-minute when the HR is from 85 to 120 will be shown in the figure. The real-time analysis tools allow the user to evaluate the current status of the patient. For example, two leads of ECG signals can be displayed and the detected heartbeats can be shown directly on the ECG signals. Simultaneously, we compute the instantaneous HR and Standard Deviation of the HR along with other relevant parameters from the Poincare´analysis such as SD1C, SD2C, as well as LPF, HPF and LPF to HPF ratio. All this information is updated every 10 seconds, and users are able to switch the mode by selecting a corresponding checkbox as well as save parsed data into a file for later review and analysis. 10 2 EDF file format 2.1 Introduction Chapter 1 presented the basic concepts behind the bedside patient monitor GUI, next we will introduce a variety of different formats and data structures for clinical data such as .xls, .m, .txt, and .edf files. Research groups commonly use .xls and .m file formats for statistical analysis and importing data to Matlab for algorithm development and testing, respectively. Several companies provide output files in .txt format, for example, numeric data from the Spacelabs 90396/90496 monitor. The EDF file is a common file format for physiological data. The information in an EDF file is included in two separate parts, the header record and the data records. The header record consists of the version number, local patient ID, start date, start time, number of records, and number of signals. For the data records, it includes Labels, TransType, PhyDim, PhyMin, PhyMax, DiMin, DiMax, PreFiltering, nr, and Reserved. All this information is used to properly interpret the data that is included with the EDF file. 2.2 Background In the last few years, a large variety of commercial and specializedl computer-based systems have been used for automatic analysis and archiving of ECG and EEG (electroencephalograhpy) recordings. These systems are based on different protocols and different formats to store a large amount of polygraphic signal data. The large variety of different formats slows down the improvement of the ECG signal analysis algorithms because of the difficulty in translating data formats across different computational platforms. For instance, some engineers save the ECG data in .xls format, while others store complete polygraphic data as .m files, a file format for MATLAB. These formats for the storage of polygraphic signals are seldom used in 11 a clinical setting because the data structure is too complicated. More often, medical companies such as Spacelabs Healthcare save the data into a .txt file. Figure 2-1 shows the Spacelabs 90396 monitor. Figure 2-2 shows the numeric data we obtain using Hyperterminal from the Spacelabs 90396 monitor. Figure 2-1: Spacelabs 90396 monitor 12 Figure 2-2: Numeric Data from Spacelabs 90396 monitor The European Data Format (EDF) file format is often used to store digital polygraphic recordings. The EDF is a flexible format for exchange and storage of multichannel biological and physical signals [4]. A few European ‘medical’ engineers who met at the 1987 international Sleep Congress in Copenhagen developed the EDF format, which simplifies the complication of using a variety of formats to store and exchange digital polygraphic recordings. In our efforts to develop the Integrated Medical Environment (tIME) we using the EDF to archive all data from ICU monitors. Specifically, we are acquiring hing resolution physiological signal data from the Philips Intellivue MP5 patient monitor through a custom acquisition system that communicates with the monitor through the serial port. The signal data is then archived in EDF. Figure 2-3 shows the Philips Intellivue MP5 monitor. 13 Figure 2-3: Philips Intellivue MP5 monitor 2.3 Data Structure for EDF file 2.3.1 Basic Structure An EDF file consists of two parts, a header record and data records. The length of the header record is dependent on the number of signals and identifies the patient and specifies basic information such as StartDate, StartTime, NumberDataRecord, and SignalNumbers. The data records includes the details of different signals. 2.3.1.1 Header Record The header record can be separated into two parts, the first 256 bytes contain the version number, local patient ID, local record ID, date and time information, number of data records (nr), and the number of signals (ns). The second part includes 256 14 bytes for the detail of each signal such as number of records in a fixed time duration, which can be used for computing the sampling rate. The following shows the identity attributes of the header record: First part: Basic information of the file 8 ascii: version of this data format (0) 80 ascii: local patient identification 80 ascii: local recording identification 8 ascii: start date of recording (dd.mm.yy) 8 ascii : start time of recording (hh.mm.ss) 8 ascii : number of bytes in header record 44 ascii : reserved 8 ascii : number of data records (-1 if unknown) 8 ascii : duration of a data record, in seconds 4 ascii : number of signals (ns) in data record The identifying information included in the first part shows the Patient ID which used for identify the patient. The data and time information can be used in the bedside monitor to set the time point. The duration of a data record shows the time of each record. After the file attributes part, the header record contains the detailed information of each channel signal. Second part: Detail of each signal channel ns * 16 ascii : ns * label (e.g. EEG FpzCz or Body temp) ns * 80 ascii : ns * transducer type (e.g. AgAgCl electrode) ns * 8 ascii : ns * physical dimension (e.g. uV or degreeC) ns * 8 ascii : ns * physical minimum (e.g. -500 or 34) ns * 8 ascii : ns * physical maximum (e.g. 500 or 40) ns * 8 ascii : ns * digital minimum (e.g. -2048) 15 ns * 8 ascii : ns * digital maximum (e.g. 2047) ns * 80 ascii : ns * prefiltering (e.g. HP:0.1Hz LP:75Hz) ns * 8 ascii : ns * nr of samples in each data record ns * 32 ascii : ns * reserved 2.3.1.2 Data records The data records contain continuous fixed length data for each of the signals, the length of each period depends on the total the number of samples in each data record. 2.3.2 Exploring the EDF in MATLAB To more clearly understand the meaning of each of the attributes, we use the following example in MATLAB: Figure 2-4: Header record structure for EDF file in MATLAB In this example, the information we could get from this figure is that the patient 16 ID is ‘BI0313’. The start date and time are 18/05/04 and 19:33:03, and the number of records is 38610. Duration is 1 second, and signal numbers is 22. Additionally, the HeaderNumBytes is computed by the first part of header record 256 bytes plus 22 channels multiplied by 256 bytes for each channel, 5888 = 256+22 x 256. The detailed information for the channels is shown below. Figure 2-5: The label of each channel of EDF file in MATLAB The Labels contains the label of each signal in each channel, in this EDF file it contains 2 ECG signals, HR, SaO2, Cannula Flow, Airflow, 7 EEG signals. 17 Figure 2-6: The TransType of each channel of EDF file in MATLAB The Info.ChInfo.transtype contains the source of each channel. For instance, the ECG L signal and ECG R signal are coming from ECG. Figure 2-7: The Unit of each signal of EDF file in MATLAB 18 The Info.ChInfo.PhyDim includes the physical units of all signals. Combined with Physical Min and Max, Dimension Min and Max, we could compute the actual value of each corresponding signal. Figure 2-8: The Physical Min of each signal of EDF file in MATLAB Figure 2-9: The Physical Max of each signal of EDF file in MATLAB 19 Figure 2-10: The Dimension Min of each signal of EDF file in MATLAB Figure 2-11: The Digital Max of each signal of EDF file in MATLAB The physical min and max provides information on the range of the real values for each signal. For example, for the ECG signal, the unit is mV, and the physical minimum and maximum are -1.000 and 1.000. The digital range is from -32767 to 32768, so the actual ECG data (mV) is related according to: ActualData = 20 EDFData/2^15. Table 2-1 : Physical Min and Max, Digital Min and Max Digital Min Digital Max Physical Min Physical Max Unit ECGL -32768 32767 -1.00000 1.0 uV ECGR -32768 32767 -1.00000 1.0 uV HR -32768 32767 0 200.0000 BPM Airflow -32768 32767 -1.000000 1.00 uV SaO2 -32768 32767 0 100.00 % Cannula Flow -32768 32767 -0.50000 0.5000 V Figure 2-12: The number of samples in each data record of EDF file in MATLAB The number of samples (ns) in each data record along with the signal duration (e.g. 1 second) provides information for computing the sampling rate of each signal. 21 3 The Bedside Patient Monitor 3.1 Introduction The bedside monitor can operate in two modes, using archived or real-time data. In this chapter, we discuss operation of the bedside monitor using data archived in EDF. We begin by discussing the major components of the GUI. Specifically, the three main components consist of Patient Identification, Time information, data information. The data information includes data input, data selection, data display. There are a variety of different ways to select data for visualization and analysis including edit boxes, pop-up menus, radio buttons, and button groups. After comparison among these choices, button groups and pop-up menus were chosen. Next we need to decide on the format for data visualization including waveform (time series) and numeric data, as well as how the data is annotated to make it easier to understand and interpret by the user. A key feature of the bedside monitor is to support analytic computations that transform the data to actionable information for patient care at the bedside. Conventional numeric information is displayed, along with other statistical and trend information like mean and standard deviation over selectable time windows. Statistical computations such as the mean value and standard deviation can help physicians have a better understanding of variations in patient data. Finally, we will discuss some innovative ideas for the display, including the Poincare´plot, and of histograms that provide a way to visualize the relationship between two different data sources. 3.2 Components of the GUI The GUI components of ICU bedside monitor includes three parts: Patient Identification, Time Information (actual time), and Data Information including data 22 selection, plotting, setting time, data values, etc. The patient ID and time information are very basic and important components of the ICU bedside system and the data information is essential for visualization and analytic applications. The data information can also be grouped into three parts: data input, data selection, and data display. For archived applications the data input is the source file, (EDF) and for real-time applications the data input is the data packets that are received from the patient monitor and devices in the ICU. For data selection, there are many ways in MATLAB for users to select the data they want. However, it is not easy to find the best way for users to choose data. We will discuss this in 3.3. In addition, for the GUI of the ICU, the basic idea is to efficiently show as much data and useful information as possible to the users. How to display the data in a more comprehensive way is a challenge for the next generation ICU bedside monitors. Basically, we separate the data display component into 4 parts, plotting, setting time, information display, and advanced features. All of these will be discussed in the remainder of this chapter. 3.3 Data Selection There are many ways in the MATLAB for users to select data. Mainly, edit text, checkbox, radio button, pop-up menu, list box, table, and button group are all possible options. The method for data selection should be convenient for all clinical personnel who will be interacting with the ICU patient at the bedside. We also need to consider the range of possible information that may useful to physicians for patient care, so we should also provide a comprehensive selection for all types of data with supporting analytics. Although the radio button, checkbox, button group are similar, the button group is designed for a group of radio buttons and it is more convenient to the use button group for comprehensive data selection. On the other hand, we need also need to find the most convenient way to the select data we want, so we choose the pop-up menu. Finally, we decided to use both the button group and pop-up menu for data selection. 23 3.4 Plotting Plotting is one of the main components of any interface, and is the most direct way to show data and information to users. Due to the large amount of numeric and waveform data, it is difficult to find a way to present all the data that is available. So, our goal is to find a suitable method to display useful data and analytic information to users. Waveform signals such as ECG, EEG consume large amounts of storage, several hours data could be hundreds of megabytes, so we need to consider every possibility to accelerate the speed of accessing and plotting archived data. MATLAB, provides both scatter and plot functions. But if we look into both of them, we find that plot is usually to plot lines that slow down the speed, so in this situation we decide to use the scatter plot option. To present more details about the data, we add ‘legend’ function into our code to show the color and time range of the data. Another problem is that the ‘legend’ function is time consuming. The average time for each call of the ‘legend’ function is almost two seconds. To solve this problem, we directly change the attributes of the GUI so that we only need to call the legend function at initialization. In addition, the ‘linspace’ function has been used to generate linearly spaced vectors that can define gradual changes of color. Gradual color changes of data points can be used to represent different time windows in which the data was collected, thereby providing a visually intuitive way of comparing different data characteristics during distinct time periods. In this way, users could see the trend of data through the changes in color, which should have a profound influence on bedside data interpretation and analysis. Also, in order to increase the utility of the bedside display for clinical personnel for the analysis of patient status, we provide a comparison window where 3 one-minute epochs of data can be visualized simultaneously. This will assist in decision support at the bedside where significant changes data epochs over time, can be more easily quantified. 24 3.5 Setting time From Chapter 2, the EDF header contains information on start date and start time of the data recording. With these information, we could set the time period of the file, and then the start and end times could be computed directly (add the number of records multiplied by the duration of each record to the start time). Another problem for setting the time is that it may be necessary to determine the exact time associated with a given data point, or different sets of patient data. We use a slider to the user in selecting the time points of interest. The slider can directly be moved to see trends in the data, and if there are specific features of interest, they can be identified quickly and easily to support clinical decision-making. Also, add an edit text tool for users to input an exact time point that may be of interest. The combination of slider and edit box improves the flexibility and usability of the interface. 3.6 Information extraction and display After we setup the data selection, time setting, and plotting, the analytic information to be extracted and displayed needs to be determined. Conventional patient monitors show waveforms and numerics, and these are also incorporated as a basic feature of our bedside display. As new innovative features of a bedside display, we also need to display patient information extracted from univariate and multivariate data that support clinical decision-making. Simple statistics, such as the mean value of data, can be very useful for a first glimpse of tends in data. Widely used ICU monitors such as Philips Intellivue and Spacelabs, are not able to provide the mean value of any data stream to a user. This is a significant disadvantage of these monitors. The mean value can be useful both for clinical decision-making as well as alarm processing. Additional computations, such as the standard deviation (SD) can also provide useful clinical information as the variability in a physiological variable (compared to its mean trend) over given periods of time. A low SD indicates that the data points tend to be very close to the mean 25 value, and a high SD indicate that the data points are spread over a large range of values. Specifically, if the mean value of patient heart rate is 110 bpm, but the SD is 20, that potentially is an indicator of an unstable situation. Note, it is also important the ability to visualize a histogram of the data to understand the context in which to interpret the SD. The SD of a time series over a window of N points is calculated by the formula: 1 [(x1 )2 (x 2 )2 (x N )2 ] N Where, is the standard deviation, is the mean value of data The bedside monitor includes computations of the mean and standard deviation for x-axis and y-axis data. 3.7 Advanced features The ideas and improvements we discussed above are basic improvements, and the next generation bedside monitors needs to have options for extracting more analytic information from the available data. As an initial starting point for our developments, we integrate the calculations and display for Poincare´and Histogram analysis. 3.7.1 Poincare´analysis The Poincare´plot, as an approach to measure Heart Rate Variability (HRV), is a scatter plot of the current R-R interval plotted against the preceding R-R interval. Specifically, it is the plot of Heart Beat vs. Heart Beat + 1 sample delay. The Poincare´plot is also referred to as a scattergram, return or phase delay map, and Lorenz plot. Poincare´plot analysis is a simple quantitative technique compared to more conventional computations such as the fast Fourier transform (FFT) [5], [6]. The Poincare´plot for HRV presents both summary information of the heart rate and details of the behavior of instantaneous beat-to-beat variability [7]. Points above the line of identity are R-R intervals that are longer than the preceding R-R interval. On 26 the contrast, the points below the line of identity indicate R-R intervals shorter than the previous. Usually, the Poincare´plot looks like an ellipse. Thus, the dispersion of point’s perpendicular to the line of identity reflects the level of variability along the minor axis, and the points along the line of identity represents the variability along the major axis [8]. To quantify the geometry of the Poincare´plot, we use model in Tulppo et al [9] by defining two standard descriptors of the plot, SD1C and SD2C, that are measures of the minor axis and major axis of the ellipse. The description of SD1C and SD2C given by Brennan et al [10] shows that these standard descriptors guide the visual inspection of the distribution. The Poincare´plot represents useful information of R-R interval data by presenting the variations over both short and long time intervals [9] [10]. SD1C stands for the Standard Deviation of the short-term variability of the data and SD2C represents the Standard Deviation of long-term variability. The point where both axes intersect is the total mean of the R-R intervals. Figure 3-1 shows the Poincare´plot for HRV of a normal person. 27 Figure 3-1: Poincare plot for a normal person In conclusion, the Poincare´plot of HR is a scatter plot that represents the current R-R interval against the next R-R interval (+ 1 sample), and can be easily extended to other times series data, e.g. as respiratory data. This will be illustrated in Chapter 4. 3.7.2 Histogram The Histogram is not a new idea for visualizing the distributional characteristics of univariate time series data. We provide this functionality along with the ability to investigate the interrelationship between two time series using a “conditional” histogram. The basic idea for the conditional histogram is to define a range of data for one 28 time series data, and then according to the time windows that are associated with this range find the relevant data of another time series at these corresponding time points. Then build a histogram that combines the information of the two different time series data. For example, if we set the limits for Heart Rate from 80 – 120 bpm, then in the time period (1-minute by default), we could find all the heart rate (R-points) that correspond to HR from 80-120. According to the index of the associated R-R intervals, we could also find the corresponding values of SaO2 when HR is in the indicated range. The histogram will show the range of SaO2 when the HR is from 80-120 during this period. The heights of the bins of the histogram indicate the distribution of SaO2. In conclusion, we extend the histogram concept to combine two different timer series data for display and analysis. This could be a very useful tool for determining the interrelationship between physiological data streams, and providing “correlative” information that would be very difficult to extract in any other way. In our current implementation, the conditional histogram is limited to instantaneous heartbeat and SaO2 because these data have the same sampling rate. Future work will develop algorithms that can be used for data streams with different sampling rate. The sampling rate of different signals is listed in appendix. 29 4 GUI development 4.1 Introduction In Chapter 2 and Chapter 3, we discussed the structure of the data source file and the basic idea of the GUI design for the ICU. In this Chapter, we will build a fully functional GUI for the ICU in the MATLAB. To begin the design, we will first build a basic frame for the GUI. The prior work about the data processing will be done before we build the GUI. Details about the file loading and seeking corresponding data points will be illustrated. EDF file attributes such as Physical Min, Physical Max, Digital Min, Digital Max, are needed to properly display and analyze the data in the bedside monitor GUI. The data selection part is created by adding two panels to fit the radio button group for the data selection by users. The signals include Airflow, Cannula flow, ECGL, ECGR, HR, and SaO2. Others can be easily added in the future. The time selection for x-axis is added to provide a convenient method for visualizing trend data. Also, two static text boxes are added next to the button group to more directly show the label of selected signals. Next, plot and time setting will be discussed together. The legend function will be used to show the details of each signal. Slider and time point input have been developed for users to both conveniently change the time and choose an exact desired time point. In addition, GAP1 and GAP2 parameters are introduced so that users can change the time interval between each period of data. Now, users could choose three separate time period of data to show on the plot. Also, users are able to change the length of the time period by changing the Window Length. This provides a more flexible method for users to choose the best time period for different data. Additionally, the “data cursor” function is implemented to show the time of an event and exact value for a certain point by clicking on the figure. Then, we add the information part for various analytic computations. Average 30 value of x-axis and y-axis data, and standard deviation of each axis data are calculated. Furthermore, we compute the average distance of each point to the central point of each cluster and calculate the standard deviation of these distances. Thus, we could provide measures of variability for different types of data. The respiration rate is detected by setting a threshold for the cannula waveform flow. Some abnormal situations are discussed for low respiration rates. Finally, we add advanced data analytics and visualization capability to the GUI. The Poincare´ plot is developed to provide one approach to visualizing and quantifying variability in time series data. SD1C and SD2C measuring the standard deviation along the minor axis and major axis of the data are calculated. Moreover, low frequency power and high frequency power for R-R interval time series data are also computed. The histogram and conditional histogram are used to show the distribution of signals and combinations of signals. The synchronization of data sources will also be discussed. 4.2 Related Prior Work 4.2.1 Development environment The innovation GUI discussed in this chapter is developed with MATLAB, version R2012b. The environment of the computer for this project is on Windows 7 Premier Service Pack 1 with Interl(R) Core(TM) i5-2520M CPU @2.50G Hz and 16 GB memory, 64 bit OS. 4.2.2 Frame Design Based on the concept indicated in Chapter 3, we design a simplified frame to guide our design. and we test the functionality with basic .xls files that only contain several hundred Kb of data. Figure 4-1 shows the basic frame design. 31 Figure 4-1: Simplified frame of innovation GUI In this frame, we display the patient name on the top left for identification, and we use a static text box to show the current time on the top right of the display. There are two panels at the bottom and left hand side of the interface for the button group for data selection for both x-axis data and y-axis data. Also, when users choose one kind of data in the panel, the data they choose will be shown in the static text next to the panel. The plot display includes three different colors of data to show three one -minute epochs of data simultaneously for comparison. We also add time point selection and a slider to both conveniently and exactly change the time to show the difference between signals. Finally, we add regular data comparison part different combinations of signals can be chosen, this will be the very convenient for users. Additional advanced features will be discussed in the next chapter 4.2.3 Data processing Archived clinical data is stored in EDF format and each file will contain 24 hours of data, and will be hundreds of megabytes in size. In previous tests, our algorithm transformed the .xls file into .mat file before the data was loaded to increase the speed. The .mat format is a binary file format for storing variables in MATLAB. Converting data to this format can improve the speed of accessing the data in the MATLAB 32 environment. For large data files, like the EDF of interest in this work, this speed improvement may not be realized because of the time it would take to convert EDF to .mat format. Therefore, we read the EDF data directly by opening the file and reading the relevant data corresponding to the selected time and signal specifications by the user. Header information for the EDF is obtained using the algorithm developed Dr. Farhad Kaffashi. According to Figure 2-4, the number of signals is 22, and the number of bytes in header record is 5888. Also, figure 2-4 indicates that the number of data records is 38610 and the duration of the data record is 1 second. Based on these two parameters, the total time range of the data is 38610 seconds = 10.725 hours = 10 hours 43 minutes 30 seconds. Since the start time is 18:05:04, the end time is 04:48:34. For the data records, with the duration of each record equal to 1 second, the sampling rate of each signal can be obtained from nr, see table 4-1. Table 4-2 : Physical Min and Max, Digital Min and Max Signals Sampling Rate Position 4 Leg L 64 Leg R 64 C3 256 C4 256 A1 256 A2 256 ROC 256 LOC 256 ECG L 512 ECG R 512 L Chin 256 R Chin 256 Airflow 16 SUM 16 Thoracic 16 Abdominal 16 STAT 1 HR 1 SaO2 1 Cannula Flow 64 DHR 512 33 From Figure 2-4, we know the number of samples in each record is 3847 and since all of them are double format, we need to multiply 2 to compute the number of bytes for the data records. To compute the number of byte we need to skip to find the right point for each signal. Here Skipbyte = Bytes of header record + samples of each data record * 2 * (Seconds). In this way, we can find the corresponding data in the file. The Skipbyte algorithm is given below: The loop runs 5 times, first, we define the pointer pointing to the address of the file, then we set different skip bytes for every time, finally, we use fseek to find the address of the file and then skip the relevant bytes we want to find the data of relevant signals. The ‘bof’ means to set the beginning point of a file as the reference point. Specifically, there are 5 different skip bytes in this loop, all of them are for data preparation for the GUI. The Info.FileInfo.HeaderNumBytes and sum(Info.ChInfo.nr) stand for the bytes of the header record and each data record, respectively. The first three iterations of the loop are used to store the position of current time point data and 2 consecutive one-minute data epochs after the current time. With these data, we can display 3 one-minute data in a row for comparison. The fourth iteration stores the position of ‘delay’ seconds after the current time. This provides the information for 34 evaluating signal trend changes. The last iteration stores the position of one byte after the current data. The Poincare´plot needs the current data and preceding data for computations. Data needs to be extracted properly from the EDF to be useful, and this requires using information like the physical limits and digital limits from the EDF header. For example, for the ECGL, the physical limits and digital limits are -1 to 1, and -32768 to 32767. So, the real data of ECGL should be ECGL (from EDF) * 2 /2^16. The following algorithm does the conversion to properly interpret the data: Where, Index defines the position of each channel in each data record, and fread(fid,[sum(Info.ChInfo.nr) WindowLen], ’int16’ means to read data with the size of the matrix: ‘sum(Info.ChInfo.nr)’ rows and ‘WindowLen’ columns. After all this processing, DataECGL{i} is the data we need. All the other signals are the same except the Heart Rate. The heart rate from the EDF file is the consecutive heart rate that has been averaged over a fixed data window, e.g. one minute. Our goal for bedside ICU applications is to show more accurate and useful data, so we would like to use the instantaneous heart rate that is determined by the R-R intervals extracted from the raw ECG signals, instead of the low resolution consecutive heart rate from EDF file. Specifically, the algorithm is shown below: In the algorithm, first, we detect heartbeats (R-points) from the ECG signal and save the index of each event with the function DetectR developed by Dr. Farhad 35 Kaffashi. Then we compute the total time and time interval between each event by dividing by the sampling rate. Finally we calculate the instantaneous heart rate by 60/time interval between each event. The HR_R{i} is the final data. 4.3 Realization of the GUI 4.3.1 Data Selection As discussed in Chapter 3, the GUI has two panels to fit the radio button group for channel selection. In this way, users could select the data they need from the radio buttons. Simultaneously, static text next to the panels will show the label of the signals that are chosen. Thus, users could more directly and clearly see which channels they have selected. In the GUI, we block the selection for EEG signals and some other channels that are not important, this can be easily modified in future versions. In the current version of the GUI for illustrative purposes, the available channels are: Airflow, Cannula Flow, ECG L, ECG R, Heart Rate, and SaO2. Users could select any two of them to display simultaneously. Two examples are shown in Figure 4-2 and Figure 4-3: Figure 4-2: Data Selection for ECGL vs. ECGR 36 Figure 4-3: Data selection for HR vs. Cannula Flow Figure 4-2 and Figure 4-3 show 2 combinations of data selection: ECGL vs. ECGR, and HR vs. Cannula Flow. We could clearly see the data selection in the panels and static text boxes. Time selection for the x-axis has been added so users can choose Time selection for the x-axis to display Time vs. data. The x-axis will be 0 to 60 seconds and the y-axis indicates the value of data at the relevant time points. Figure 4-4 shows the combination of Time vs. Cannula Flow. Figure 4-4: Time vs. Cannula Flow 37 From Figure 4-4, we see there is variability in the signals and the range of variability is increasing with increasing time. We also include a pop-up menu for users to directly choose the most common data comparisons, particular combination include ECG L vs. ECG R, ECG R vs. ECG L, HR vs. SaO2, and SaO2 vs. HR. These choices will help users quickly select the data they want, Figure 4-5 illustrates this aspect of the GUI. Figure 4-5: Regular Data Comparison In conclusion, for data selection we provided radio button group for choosing two channels based on user preference and a pop-up menu for preselected comparisons. Time selection for the x-axis is included for trend data. 4.3.2 Data plotting and time selection Time series data display through plotting is the core of the GUI. Users are able to clearly get information from the data plots, users can choose two channels for x- axis data and y-axis data, and can select the exact time point for the figure. The plot creation plot is shown in Figure 4-6. 38 Figure 4-6: Legend of plot In Figure 4-6, we could clearly see there are three different colors of data, green points, yellow points, and red points. Each color stands for different period of time for different data. On the top right corner, we use the legend function to present a form that includes the detail time range for each color data. The green data is data from the current time window, with yellow and red from two consecutive 1-minute epochs after the current time period as the default. Users can set the time interval between green and yellow and yellow and red data as shown in Figure 4-7 for ECGL vs. HR. Apparently in Figure 4-7, we could see the time range for each signal has been changed due to the settings of Time Gap1 and Time Gap2. The green data remains the same time but for yellow one, it’s from 19:14:25 to 19:15:25. And for red one, it’s from 19:24:25 to 19:25:25. There do exist a possibility that a patient bear a sudden heart attack in the second data period, but totally normal in period 1 and 3. So, with the help of this method, physicians could analyze the difference among 3 separate time data. 39 Figure 4-7: Time Gap1 and Time Gap2 to change the time interval between each data In addition, we also allow users to change the data length of each period by changing the value of WindowLen. This change offers a convenient way for users to analyze different data due to different data length requirements. Specifically, 60 seconds maybe a suitable time period for the SaO2 signal since the sampling rate of SaO2 is 1 per second and the signal itself is usually very steady. However, for the heart rate, sometimes 60 seconds of data is not enough to clarify the status of a patient. 300 seconds of data may be a better choice to get a better picture of patient status, so WindowLen can be used to change the data length of each period. Figure 4-8 illustrates this feature in the GUI. From Figure 4-8, we observe sthat by setting the Window Length to 300-seconds, the data details shown in legend have also changed. The range of each data has increased from 1 minute to 5 minutes. Also, we have already finished the development of time point selection using both the slider and time input functionality that has been included in the GUI, allowing users to select any time point they are interested in to see different signals form the patient. 40 Figure 4-8: Change the Data Length of each period by setting WindowLength As we discussed in Chapter 3, the scatter plot is faster than plot, however, in order to change the linestyle of the figure to show Time vs. data plot, we have to use plot instead of scatter. Also because the size of data is too large, we do not use linspace to gradually change the color. The large variety of color changes blur the figure which is opposite to our original goal to more clearly show accurate and useful data to the users. Finally, we add a function similar to the data cursor. We can find the exact time of each event by directly clicking on a certain point in the plot, the event time will display next to the point. This function is a significant improvement for the study of abnormal points. This is particularly useful in the ICU setting, where patient stability if an important consideration. There will be many abnormal points in ta given figure, so it is important that each abnormal event can be identified and associated with a given point in time. Our goal is to develop a flexible interface that can be used to capture every possible sign that may help clinical personnel make decisions. The functionality would like to add is finding the nearest data point to the current point in a given time series. The approach is to find the smallest distance between the selected point and our data, the detail of algorithm is shown below: 41 First, we need to find the x value and y value of current point by Clickpoint = get(handles.axes1,’CurrentPoint’). Then, we initialize the Minimum distance, and try to find the nearest point in each color data. Next, we make the decision among the three nearest points in each color by [~,I] = min(Mmin). Finally, we set the time of the point according to where we find the nearest point and display it. In conclusion, we developed the plot and time selection functionality for the GUI. The legend function has been added to show the detail of each color data. The Time gap and Window Length provide users with the ability to change the time interval between each color data and the data length of each period. Slider and time inputs are also created for users to choose exact time points of interest. Finally, displaying data and the exact time of certain events by clicking any point of the figure has also been included in the GUI. 4.3.3 Additional features After creating the basic data display for the GUI, the analytic information is the next step. In Chapter 3, we discussed that most widely used monitors such as Philips and Spacelabs don’t even have the ability to calculate and display simple statistics such as the mean value of data time series over a given period of time. Figure 4-9 42 shows the detail about the statistical information available in the GUI. Figure 4-9: Information of Mean value and Standard Deviation of x axis and y axis From Figure 4-9, we observe that there are 6 columns and 3 rows for the table. Each row stands for one period of data. For the first column and third column represent the mean value of x-axis and y-axis data, fox example we see the mean values of SaO2 are 91, 90, and 91 and the mean values of Heart Rate are 113, 121, and 122. However, the mean values alone are insufficient since the variability of the signals could be clinically meaningful. Thus, we also compute the standard deviation of the x-axis data and y-axis data. The standard deviation of SaO2 is 0.63, 1.3, and 0.9, and the standard deviation for Heart Rate is 12.1, 18.8, and 22.6. In addition to the ideas we raised in Chapter 3, we also calculate the mean distance of each point to the central point of each cluster. First, we get the value of the central point of each cluster c(xcentral,ycentral), then we compute the distance of each point to the central point and calculate the mean value of these distances. The standard deviation of the distances is also computed to show the variability of the data. To illustrate this idea more clearly, we add three check box to control the display of each cluster. In this way, we could present three clusters of data separately. Figure 4-10 shows an example if we only choose the red cluster. 43 Figure 4-10: Mean value of Distance, SD of Distance, and cluster selection From Figure 4-10, if we only choose the red cluster in the check box, only display the red period data is displayed and the SD of distances indicates the variability of data. The algorithm is shown below: HH and VV are the mean values of the x-axis and y-axis data. Then we compute the distance of each point to the central point DD(j) and get the mean value of these 44 distances DavgDavg = mean(DD), finally we calculate the standard deviation of the distances. Data selection for Time vs. data could be used to represent the data trend. Next we discuss to detect the respiration rate by using Cannula Flow time series data. The Time vs. Cannula Flow is shown in Figure 4-11: Figure 4-11: Detect Respiration rate by setting a threshold for Time vs. Cannula Flow The signal oscillates with each breath. Thus, we set a threshold at 0.012 for the Cannula Flow to identify individual breathes for a patient. However, one limit is not enough to precisely find the respiration rate, small variations in the data may cause many artificial breathes to be detected. So, in our algorithm, we first find the points over 0.012 and also confirm it is a candidate breath by comparing to the next point with 0.012 as well, if it is also larger than 0.012, it’s a real breath, if not is rejected. The detail of the algorithm is shown below: 45 We need to count the how many times the patient breathed in the period, store the indices where the events happen, save the time intervals, and compute the Respiration Rate. Sometimes the respiratory signal is very noisy and it is not possible to calculate the respiration rate, figure 4-12 is an example of this situation. Figure 4-12: Abnormal Respiration Rate, the value of Cannula flow is too low 46 From Figure 4-12, the Respiration Rate at the bottom right corner is 0 because it was not possible to detect any respiratory events. If we examine the data more carefully, we could find that the value of Cannula flow is less than 10 x 10-4 and we the so-called “signal” in the figure is simply noise because the Cannula Flow is too low to be meaningful. In conclusion, we compute the mean value of x-axis and y-axis data, we calculate the mean distance of each point to the central point of data clusters, the standard deviation is used to measure the variability of the data computed, and we detect the respiration rate directly from the Cannula Flow. 4.3.4 Poincare´Plot and Histogram Additional information that might be clinically meaningful and useful can be extracted from patient time series. For example, the Poincare´can be used to quantify heart rate variability, and (conditional) histogram is a new idea to quantify the relationship between two different kinds of data. 4.3.4.1 Poincare´Analysis The Poincare´plot is a scatterplot of current R-R interval against the preceding R-R interval, and Figure 4-13, shows the scatterplot of heart rate. 47 Figure 4-13: Poincare´Plot of Heart Rate At the bottom left corner, we provide a check box for Poincare´plot selection, and an edit text box for the user to input the samples of delay. The delay is 1 sample by default and users can change the delay by selecting a different value. The Poincare´ plot presents both short- and long-term variability of the signal. A normal HRV Poincare´plot looks like an ellipse (Figure 3-1), unlike Figure 4-13. The significant short-term variability in heart rate as shown in Figure 4-13, is an indicator of abnormal behavior. Computing SD1C and SD2C, short-term and long-term variability respectively, owe have SD1C=15.72 and SD2C=15.90. Additional measures of interest include frequency domain features such as spectral density, coherence, etc. Because the R-beat time series is not uniformly sampled, we cannot calculate the FFT directly using MATLAB. Instead, we use the Lomb-Scargle method [11] that performs spectral analysis on unevenly sampled data. With the Lomb-Scargle algorithm, we calculate the normalized magnitude and frequency of R-R intervals in frequency domain. There are three main HRV spectral components distinguished in a spectrum computed from 2 to 5 minutes (short-term) recordings [12] [13]: very low frequency (VLF) , low frequency (LF), and high frequency (HF) components. The distribution of the power and the central frequency of LF and HF are not fixed but may vary according to the change in autonomic modulations of the heart period [14]. The VLF component lacks persuasive 48 physiological explanations and the existence of a specific physiological process supporting these heart period changes may not be reliable. Thus we do not consider the VLF as one of the components in our analysis. Measurement of VLF, LF and HF power components is usually made in absolute values of power, but LF and HF can also be normalized to represent the relative value of each power component in proportion to the total power minus VLF component [15]. The representation of LF and HF in normalized units stresses the controlled and balanced behavior of the two branches of the autonomic nervous system. Furthermore, normalization would minimize the effect on the values of the LF and HF components to changes in total power. However, normalized units should always be quoted with absolute values of LF and HF power in order to describe the total distribution of power in the spectral components. The range of LF is from 0.04 to 0.15 Hz, and HF is from 0.15 to 0.4 Hz. The following algorithm shows how we calculate the LF and HF powers: We compute the low frequency power (LFP) and high frequency power (HFP) with the FASPER algorithm. The WK1 and WK2 stores the frequency of each heart beat in the frequency domain and the magnitude of the corresponding frequency. We 49 need to find all the heart beats in the low frequency range and the high frequency range first. Then compute the mean value of their magnitude and those are the LFP and HFP we need. In Figure 4-14, it shows we compute LFP =3.26, HF=3.29. Figure 4-14: Low Frequency Power and High Frequency Power of the Heart Beat All these attributes help us quantify the variation and connection between R-R intervals. Additionally, we use the Poincare´plot to investigate respiratory variability in Figure 4-15. Figure 4-15: Poincare´plot: Respiration Rate vs. Respiration Rate (1 sample) 50 Users can select Cannula Flow for the x- and y-axis channels, and the Poincare´ plot for Respiration Rate will display. 4.3.4.2 Histogram As we discussed in Chapter 3, the conditional histogram shows the distribution of one signal corresponding to a certain range of another in a given Window Length period. Specifically, Figure 4-16 shows the histogram of SaO2 vs. Heart Rate: Figure 4-16: Histogram for SaO2 vs. HR In this figure, users input the high limit 95 and low limit 80 for the SaO2. Correspondingly, the figure shows the distribution of the HR when the SaO2 is from 80 to 95 in the time period 9:09:25 to 19:10:25. With SaO2 in the range 90 to 95, the heart rate varies from 66 to 142. The height of each bin represents the number of times a given heart rate occurs in the corresponding range. Specifically, in this figure, we see that when the SaO2 is from 90 to 95, heart rate is mainly between 100 ~ 120 bpm. From 100 to 120, it happens 15+13+12=40 times. This method combines setting a range for one type data and then showing the corresponding distribution of another type of data. This provides an effective way to see connections and explore 51 interactions between two relevant data sets. Compared with Figure 4-17 which shows the original figure of SaO2 vs. HR, the conditional histogram additional, complementary information: Figure 4-17: Conventional SaO2 vs. HR scatterplot Also, if we choose the same signal on both sides, it will display the histogram of one signal. Figure 4-18 gives an example of the histogram of SaO2 vs. SaO2, which represents the histogram of one signal: Figure 4-18: Histogram of SaO2 vs. SaO2 52 The realization for the histogram algorithm is not complicated, but there is one point we need to emphasize. In the histogram computation, we seek the corresponding data by searching the relevant index of each signal. This is straightforward if the sampling rate of the two signals is the same. However, the heart rate we use here is the instantaneous R-R interval we detect from ECG signals. Not only the time interval of each beat is not normalized, but also the sampling rate is not fixed since the time interval between each beat is different. The sampling rate of consecutive heart rate from the EDF file is 1 per second which is the same as SaO2. Nevertheless, to avoid a decrease in resolution, we develop our own algorithm to synchronize two different data. The basic idea of the algorithm is, although the time interval is different for each heartbeat, we still could average the heart rate in each second. We separate the heart beats second by second and then compute the mean value of each second. Finally we obtain synchronized heart rate data that is used to plot the conditional histogram of HR vs. SaO2. In conclusion, in this Chapter, we developed the Poincare´ and Conditional Histogram plots for the ICU display. For the Poincare´plot, we described the role of SD1C and SD2C in quantifying the standard deviation of short-term and long-term variability of the data. We also added an edit text box for users to input the sample delay based on their preference. In addition, we implemented the Lomb-Scargle method to perform spectral analysis for unevenly sampled time series data, and used this approach to compute Low frequency power and high frequency power for HRV analysis. For the histogram, we added two edit text boxes for users to choose the limits of one signal. And when users select the check box of histogram, it will display the histogram instead of conventional plot. The data source of heart rate is discussed, and the function to show the distribution of one signal corresponding to the relevant range of the other signal is implemented. Due to the limitation of sampling rate, this function is currently available for only HR and SaO2. The synchronization work will be extended so that the analysis can be applied to additional time series data. 53 54 5 Real-Time Analysis Mode 5.1 Introduction In Chapter 4, designed and implemented an ICU bedside display that includes analytical computations and visualization using archived EDF data. In this Chapter, we design the real-time display mode for the system. To illustrate the basic concepts of the Real-Time Analysis mode, we will limit our work to the display of two ECG signals. The figure will refresh every 10 seconds to show the most recent 10 seconds of data from the patient monitor. Correspondingly, Instantaneously Heart Rate will be detected and the Standard Deviation of Heart Rate will be computed. Simultaneously, important parameters for Poincare´plot analysis such as SD1C, SD2C, Low Frequency Power, and High Frequency Power will also be updated. In addition, users are able to save the parsed data into a file. We also add the path selection for users to choose the path where they want to save the data. When users want to stop the real-time display, they can press the stop button. Finally, we add a checkbox to realize the switch between Analytic mode and Real-Time Analysis mode, in this way, users are able to monitor the current status of the patient, but also able to analyze the status of the patient us archived data. At last, future work about this project will be discussed. 5.2 Realization of Real-Time Analysis Mode As we discussed in the introduction, we are going to show two different ECG signals in the plot and update all the analytic information every 10 seconds with the figure. Also, we need to offer the option for users to choose the path and name of the file which is going to save the data. Finally, we need to be able to switch between Analytic mode and Real-Time Analysis mode. 55 According to these requirements, we add two push buttons, ‘start’, and ‘Set the Path’ for users to choose their path and start the program. We also add two checkboxes, ‘Stop’, and ‘Analytic mode’, for users to stop the data loading and switch between the two modes. To start the program, first, users need to press the ‘Set the Path’ button to input a name and select the path for the file they are going to save. Figure 5-1 shows the window when users click the button ‘Set the Path’: Figure 5-1: Set the Path selection for users As Figure 5-1 shows, when users click ‘Set the Path’, they are able to select the path of the file they want to save the data to. Also, users could input the name of the file. The data which is saved in the file is the parsed data from the raw data file. It only records the value of ECG signals. Later, we could use the data in the file to compute instantaneous HR, Standard Deviation, SD1C, SD2C, LFP, HFP. After selecting the path for the file, users could start the program by clicking the ‘Start’. Then, in Figure 5-2, it shows ECG(V1), and ECG(LL) in the plot: 56 Figure 5-2: Real Time Display of ECG(V1) and ECG(LL) signals(Ideal) From Figure 5-2, we could clearly see the two different ECG signals displaying in the plot. And the figure will refresh every 10 seconds. For illustrative purposes, the raw data we use is from the demo mode of the Philips Intellivue MP5 monitor, so there is essentially no change in heart rate. There are some artificial points from the demo mode, so we could illustrate the functionality of the standard deviation, SD1C, SD2C, LFP, HFP for the data shown in Figure 5-3: Figure 5-3: Real Time Display of ECG(V1) and ECG(LL) signals (with Artificial Points) The real-time analysis mode shows the current status of the patient, and we need 57 to be able to switch to Analytic mode to select other patient data for further study and analysis. In this situation, we add a checkbox ‘Analytic mode’ for users to select switching between modes as shown in Figure 5-4 below: Figure 5-4: Switch to Analytic mode, ECGR vs. ECGL Also, another example of Analytic mode is shown in Figure 5-5, HR vs. ECGR: Figure 5-5: Analytic mode, HR vs. ECGR Also, users should be able to switch back to the Real-Time Analysis mode. By clicking the ‘Analytic mode’ again, it will switch back to the Real-Time Analysis 58 mode as shown in Figure 5-6: Figure 5-6: Switch Back to Real Time Analysis mode Finally, users could stop the program by clicking ‘Stop’. The program will stop loading the data and close the file as shown in Figure 5-7: Figure 5-7: Stop the program Figure 5-8 shows that we have successfully saved the data into a file. 59 Figure 5-8: Saved Data 5.3 Discussion and Future work In this Chapter, we developed the Real-Time Analysis mode for the ICU bedside display and illustrated its functionality using real-time ECG signals to represent the current status of the patient. Also, the analytic information such as instantaneous heart rate, standard deviation, and important parameters for Poincare´ analysis such as SD1C, SD2C, LF Power, HF Power will be updated every 10 seconds with the plot. In addition, combined with the Analytic mode designed in Chapter 4, we realize the switching functionality between Real-Time Analysis mode and Analytic mode. Also, the parsed data of ECG signals will be saved in a file which could be decided by the user. These two modes offer options for ICU personnel to monitor the current status of the patient, and to also have a full access to archived data to improve knowledge of the past status of the patient. All the analytic information and visual presentation of data and analytic results will provide significant information to support clinical decision-making and improve patient care. However, further work needs to be done in the future. The data we get from the monitor is currently limited waveform data, although waveform, numeric and alarm 60 data tare combined in the data packets. We need to extend the capability of the display we designed and implemented in this thesis to accept the numeric and alarm data for both visualization and analysis. We also need to extend the data inputs to include other ICU devices not directly connected to a patient monitor and to extend the Real-Time Analysis mode to include other signals such as Non-invasive blood pressure (NIBP), Oxygen Saturation (SaO2), Respiration, and many others. Additionally, it would be interesting to further explore what additional analytical and visualization techniques can help support clinical decision-making in the ICU, and how would the bedside GUI developed in this work be integrated into the ICU workflow to improve both efficiency and patient care? 61 Appendix Table of Sampling Rate and TransType of Different Signals Signals Sampling Rate TransType Position 4 DC Leg L 64 Leg Leg R 64 Leg C3 256 EEG C3 C4 256 EEG C4 A1 256 EEG A1 A2 256 EEG A2 ROC 256 EEG ROC LOC 256 EEG LOC ECG L 512 ECG ECG R 512 ECG L Chin 256 EEG L Chin R Chin 256 EEG R Chin Airflow 16 HP SUM 16 HP Thoracic 16 HP Abdominal 16 HP STAT 1 Oximeter HR 1 Oximeter SaO2 1 Oximeter Cannula Flow 64 Cannula DHR 512 Off Algorithm of FASPER.m to compute LFP and HFP Thanks to Reza Jamasebi and Ravishankar Balaji who developed this algorithm % This function is to compute the Lomb-Scargle normalized periodogram for % unevenly sampled time series. The algorithm adapted from "Fast algorithm for special analysis of unevenly sampled data" by william H. Press. % Inputs: % X: abscissas or time points % Y: Ordinates or signal values at each data point % Output: % WK1: sequnce of frequncy up to HIFAC times of average Nyquist 62 % Freq. (The defualt values of HIFAC is 1). % Wk2: Values of Lomb Periodogram at each frequency % JMAX: the index of maximum value of WK2 % PROB: a samll value of PROB indicates that a significant % periodic signal is present % Developed By: Reza Jamasebi and Ravishankar Balaji % Last Modified: Feb 26, 2008 function [WK1 WK2 JMAX PROB]=FASPER(X,Y) %times the Average Nyquist Freq. HIFAC=1; %Over Sampling Factor (Typically 4) OFAC=4; % The number of Data points N=length(Y); % Number of Interpolation points per 1/4 cycle of highest frequncy MACC=2; % Size the FFT as next power of 2 above Nyquist Freq. NOUT=.5*OFAC*HIFAC*N; NFREQT=OFAC*HIFAC*N*MACC; NFREQ=64; while NFREQ<NFREQT NFREQ=2*NFREQ; end NDIM=2*NFREQ; AVE_Y=mean(Y); VAR_Y=var(Y); XMIN=min(X); XMAX=max(X); XDIF=range(X); WK1=zeros(1,NDIM); WK2=zeros(1,NDIM); FAC1=NDIM/(XDIF*OFAC); FNDIM=NDIM; YAVE=Y-mean(Y); NFAC=[1 1 2 6 24 120 720 5040 40320 362880]; for j=1:N CK=1+mod((X(j)-XMIN)*FAC1,FNDIM); CKK=1+mod(2*(CK-1),FNDIM); if round(CK)==CK WK1(CK)=WK1(CK)+YAVE(j); else IL0=min(max(floor(CK-.5*MACC+1),1),NDIM-MACC+1); 63 IHI=IL0+MACC-1; NDEN=NFAC(MACC); FAC=CK-IL0; for jj=IL0+1:IHI; FAC=FAC*(CK-jj); end WK1(IHI)= WK1(IHI)+YAVE(j)*FAC/(NDEN*(CK-IHI)); for jj=IHI-1:-1:IL0 NDEN=(NDEN/(jj+1-IL0))*(jj-IHI); WK1(jj)=WK1(jj)+YAVE(j)*FAC/(NDEN*(CK-jj)); end end if round(CKK)==CKK WK2(CKK)=WK2(CKK)+1; else IL0=min(max(floor(CKK-.5*MACC+1),1),NDIM-MACC+1); IHI=IL0+MACC-1; NDEN=NFAC(MACC); FAC=CKK-IL0; for jj=IL0+1:IHI; FAC=FAC*(CKK-jj); end WK2(IHI)= WK2(IHI)+1*FAC/(NDEN*(CKK-IHI)); for jj=IHI-1:-1:IL0 NDEN=(NDEN/(jj+1-IL0))*(jj-IHI); WK2(jj)=WK2(jj)+1*FAC/(NDEN*(CKK-jj)); end end end WK1=abs(fftshift(fft(WK1))); WK2=abs(fftshift(fft(WK2))); WK1=WK1(NFREQ+1:2*NFREQ); WK2=WK2(NFREQ+1:2*NFREQ); DF=1/(XDIF*OFAC); K=3; PMAX=-1; for j=1:NOUT HYPO=sqrt(WK2(K)^2+WK2(K+1)^2); HC2WT=.5*WK2(K)/HYPO; HS2WT=.5*WK2(K+1)/HYPO; CWT=sqrt(.5+HC2WT); SWT=sqrt(.5-HC2WT)*sign(HS2WT); DEN=.5*N+HC2WT*WK2(K)+HS2WT*WK2(K+1); CTERM=(CWT*WK1(K)+SWT*WK1(K+1))^2/DEN; 64 STERM=(CWT*WK1(K)+SWT*WK1(K))^2/(N-DEN); WK1(j)=j*DF; WK2(j)=(CTERM+STERM)/(2*VAR_Y); if (WK2(j)>PMAX) PMAX=WK2(j); JMAX=j; end K=K+2; end EXPY=exp(-PMAX); EFFM=2*NOUT/OFAC; PROB=EFFM*EXPY; if PROB>.01 PROB =1-(1-EXPY)^EFFM; end WK1=2*WK1; WK1=WK1(1:NOUT/2); WK2=WK2(1:NOUT/2); end 65 Bibliography [1] S. Barro, J. Presedo, D. Castro, M. Fernandez-Delgado, S.Farga, M. Lama, J.Vila, “Intelligent Telemonitoring of Critical-Care Patients, A System for Providing Detailed, Real-Time Knowledge Available Any Time From Any Location”, IEEE Engineering In Medicine and Biology, 0739-5175/99 July/August 1999 [2] Michael Imhoff, “Acquisition of ICU data: concepts and demands”, International Journal of Clinical Monitoring and Computing, vol : 9, pp. 229-237 , 1992. [3] Rainer Rohrig, Matthias Benson, Achim Michel-Backofen, Dominik Brammen, Florian Brenck, Kurt Marquardt, Gunter Hempelmann, “Designing a Graphical User Interface for an Intensive Care Unit Patient Data Chart”, Connecting Medical Informatics and Bio-Informatics, pp. 1055, ENMI, 2005 [4] Bob Kemp, Alpo Varri, Agostinho C. Rosa, Kim D. Nielsen and John Gade, “A simple format for exchange of digitized polygraphic recordings”, Electroencephalography and clinical Neurophysiology, no. 82, pp. 391-393, 1992 [5] Mary A. Woo, MN, RN, William G. Stevenson, MD, Debra K. Moser, MN, RN, Robert B. Trelease, PhD, and Ronald M. Harper, PhD. “Patterns of beat-to-beat heart rate variability in advanced heart failure”, American Heart Journal, vol. 123, issue 3. pp. 704-710, March 1992 [6] Mary A. Woo, DNSc, RN, William G.Stevenson, MD, FACC; Debra K. Moser, DNSc, RN; Holly R. Middlekauff, MD, “Complex heart rate variability and serum norepinephrine levels in patients with advanced heart failure”, Journal of the American College of Cardiology (JACC), vol. 23, no. 3, pp. 565-569, March 1. 1994 [7] Kamen P. “Heart rate variability”, Aust Fam Physician 1996; 25: 1087–9, 91–95. [8] Michael Brennan, Marimuthu Palaniswami, Peter Kamen, “Poincare plot interpretation using a physiological model of HRV based on a network of oscillators”, American Jorunal of Physiology – Heart and Circulatory Physiology (AJP), vol. 283, no. H1873-H1886, 1 November 2002 [9] Tulppo MP, Makikallio TH, Takala TE, Seppanen T, Huikuri HV. “Quantitative beat-to-beat analysis of heart rate dynamics during exercise”, Am J Physiol 1996; 271: H244–H252. [10] Brennan M, Palaniswami M, Kamen P. “Do existing measures of Poincare plot 66 geometry reflect nonlinear features of heart rate variability?” IEEE Trans Biomed Eng, 2001; 48: 1342–1347. [11] William H. Press and George B. Rybicki, “FAST ALGORITHM FOR SPECTRAL ANALYSIS OF UNEVENLY SAMPLED DATA", The Astrophysical Journal, 338: 277-280, 1989 March 1 [12] M Malik, JT Bigger, AJ Camm, RE Kleiger, “Heart rate variability: standards of measurement, physiological interpretation, and clinical use”, European Heart Journal, (1996) 17, 354-381 [13] Hirsh JA, Bishop B., “Respiratory sinus arrhythmia in humans; how breathing pattern modulates heart rate.”, Am J Physiol, 1981; 241: H620-9. [14] Pagani M, Lombardi F, Guzzetti S el al. “Power spectral analysis of heart rate and arterial pressure variabilities as a marker of sympatho-vagal interaction in man and conscious dog.” Circ Res, 1986; 59: 178-93. [15] Malliani A, Pagani M, Lombardi F, Cerutti S., “Cardiovascular neural regulation explored in the frequency domain.” Circulation , 1991; 84: 1482-92. 67