although making and using various embodiments are discussed in detail below , it should be appreciated that the present invention provides many inventive concepts that may be embodied in a wide variety of contexts . the specific aspects and embodiments discussed herein are merely illustrative of ways to make and use the invention , and do not limit the scope of the invention . in the description which follows like parts may be marked throughout the specification and drawing with the same reference numerals , respectively . an embodiment of a method of signal processing according to an exemplary embodiment of the present invention is shown in fig1 . ekg measurements are recorded during sleep . the measurements are clipped to 900 seconds 10 . lead i of each ekg signal clip is used to calculate the r - r interval , heart rate , the r - r interval discrete time series is calculated for each clip 20 . the resultant time series is evenly resampled at 10 hz using cubic spline interpolation 30 . short - time discrete fourier transform is performed on each 10 hz sampled data clip generating stdft respective matrices 40 . each stdft matrix is encoded into a grey - level image 50 . a set of nine textural features is calculated for each encoded image 60 . statistical analysis was performed on each of the nine features across the normal and osa patient classes 70 . rules were formulated based on the statistical analysis and the independence of the features 80 . rules were employed in a fuzzy logic system in which the features of each clip were used as inputs 90 . each of the steps illustrated in fig1 will be described in greater detail with reference to a specific example . in this example , the data used to formulate and test the method of signal processing and analysis was previously collected and processed by behbehani , et al . ( behbehani , et al ., conference proceedings , 26th annual international conference of the ieee embs 2004 , pp . 3881 - 3884 ). twelve ( 12 ) normal ( nor ) subject patients were represented in this example . none of them had any known history of sleep disorder breathing , osa , or otherwise . fourteen ( 14 ) patients , previously diagnosed with osa at an accredited sleep evaluation facility were also represented . during the mentioned study , a certified sleep expert , blind to the study , scored sleep disorder breathing events for all subjects , and apnea / hypopnea ( osa / osh ) events were qualitatively described . ekg recordings were made on the 26 individuals , step 10 of fig1 and divided into 900 second clips . finding the r - peaks in the ekg signal defines a discrete time series from which heart rate can be calculated 20 . the overall mean heart rate , r - peak detection error , for the acquired data ( 1 . 78 million beats ) was 1 % ( s . vijendra , master &# 39 ; s thesis , dept . of biomedical engineering , university of texas at arlington , arlington , tex ., 2003 ). from the r - peak detection , each r - peak can be associated with a single value that corresponds to the time interval between that peak and the peak before it . this clearly results in a discrete time series that is unevenly sampled . this time series is evenly resampled at 10 hz with cubic spline interpolation 30 , yielding a 9000 - point heart rate variability ( hrv ) series . there were 198 usable 900 - second clips ; 92 normal clips from nor subjects and 106 event clips from osa subjects . short - time discrete fourier transform ( stdft ) was performed on the hrv equally - spaced discrete time series 40 . a hanning window was used with n = 300 , resulting in 9000 point in time and 1250 in frequency from 0 to 5 hz . since the study of behbehani et al . showed the frequency range of 0 to 0 . 5 hz to be the most promising , only the lower 125 rows of data were included in the stdft matrix . in order to decrease the computational load , without effecting the resolution , the resulting matrix is sampled at every n = 4 points . the stdft complex matrix is reduced to 2250 discrete temporal columns by 125 discrete frequency rows 40 . each clip is now in the form of a 125 × 2250 point complex matrix . each of the 198 complex matrices is then encoded into four different grey - scale images 50 . these matrices are handled as complex valued function of two variables i and j . this allows for conventional matrix processing methods to be applied , or for these matrices to be processed as pictorial images , after converting the complex values of the matrices to grey - level encoded values . note , that color scale values could be used in an alternate embodiment . it is this conversion that enables susbsequent classification ( osa identification in the present example ) to be accurately performed on stdft transformed data clips extracted from temporal signals . in the present example , the temporal signal is heart rate variability , derived from an ekg . however , the same conversion method can be applied to alternate ekg derivations and / or alternate physiological signals . four different grey - scale encoding methods , yielding 4 different images with different features were performed for each of the 198 clips . a first grey scale encoding method , magnitude encoding with 16 grey levels ( n g = 16 ) is described as follows . for encoding purposes , the global maximum and minimum magnitude values of the entire matrix i 125 × 2250 were found . the entire matrix was normalized with respect to i ( m , n ) max . then all values were quantized to 16 equally - spaced bins , with bin length defined as : the quantized 16 - gray - level matrix , i g16 ( m , n ), was found using the following rule : a second grey - scale encoding method , magnitude encoding with 32 gray levels ( n g = 32 ) provides higher resolution and is described as follows . the entire matrix was normalized with respect to i ( m , n ) max . then all values were quantized to 32 equally - spaced bins , with bin length defined as : the quantized 32 - gray - level matrix , i g32 ( m , n ), was found using the following rule : a third grey - scale encoding method , ln ( magnitude ) encoding with 16 gray levels ( n g = 16 ) is very sensitive to the minimum and maximum values . taking the natural logarithm of the magnitude of i ( m , n ) will suppress the global maximum , and give rise to the details of the local maxima . the global maximum and minimum intensity values of the entire matrix i 125 × 2250 were found . the entire matrix was normalized with respect to i ( m , n ) max . then all values were quantized to 16 equally - spaced bins , where each bin &# 39 ; s length is equal to : the quantized 16 - gray - level matrix , i gln16 ( m , n ), was found using the following rule : a fourth grey - scale encoding method quantized the image into unequally spaced bins . the first , second , and third encoding methods used equal spaced gray - level bins . the images according to the fourth encoding method are based on quantizing the matrix into unequally spaced bins , where the length of the bin is inversely proportional to the histogramic distribution of the i ( m , n ) magnitude values . in other words , the higher the occurrence of a certain range of values in the matrix i ( m , n ) is , the smaller the bin size that will contain them . hence , values with similar characteristics with be grouped together , and the effect of extremely high or extremely low values will be nullified . this means that all ng grey levels will have equal distribution in the image . fig2 illustrates the binning process with this encoding scheme for an example of four gray scales , ng = 4 . the unequal bin lengths , b 1 , b 2 , b 3 , and b 4 are due to the unequal intensity distribution 210 , which is a function of the image itself . the histogram of the absolute matrix values clearly shows lower intensities occur more frequently . no normalization is required for this histogram binning encoding method . bin thresholds may be chosen so that ratio of value occurrences within the bin to the overall value occurrences for all bins is fixed . this value is equal to the quantized 16 - gray - level matrix , i ghis16 ( m , n ), was found using the following rule : if ( i ( m , n )⊂ bin # i ) i ghis16 ( m , n )= i , for 0 ≦ i ≦ 15 , 1 ≦ m ≦ 125 , 1 ≦ n ≦ 2250 . an example intensity image histogram is shown in fig2 . choosing n g = 4 , the values falling within bin b 1 will have a quantized value of i = 0 ( black ). the values falling within bin b 2 will have a quantized value of i = 1 , which corresponds to a 66 %- gray shade . the values falling within bin b 3 will have a quantized value of i = 2 ( 33 %- gray ), and finally the trailing tail of intensity values falling within bin b 4 will have a quantized value of i = 3 ( white ). fig3 a - d depict exemplary encoded images of the same clip , each image encoded by one of the four different encoding methods described above . fig3 a shows the encoded image of the complex stdft matrix of clip 1 from subject nor ( 1 ), using magnitude encoding with 16 grey levels ( n g = 16 ). fig3 b shows the encoded image of the same complex stdft matrix of clip 1 from subject nor ( 1 ), using magnitude encoding with 32 grey levels ( n g = 32 ). fig3 c shows the encoded image of the same complex stdft matrix of the same clip 1 from subject nor ( 1 ), using ln ( magnitude ) encoding with 16 gray levels ( n g = 16 ). and fig3 d shows the encoded image of the stdft matrix , also from normal subject 1 , clip 1 of 198 . at this point in the signal processing process , there are 4 × 198 images , four images for each clip 50 , shown in fig1 . each one of a respective four images encoded by applying a different grey - level encoding method to the stdft complex matrix . armed with these image sets , the process of analyzing the images and classifying the images , for example nor or osa , based on statistical properties of the images is described . textural features for these images will be calculated for subsequent statistical analysis ( haralick et al ., ieee transactions on systems , man , and cybernetics 1972 , 3 ( 6 ), pp . 610 - 619 ). gray level co - occurrence matrices ( glcm ) are ng × ng symmetric matrices that contain the count of paired i and j gray levels separated by a certain distance , d , and angle , θ ( haralick et al ). from these counts , glcms , textural features are calculated 60 , as shown in fig1 . glcms were originally developed to sort the massive number of satellite images in the early 1970 &# 39 ; s ( haralick et al ). for images with square pixels , there are four conventional values for θ that dictate the neighborhood relationship of any two paired pixels , 0 °, 45 °, 90 °, and 135 °. a single image can produce numerous different glcms , depending on the choice of parameters , d and θ . parameter d , distance , is measured in pixel count , for example 3 pixels to the left is 3 pixels in the 0 ° direction . calculating glcms imposes a high computational load . in the example of four images for each of the 198 clips , each image was segment into 18 square manageable segments of 125 × 125 pixels ( where 18 × 125 = 2250 , the original image size ). at 125 pixels , each segment represents 50 seconds in length . two half segments , 64 × 125 , were made for the lower frequencies which contained high power densities . the last segment of each 18 segments per image was discarded . all 17 125 × 125 segments coming from one image clip will be converted into a glcm separately , and their results will be averaged to give a mean value glcm for that one image . similarly glcms of the two half segments will be averaged to yield a mean glcm for that one image . normalized glcms ( nglcm ) are glcms normalized to the total number of counted pairs , n p . n p is function of image size , the orientation θ , and the distance d . for an image with size i p × i p pixels , n p is given according to the equations below . n p = 2 ·( i p ×( i p − d )) for θ = 0 ° and 90 °, and n p = 2 ·(( i p − d )×( i p − d )) for θ = 45 ° and 135 °. still referring to the exemplary embodiment of 198 useable clips , a total 10 mean value glcms were calculated per clip . the distribution of 10 mean glcms was not uniformly distributed across the four grey scale images for each clip . the mean value glcm distribution across images and corresponding parameters , d and θ , are summarized below . for images constructed using magnitude encoding with 16 grey levels ( n g = 16 ), shown for example in fig3 a , the following mean glcms were calculated : for images constructed using magnitude encoding with 32 grey levels ( n g = 32 ), shown for example in fig3 b , the following mean glcms were calculated : for images constructed using ln ( magnitude ) encoding with 16 gray levels ( n g = 16 ), shown for example in fig3 c , the following mean glcms were calculated : for images constructed using histogram binning ( n g = 16 ), shown for example in fig3 d , the following mean glcm was calculated : for the example comprising 198 clips , nine textural features were calculated from the glcms ( haralick et al ). for all the subsequent measures , the following definitions are applicable : m ( i , j ) is the i , j element of the grey level co - occurrence matrix . since m is symmetric , m ( i , j )= m ( j , i ). n g is the number of grey levels used in the image . the nine textural features are defined and calculated as provided below . a total of 90 average features is calculated for each of the 198 clips , 9 for each of the 10 glcms . feature selection to enable discrimination between a first and second class , nor and osa , is evaluated using statistical analysis of the features 70 , as shown in fig1 . suitable textural feature selection can be based on , for example , a gap between means with corresponding small standard deviations . in the particular example of 198 clips , features with a good first degree separation , large mean gap between nor and osa and small spread about respective means , were chosen as the features for class discrimination ( nor or osa ) 80 , as shown in fig1 . such features can , for example , be identified by a minimum deviation - to - mean ratio . fig5 illustrates the signal processing steps on an ekg clip , according to the example of 198 clips . the number of clips , the number of encoded images ( four shown ), and the number of glcms , normalized or not , can vary in alternate embodiments consistent with the present invention . fuzzy logic systems have been used in previous studies to distinguish , classify , between inputs with overlapping input values ( j . m . mendel , “ uncertain rule - based fuzzy logic systems : introduction and new directions ”, prentice hall , n . j ., 2001 ). membership functions ( mfs ), used in fuzzy logic systems , assign a membership degree between 0 ( low ) and 1 ( high ) to the range of inputs . sigmoid mfs were chosen for the example of 198 clips , where , a sigmoidal function can be written as : in the exemplary embodiment of 198 clips , a singleton fuzzy system was employed . the system is made up of input fuzzifier , rule - fed inference engine , and a defuzzifier . the values of the selected features are used as inputs . each value is given two membership degrees ( mds ); nor and osa . the mds are allocated using the sigmoidal mfs defined above . initial c l and c h values are set to the means of lower and higher nor and osa means , respectively . initial a l and a h values are set to 1 . these md values are then trained to find best fitting mfs that give optimum classification results . exemplary formulation of fuzzy rules is described in reference to table 1 , which summarizes statistical means of a given nglcm , for correlation , inverse difference , and inverse difference momentum . with the example as shown in table 1 , there are 2 3 = 8 fuzzy rules . example fuzzy rules based on table 1 would include : ( a ) if cor is low and ind is low and idm is high then clip is nor ; and ( b ) if cor is high and ind is high and idm is low then clip is osa . because all selected features are exclusively disjoint , in which each feature independently describes the image , rule reduction may be applied . the additional 2 × 3 = 6 rules useful with the inference engine for classifying nglcm - x include : ( a ) if cor is low then clip is nor ; ( b ) if cor is high then clip is osa ; ( c ) if ind is low then clip is nor ; ( d ) if ind is high then clip is osa ; ( e ) if idm is high then clip is nor ; ( f ) if idm is low then clip is osa . for deffuzification , height defuzzification was used . a value of “ 1 ” was assigned to osa clip diagnosis and “− 1 ” to nor clip diagnosis . a crisp decision boundary was set at “ 0 .” in the exemplary embodiment of 198 clips , each fuzzy logic system ( fls ) was recursively trained , using described methods known to one of ordinary skill ( such as that described by mendel ( 2001 ) in “ uncertain rule - based fuzzy logic systems : introduction and new direction ,” prentice hall , n . j .). using the statistical significant difference between nor and osa extracted textural features as a feature selection method , it was found that for the nglcms of table 1 , textural features cor , ind , and idm showed significant differences and had a lowest spread to mean ratio . these features were inputs to a fuzzy logic system ( fls ) layer . each fls was trained with the corresponding 3 features from each nglcm . in another words , fls - 1 was trained using features cor 1 , ind 1 , and idm 1 , and so on through fls - 10 , being trained using cor 10 , ind 10 , and idm 10 . in an iteration , 92 nor clips and 106 osa clips were randomly divided into training set and matching set : 132 clips for training and 66 for testing . mean of the training set was used as initial values for c l and c h . the set was classified and output of flss were acquired and combined using weighed majority rule , as shown table 2 . after training , data were combined using weighed majority rule to find a classification for each clip . table 2 shows a representative example of such data for 6 randomly chosen clips , including classification and final decision . nor clips are marked as (− 1 ) and osa are marked as ( 1 ). each fls corresponds to the texture values from a given glcm , recall there are 10 glcms per clip in the 198 clip example . in equations ( 19 ) to ( 21 ), osa c is the number of correctly detected osa clips and nor c is the number of correctly detected nor clips . a summary of sensitivity , specificity and accuracy for the training set and testing set in the example of 198 clips is depicted in table 3 . as can be seen from the results in table 3 , the system in accordance with this invention has good sensitivity . in the methods in accordance with the present invention of a combination of time and frequency domains in one plot ( e . g ., image ) are used to quantitatively analyze signal recording , the analysis relying on a classification scheme described herein . image processing and pattern recognition schemes and classifiers improve not only the detection rate of one or more particular signals , but are also reliable , effective , and efficient . the methods in accordance with this invention compare well to alternative conventional temporal or spectral methods being practiced . a second classifier system can be developed according to the present invention . for example , in accordance with another exemplary embodiment , a multilayer perceptron network ( mlp ) is employed . an mlp is a form of a feed - forward neural network ( nn ). a feed - forward nn is does not have any of its frontward layer outputs feeding back into a previous layer &# 39 ; s input . mlps have been shown to be successfully employed in image classifier applications . in an exemplary embodiment of the present invention , a three layer mlp was used , which has an input layer , hidden layer and an output layer . the input layer has a number of neurons ( nodes ) equal to the input vector length . the output layer consists of one neuron , accounting for a possibility of only 2 classes to be classified . the number of units in the hidden layer ( n h ) is adjustable and effects classification accuracy . besides changing the number of hidden units , each layer of a mlp has two parameters that are trained to achieve maximum detection : node transfer function and weight vector . both input and output layers use linear transfer functions ( tf ) for each neuron . this is achieved using matlab &# 39 ; s linear tf purelin ; matlab is a programming language by the mathworks , inc ., ( the mathworks , inc ., natick , mass ., u . s . a ). the hidden layer , on the other hand , uses a hyperbolic tangent sigmoid function . matlab &# 39 ; s implementation of this tf is : a mlp can be created , for example , using the newff function in the neural network toolbox in matlab , the results of two mlps that were developed to classify the clips based on two different sets of inputs drawn from the nine features and 10 glcms , described above are describe below . all glcms are normalized ( nglcm ) for the mlp classifier system . training of a mlp , in accordance with this invention is achieved by fitting the network parameters to the desired output using bp . this step is analogous to the training of the fls . the accuracy of the mlp system is not directly correlated to the number of training epochs , rather after an optimum n ep , the accuracy of the system may actually decline with additional training epochs . using a selected feature set , used as input vectors to the mlp , the 198 clips are randomly assigned into two groups ; training and testing , with a 2 : 1 ratio . with total of 198 clips , this is translated to 132 clips for training , and the remaining 66 for testing and validation . then , the optimum number of hidden units ( n h ) and training epochs ( n ep ) are found as a pair using the method further described below . for each possible n h , the network is trained using the training set with a given number of epochs , n ep , and then the weights and biases parameters of the network are fixed in order to run the test set and calculate the testing accuracy of the network . once accuracies are stored for a first given n ep , the mlp is then trained for the next n ep increment . the number of n ep s ranged from 200 to 5000 in accordance with this invention . this allows for studying the average performance of the mlp at that given n h . the one - step - secant back propagation method was used for training the mlp . optimum pairs for of hidden units n h and training epochs n ep are determined from accuracy calculations in a 50 - run monte carlo simulation . once these pairs are chosen for each of the two mlps at hand , 1000 - run monte - carlo simulations are performed to study the performance of the detector mlps . tables 4 and 5 show the accuracies calculated during the optimization process , finding the best n h , n ep pair . the table below summarizes the accuracies of n eps for a given n h . values shown in table 4 are per each n h and n ep pair for an mlp with 30 inputs , these 30 inputs are derived from the 3 textural features selected and the 10 nglcms as trained and tested for the exemplary fls system , described above . after examining all potential testing accuracies for the n h and n ep pairs in table 4 , n h = 45 with n ep = 200 were chosen for subsequent training and testing at 1000 monte carlo runs . table 5 shows the results of the average performance using 17 selected inputs to the mlp network , these 17 inputs are also drawn from the 198 clips , nine features and 10 glcms described above . after examining all promising n h and n ep pairs in table 5 , n h = 8 with n ep = 1800 were chosen for the 1000 monte carlo run . a summary of sensitivity , specificity , and accuracy for the training set and testing set in the example of 198 clips for the mlp systems using three textural features of the fls system , 30 inputs , and using 17 selected features as described above , are provided in tables 6 and 7 , respectively . in yet another embodiment , 90 inputs were used to train and test an mlp system as described above . the 90 inputs were obtained from the 10 glcms , normalized , and all nine textural features calculated from the glcms , all originating from the 198 clips . after examining all potentially promising n h and n ep pairs in table 3 . 12 that yielded the best validation accuracy , n h = 8 with n ep = 1800 were chosen . the results are provided below . as such , images derived from clips , such as those represented in fig3 and 5 may be evaluated for signal patterning . images depicting variations in power distribution ( non - uniformity ) may be further focused . for example , images of fig3 were focused to a low frequency range . one or more encoding schemes that rely on contrast level encoding are used to further enhance the distribution of signal recordings in the image . in one example , four different grey - scale shadings were used to represent each point in the plot . the encodings are translated into differences in one or more extracted textural features . the textural features selection method employs a first degree statistical analysis yielding features that are sufficient to produce useful , quantitative results which compare well with current qualitative analyses . detection rates may also rely on alternative techniques than those described , for example , the mlp system described herein . a method of processing , analyzing and training a fuzzy logic system or an mlp system to classify signals as between two classes is readily apparent from the detailed description above . beginning with ekg signals from known classes , a fuzzy logic system or an mlp system can be trained to classify unkown records into the two known classes . examples of classes include : normal signals and congestive heart failure signals ; normal and long q - t interval signals ; or normal signals and osh . a key step in the signal processing from which textural features are extracted is the calculation of glcms from stdft matrices . not all people with suspected sleep apnea require medical tests . expensive diagnostic efforts are probably not required for individuals who have no other health risk factors and whose suspected apnea does not affect their quality of life or safety on the road . however , patients with impaired lifestyles and other medical complications need to be screened for sleep apnea . non - invasive , minimally intrusive , methods of detecting sleep apnea are needed . the present invention provides a method for such diagnosis . additional objects , advantages and novel features of the invention as set forth in the description , will be apparent to one skilled in the art after reading the foregoing detailed description or may be learned by practice of the invention . the objects and advantages of the invention may be realized and attained by means of the instruments and combinations particularly pointed out here .
described herein is a method of developing a fuzzy logic system to detect a non - normal health condition . in particular , signal processing and transformation of electrocardiogram signals for sleep disorder breathing are provided . the method includes : recording ekg measurements during sleep ; clipping the measurements into clips of a consistent length ; calculating heart rate and obtaining an evenly sampled discrete time series data clip ; performing short - time discrete fourier transform on each data clip generating stdft respective matrices ; encoding each stdft matrix into a grey - level image ; calculating grey - level co - occurrence matrices ; extracting textural features ; performing statistical analysis on the features to formulate rules ; and employing the rules in a fuzzy logic system . the system and method described herein yields an accuracy of 75 . 88 %, or better , in detection of sleep apnea .