public void Load()
        {
            TestModule3_Data basicData = new TestModule3_Data();
            XMLConverter converter = new XMLConverter(analysisName);

            XmlDocument file = new XmlDocument();
            string fileName = analysisName + "_TestModule3.xml";
            file.Load(directory + fileName);

            XmlNodeList modules = file.SelectNodes("EKG/module");

            string moduleName = this.GetType().Name;
            moduleName = moduleName.Replace("_Data_Worker", "");

            foreach (XmlNode module in modules)
            {
                if (module.Attributes["name"].Value == moduleName)
                {
                    XmlNode frequency = module["frequency"];
                    basicData.Frequency = Convert.ToUInt32(frequency.InnerText, new System.Globalization.NumberFormatInfo());

                    XmlNode sampleAmount = module["sampleAmount"];
                    basicData.SampleAmount = Convert.ToUInt32(sampleAmount.InnerText, new System.Globalization.NumberFormatInfo());

                    List<Tuple<string, Vector<double>>> Signals = new List<Tuple<string, Vector<double>>>();
                    XmlNodeList signals = module.SelectNodes("signal");
                    foreach (XmlNode signal in signals)
                    {
                        XmlNode lead = signal["lead"];
                        string readLead = lead.InnerText;

                        XmlNode samples = signal["samples"];
                        string readSamples = samples.InnerText;
                        Vector<double> readDigits = converter.stringToVector(readSamples);

                        Tuple<string, Vector<double>> readSignal = Tuple.Create(readLead, readDigits);
                        Signals.Add(readSignal);
                    }
                    basicData.Output = Signals;
                }
            }
            this.Data = basicData;
        }
Exemplo n.º 2
0
        public void Init(ModuleParams parameters)
        {
            Params = parameters as TestModule3_Params;
            Aborted = false;
            if (!Runnable()) _ended = true;
            else
            {
                _ended = false;

                InputWorker = new Basic_Data_Worker(Params.AnalysisName);
                InputWorker.Load();
                InputData = InputWorker.BasicData;

                OutputWorker = new TestModule3_Data_Worker(Params.AnalysisName);
                OutputData = new TestModule3_Data(InputData.Frequency, InputData.SampleAmount);

                _currentChannelIndex = 0;
                _samplesProcessed = 0;
                NumberOfChannels = InputData.Signals.Count;
                _currentChannelLength = InputData.Signals[_currentChannelIndex].Item2.Count;
                _currentVector = Vector<Double>.Build.Dense(_currentChannelLength);

            }
        }