コード例 #1
0
        /// <summary>
        /// Получить особые точки РЭГ и ЭКГ, используя стандартный алгоритм
        /// </summary>
        /// <param name="combobox3"></param>
        public void Return_Point_EKG(String combobox3)
        {
            int b = initial_data.Get_Number_Strings();

            long[,] row1 = initial_data.Get_Row1();
            long[,] row2 = initial_data.Get_Row2();
            long[] row3 = initial_data.Get_Row3();
            long[] row4 = initial_data.Get_Row4();

            int reg = initial_data.REG;

            /////////////////////////

            int b0    = 0;                     //второй счетчик строк
            int ew    = 0;                     //счетчик найденных максимумов
            int est   = 0;
            int maxim = 0;                     // счетчик массива

            long[] max1_y    = new long[2000]; // счетчик максимума
            long[] max1_x    = new long[2000];
            long[] max1_coor = new long[2000];

            for (int u = 0; u < 1000; u++)
            {
                max1_x[u] = 1;
                max1_y[u] = 1;
            }
            // while (ew<2)
            int N_propusk = 0;

            while (b0 < b)/////////////поиск опорных точек
            {
                for (int t = 0; t < 200; t++)
                {
                    b0++;

                    if ((row3[t + 1 + est]) > max1_y[maxim])
                    {
                        max1_y[maxim]    = (row3[t + 1 + est]);
                        max1_x[maxim]    = row1[t + 1 + est, 0];
                        max1_coor[maxim] = t + 1 + est;
                    }
                }

                if (max1_y[maxim] > System.Convert.ToInt64(combobox3) * mass) ////////////////////!!!!!!
                {
                    ew++;                                                     // счетчик пиков производной
                    maxim++;
                    N_propusk = 0;
                }
                est = est + 200;
                N_propusk++;


                int    period  = 0;
                double period2 = 0;
                for (int u = 1; u < ew; u++)
                {
                    period2 = period2 + (max1_coor[u] - max1_coor[u - 1]);
                }
                period = System.Convert.ToInt32(Math.Round(period2 / (ew - 1)));

                double Left_shift  = 0.1 * period;
                double Right_shift = 0.75 * period;

                double Shift_03n = 300;

                if (period < 400)
                {
                    Shift_03n = 0.65 * period;
                }

                int Left_Border  = System.Convert.ToInt32(Math.Round(Left_shift));
                int Right_Border = System.Convert.ToInt32(Math.Round(Right_shift));

                int Shift_03 = System.Convert.ToInt32(Math.Round(Shift_03n));

                /////////////////////////////////////////////////////

                long[,] osob_x = new long[14, ew]; // список особых точек для вывода на график
                long[,] osob_y = new long[14, ew];
                long[,] schet  = new long[15, ew]; // список особых точек для расчета (должны отличаться!!!!!)

                long[] EKG_max   = new long[ew];
                long[] EKG_max_x = new long[ew];

                for (int w = 0; w < ew; w++) //н.у.
                {
                    for (int i = 0; i < 14; i++)
                    {
                        osob_x[i, w] = 1;
                        osob_y[i, w] = 512;
                    }
                    EKG_max[w]   = 512;
                    EKG_max_x[w] = 0;
                }

                for (int w = 2; w < ew - 1; w++)//перебираем пики
                {
                    ///////////////////////////// Ищем максимум ЭКГ--1

                    for (long i = max1_coor[w]; i > max1_coor[w] - Shift_03; i--)//2
                    {
                        if (row4[i] > EKG_max[w])
                        {
                            EKG_max[w]   = row4[i];
                            EKG_max_x[w] = row1[i, 0];
                        }
                    }
                }

                for (int w = 1; w < ew - 1; w++)//перебираем пики
                {
                    spec_point[0, w] = EKG_max[w];
                    spec_point[1, w] = EKG_max_x[w];
                }
            }
        }