Exemple #1
0
        private void Test_File_With_And_Without_Peaks_Rejection(string filename_in_unit_test_data_folder)
        {
            string full_data_file_name = FileHelpers.GetPathFromExecutingAssembly(
                Path.Combine("unit_test_data", filename_in_unit_test_data_folder));

            var output = Test_File_With_And_Without_Rejection(full_data_file_name);

            ProcessingSettings ps_ON  = output.rejection_ON_settings;
            ProcessingSettings ps_OFF = output.rejection_OFF_settings;

            HrvResults results_rejection_ON  = output.rejection_ON_results;
            HrvResults results_rejection_OFF = output.rejection_OFF_results;

            Assert.AreEqual(true, ps_ON.RejectUsingMinMaxNNTime);
            Assert.AreEqual(true, ps_ON.RejectUsingRelativeNNDelta);

            Assert.AreEqual(false, ps_OFF.RejectUsingMinMaxNNTime);
            Assert.AreEqual(false, ps_OFF.RejectUsingRelativeNNDelta);

            int count_of_rejected_hr_marks_rejection_OFF = GetCountOfRejectedHrMarks(results_rejection_OFF);
            int count_of_rejected_hr_marks_rejection_ON  = GetCountOfRejectedHrMarks(results_rejection_ON);

            log.InfoFormat("Finished testing of processing results from file '{0}' with rejection ON and OFF.", filename_in_unit_test_data_folder);
            log.InfoFormat("  Rejection ON:   {0} pulse waves rejected.", count_of_rejected_hr_marks_rejection_ON);
            log.InfoFormat("  Rejection OFF:  {0} pulse waves rejected.", count_of_rejected_hr_marks_rejection_OFF);

            Assert.IsTrue(
                count_of_rejected_hr_marks_rejection_ON > count_of_rejected_hr_marks_rejection_OFF,
                "Results obtained with rejection contain less rejected heart contraction marks than results obtained with no rejection."
                );

            log.Info("Checks finished OK.");
            log.Info("----------------------------------------------------------------------------------------------------");
        }
Exemple #2
0
        public HrvBasicDataProcessor()
            : base()
        {
            ProcessorOutputData = new HrvResults();

            var mapperConfig = new MapperConfiguration(cfg => {
                cfg.AddProfile <AutoMapperStatisticsProfile>();
            });

            _mapper = mapperConfig.CreateMapper();
        }
Exemple #3
0
        private int GetCountOfRejectedHrMarks(HrvResults results)
        {
            int count = 0;

            for (int i = 0; i < results.RATED_HR_MARKS.Length; ++i)
            {
                if (results.RATED_HR_MARKS[i].IntervalsCount < 2)
                {
                    ++count;
                }
            }
            return(count);
        }
Exemple #4
0
        private void ProcessHrvData(TestRawData hrvData, out HrvResults hrvOutData)
        {
            var hrvProcessor = new HrvDataProcessor_Pro();

            IMethodProcessedData tempHrvOutData = hrvProcessor.ProcessData(hrvData);

            hrvOutData = tempHrvOutData as HrvResults;
            if (null == hrvOutData)
            {
                throw new ArgumentException(
                          $"HRV processor returned object of an unexpected type. Data type: " +
                          $"{tempHrvOutData.GetType()}, expected: {typeof(HrvResults)}");
            }
        }
Exemple #5
0
        public void TestAllFilesWithLowQualityFragments_Must_Yield_Expected_Results()
        {
            foreach (TestUtil.tsd testSample in TestUtil.low_quality_start_samples)
            {
                // with masking low-quality fragments
                HrvResults results = ProcessFile(testSample._fileName, true, true);

                Assert.That(results.CRV_STAT.m, Is.AtLeast(testSample._expectedMrrLow),
                            string.Format($"Expect MRR of at least {testSample._expectedMrrLow} for file {testSample._fileName}"));

                Assert.That(results.CRV_STAT.m, Is.AtMost(testSample._expectedMrrHigh),
                            string.Format($"Expect MRR of at most {testSample._expectedMrrHigh} for file {testSample._fileName}"));
            }
        }
Exemple #6
0
        public PreShiftHrvConclusion MakePreshiftConclusion(HrvResults neuroLabHrvData)
        {
            Upft130VsrCalculator calc = new Upft130VsrCalculator();
            double VSR = calc.HRV_to_VSR(neuroLabHrvData.CRV_STAT.m, neuroLabHrvData.CRV_STAT.sigma);
            PreShiftHrvConclusion conclusion = new PreShiftHrvConclusion();

            conclusion.StateMatrixRow = calc.Mrr2SmRow(neuroLabHrvData.CRV_STAT.m);
            conclusion.StateMatrixCol = calc.SigmaRR2SmCol(conclusion.StateMatrixRow, neuroLabHrvData.CRV_STAT.sigma);
            conclusion.VSR            = VSR;
            conclusion.LSR            = Vsr2Lsr(VSR);
            conclusion.LSR_Text       = Lsr2String(conclusion.LSR);
            // refs #200
            // см. таблицу в разделе 4.6.2 в ТЗ
            conclusion.Status = Lsr2Status(conclusion.LSR);
            return(conclusion);
        }
Exemple #7
0
        private ResultsReliabilityEstimation GetResultsReliability(HrvResults hrvResults)
        {
            var reliability =
                new ResultsReliabilityEstimation
            {
                reject_min_max_enabled  = this.m_settings.RejectUsingMinMaxNNTime,
                reject_relative_enabled = this.m_settings.RejectUsingRelativeNNDelta,
                reject_nn_relative      = this.m_settings.MaxIntervalDeltaRelative,
                reject_nn_min           = this.m_settings.MinIntervalMilliseconds,
                reject_nn_max           = this.m_settings.MaxIntervalMilliseconds,
                hc_marks_total          = hrvResults.RATED_HR_MARKS.Length
            };

            // отбраковка


            for (int i = 0; i < hrvResults.RATED_HR_MARKS.Length; ++i)
            {
                RatedContractionMark mark = hrvResults.RATED_HR_MARKS[i];
                if (2 < mark.IntervalsCount)
                {
                    throw new DataProcessingException(
                              $"Logic error: one heart contraction was counted in more than 2 (actually, {mark.IntervalsCount}) intervals!"
                              );
                }

                if (2 == mark.IntervalsCount)
                {
                    ++reliability.hc_marks_2_int;
                }
                else if (1 == mark.IntervalsCount)
                {
                    ++reliability.hc_marks_1_int;
                }
                else
                {
                    ++reliability.hc_marks_0_int;
                }
            }

            return(reliability);
        }