Software developmet of compoets for complex sigal aalysis o the example of adaptive recursive estimatio methods. SIMON BOYMANN, RALPH MASCHOTTA, SILKE LEHMANN, DUNJA STEUER Istitute of Biomedical Egieerig ad Medical Iformatics Ilmeau Techical Uiversity POB 00565, D-98684 Ilmeau GERMANY Abstract: - Oe atural way to develop ew complex sigal processig strategies is to combie basic s. Therefore we eed these s as compoets. Usig object-orieted techologies, it is easy to build compoets from s. This ca be demostrated by the example of adaptive recursive estimatio methods. Compoets must be able to dock to each other ad to commuicate. Furthermore, the compoets must detect some major s of errors ad react effectively. With the help of these compoets we will show how complex adaptive recursive estimatio methods ca be created ad how they ca be implemeted. Key-Words: - software developmet, sigal aalysis strategies, compoets, adaptive recursive estimatio method, object-orieted techologies, Itroductio Recet developmets of powerful computer equipmet combie with moder iformatio processig methods such as object-orieted techologies to stimulate ew opportuities for the desig of s addressig complex sigal ad image processig problems. Also, there is great iterest from parters i the idustry i ew s that fit specific sigal processig problems. However, the techology trasfer from academia to idustry was hampered by the lack of a commo iterface. Both sides require s that come with a iterface both of these parters ca utilize. Oe very atural approach to buildig complex sigal processig strategies is to cocateate basic ic compoets ito a etwork that meets the set demads. Usig adaptive recursive estimatio methods as a example, we describe how such compoets may be realized as object-orieted structures, ad how they could be combied. 2 Problem Formulatio 2. Adaptive recursive estimatio methods[] Adaptive recursive estimatio methodes have a commo structure. S 0 = s0 S = S c K ( S x, ( From these basics we ca costruct simple adaptive procedures. Adaptive Mea M = M c ( x M (2 Adaptive secod momet 2 E = E c ( xm E (3 Adaptive Quatil Q c α Q = Q c ( α if if x x > Q < Q (4 Their structure makes them suitable for objectorieted programmig. TAdapt Value Create( Plus( Correct( MultCost( TAdaptMea TAdaptSecodMomet TAdaptQuatil Fig. : Class diagramm of basic adaptic recursive estimatio methods
2.2 Complex sigal processig strategy Prerequisite to buildig sigal processig strategies are primitive s implemeted as compoets. These compoets must be able to dock to each other ad to commuitate with each other. Fig. 2: Example pipelie sik I figure 2 some simple compoets are docked to each other. We will call the combiatio of compoets a pipelie [2]. A compoet ca have etraces ad gates. It is obvious that the compoets also have to implemet mechaisms to cotrol the flow of the data. Although the flow of the data is always from the data to the sik, the request to perform a calculatio could appear o both eds of the pipelie. The first situatio is a example for a offlie aalysis. The data is a file with megabytes of EEG-data for example. The data sik is a viewer simple displayig the result of the strategy. It is impractical to perform the calculatio o the etire data. It is more effective to perform the calculatio oly o the data curretly displayed by the data sik. Here, calculatio is triggered by the sik. The secod situatio is a example for a olie aalysis. The data produces a ew data item from time to time ad the sik has to display the ew result. I this case the calculatio is triggered by the. The remarks above idicates that the amout of data trasported through the pipelie chages. It could be a sigle data item, a data block with a special size to perform a FFT for example, full pictures or eve series of pictures. Aother fact we have to cosider is that splittig of the data flow ad loops are defiitely allowed ad wated. Therefore, we have to provide mechaisms to prevet deadlocks. So far we discussed oly compoets with oe gate. But imagie a data represetig agai a file of EEG data. I this file, more importat iformatio is cotaied tha just the readigs, for example, the sample rate. Thus we must desig compoets with multiple etraces ad gates. 3 Problem Solutio 3. Dockig ad commuicatio First we cocetrate o the dockig of the compoets ad the commuicatio. We have already idetified two differet requests to the pipelie causig it to perform the calculatio. The first oe we will ame a call request (fig. 3. It starts from the ad causes all compoets i the pipelie to perform their calculatio, icludig the data sik, ad eds by returig to the. The result of oe compoet is set to the ext compoet as a parameter of their call method. The secod request we will ame a recall request. Startig from the ed of the pipelie, this request will cause the precedig compoet i the pipelie to deliver the result of their calculatio based o a block of data with a special size ad positio withi the available data. The result of the precedig compoet is retured to the requestig compoet by the precedig compoets recall method. this Fig. 3: Sequece diagramm of a call request sik Now thik of a split of the data flow. For example there could be two differet data siks. Both request the result of oe precedig compoet based o the same data. This will cause double calculatios although the same result will be displayed. We eed to maage the results of each compoet better. This is realized by addig a compoet called pipe [2] betwee the compoets performig a calculatio. These compoets we will ame filter [2]. Oe other big advatage of these pipes is that the filter whose major resposibility is the calculatio, freed from maagig the data. The filters calculate their results based o the data provided by their etrace-pipes ad submit the results to their gate-pipes.
this : void pipe :PipeKotext : void re: BaseM atrix calculate(: void Fig. 4: Sequece diagramm call request with pipes ad filters The coectio betwee the compoets is a simple referece to each other. Every filter has a list of refereces to its etrace-pipes ad gates ad every pipe ows a list of its gate-filters ad a referece to the etrace-filter. The iterface to the compoets is realized by a abstract class. This result is i the class diagram provided i fig. 4. BaseFilterKotext addeigag( re addausgag( getdescriptio( FilterKotext m_outputfilterlist.. m_iputfilter m_iputpipelist m_outputpipelist Fig. 5: Class diagram of the cotext PipeKotext BasePipeKotext addeigag( addausgag( getdescriptio( Whe a filter fiishs its calculatio, it will sequetially call the call method of every refereced gate-pipe i its list. So do the pipes. The recall request works similar. 3.2 Pipelie cotrol To cotrol the pipelie we add two more classes to our class structure, a class to cotrol the pipe ad oe class to cotrol the filter. By cotrolig these compoets we ca cotrol the whole pipelie. The cotrol class of the filter is also resposible for supplyig the with the correct data from the etrace-pipes. This is doe by a mappig from a descriptio of the to the list of etrace-pipes. But this topic is ot discussed i this paper. A first error we would like to address is itroduced by backcouplig. This may cause a filter to request data from itself. I the case of the first calculatio requested of the filter, it maybe sesible to use default data i place of the data ot yet available. Otherwise, the filter will have to produce a error. This ca be implemeted by defiig two flags, "isrecallig" ad "firsttime". The very first time a filter asks a etrace pipe for data, both flags will be set to true. The flag of firsttime is set to false after the first calculatio ad isrecallig is set to false evere time a request retured. The ext problem appears if a filter calls itself. We defie a flag iscallig which is set to true whe the filter calls its gate pipes, a reset if the calls retured successfully. If the filter is called while iscallig is true, the filter produces a error. The followig cotrol mechaism is implemeted i the pipes. Thik of a data with two gates. Oe delivers the readigs ad the other oe the sample rate of data acquisitio. The ext filter performs a FFT o the data ad also eeds the sample rate. The data will call its first gate ad the coected pipe the filter to do the calculatio. The filter requests through the pipes the iformatio from both gates of the ad performs. I the ext step the will call the other gate. The same happes agai. The FFT-filter performs the calculatio two times with the same iformatio. This must be prevet by the pipes. A call request ca oly pass a pipe if the data saved by the pipe is ot requested already by a special filter. Otherwise, the pipe would ot call this special filter, but all other filters coected to it as gate-filter. Therefore, the pipe has to idetify the filter which is callig its request method ad mark the gate the filter is coected to as allreadyrecalled. So we eed a flag for every filter coected to the pipe. These flags are reset every time ew data are writte to the pipe. The pipe also checks if requested data match the data it has saved already. I this case the pipe retur the data without causig a ew calculatio of its etrace-filter.
3.3 Structure of compoets BaseFilterKotext BasePipeKotext 4. Sigal processig strategies by aggregatio A simple example for a combiatio of basic compoets is the adaptive variace. V ( 2 C2 C [ C, C ]( X E ( X M ( = (5 X 2.. m_kotext FilterKotext #m_iputpipelist:basepipekotext & #m_outputpipelist:basepipekotext & -m_filter:filterstate & m_filter.. FilterState PipeKotext #m_outputfilterlist:basefilterkotext & #m_iputfilter:basefilterkotext & -m_pipe:pipestate & m_pipe.. PipeState.. m_kotext This arithmetic expressio ca be trasformed i a pipelie as show i figure 6. (C2 (X (C «cotroll» BasicFilter «cotroll» BasicPipe E C ( X M C ( X CocreteAlgorithm CocretePipe calculate(: void setdefaultvalues(: void ewblocksize(: void Fig. 6: Class diagram of the compoets X 2 The class structure i figure 5 shows a compoet to cosists of three parts: The cotext resposible for the commuicatio ad coectio with the eigbour compoets. The base classes doig the cotrollig the pipelie, ad the cocrete classes implemetig the. To implemet a oly the calculate method must be implemeted. If default values for the special case discussed above shall be set, the method setdefaulfvalues must be implemeted ad if the eeds a special amout of data the ewblocksize method will have to be ivoke. 4 Coclusio From the curret state of developmet we ca easily create the basic adaptive recursive estimatio methods show i figure as compoets. The class TAdapt will just have to iherit from BasicFilter ad implemet the calculate method. Thus we build a small library of basic adaptive recursive methods. a b sik (V Fig. 7: adaptive variace pipelie Buildig pipelies from basic compoets is especially useful durig the iitial stages of developmet of a ew sigal processig strategy. This approach allows frequet chages to compoets ad subsequet observatio of the resultig performace of the strategy. Obviously, the cotrol mechaisms withi the compoets cause some performace drawbacks. At rutime, a sigle module executig the job of the pipelie will always yield superior performace. Therefore, after satisfactory evaluatio of the strategy, you may wat to reimplemet it for optimized executio. 4.2 Implemetio of complex sigal processig methods The use of object-orieted techiques ecourages the implemetatio of complex s. Two mai parts of the adaptive variace are implemeted already, the
adaptive mea ad the adaptive secod momet. To implemet the adaptive variace the ew class must iherit from the class BasicFilter ad implemet the calculate methode usig the adaptive mea ad the adaptive secod momet. The adaptive variace ca i tur be used as a compoet i other sigal processig strategies. I the future we pla to implemet librarys with various sigal processig s these supplemeted by a applicatio to maage ad combie these compoets. Based o the structure of the compoets, we hope that this applicatio ca fullfill the demads of a wide variety of today s ad tomorrow s sigal processig problems. Because the iterfaces of the compoets were desiged i close cotact with our parters from idustry we hope to improve ourcooperatio. Supported by TMWFK: B699-000 Refereces: [] D. Steuer, G. Grießbach; Object-orieted realizatio of complex adaptivee recursive estimatio methods i biosigal aalysis, Proceedigs of 3rd Iteratioal Workshop o Biosigal Iterpretatio (BSI99, Chicago 999, 245-248 [2] F. Buschma, R. Meuier, H. Rohert, P. Sommerlad, M. Stal ; A System of Patters: Patter- Orieted Software Architecture, West Sussex, Eglad, Joh Wiley & Sos. 996