Example #1
0
        private void tabPage2_Click(object sender, EventArgs e)
        {
            int total_minimum = Convert.ToInt32(Convert.ToDouble(this.textBox7.Text));
            int total_maximum = Convert.ToInt32(Convert.ToDouble(this.textBox8.Text));

            int minimum_delete_period = Convert.ToInt32(Convert.ToDouble(this.textBox6.Text));
            int maximum_delete_period = Convert.ToInt32(Convert.ToDouble(this.textBox5.Text));

            if (minimum_delete_period < total_minimum)
            {
                minimum_delete_period = total_minimum;
            }

            if (minimum_delete_period > total_maximum)
            {
                minimum_delete_period = total_maximum;
            }

            if (maximum_delete_period < total_minimum)
            {
                maximum_delete_period = total_minimum;
            }

            if (maximum_delete_period > total_maximum)
            {
                maximum_delete_period = total_maximum;
            }


            if (maximum_delete_period < minimum_delete_period)
            {
                maximum_delete_period = minimum_delete_period;
            }

            int minimum_i = 0;
            int maximum_i = 0;

            Initial_data init_data = new Initial_data("test3.txt", reg1, ekg1);

            init_data.Row1_Shift_Time_To_0(); //Сдвигаем время к 0
            init_data.Row1_Smothing();        // Сглаживаем полученные данные
            init_data.Row2_Calculate();
            init_data.Row3_Average_Canal_Reg();

            long[,] row_1new = init_data.get_row1();
            int b_new = init_data.get_b();

            Initial_processing.Divided_by_periods_data divided_row = new Initial_processing.Divided_by_periods_data(init_data, combobox_3);
            divided_row.Calculate_Data_In_Period();

            minimum_i = Convert.ToInt32(divided_row.Return_Length_X_Zero(minimum_delete_period, 0));
            maximum_i = Convert.ToInt32(divided_row.Return_Length_X_Zero(maximum_delete_period, 0));

            textBox9.Text  = Convert.ToString(row_1new[minimum_i, 0] / 1000);
            textBox10.Text = Convert.ToString(row_1new[maximum_i, 0] / 1000);
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)//Редактировать. Временные промежутки
        {
            long min = Convert.ToInt64(Convert.ToDouble(this.textBox1.Text)) * 1000;
            long max = Convert.ToInt64(Convert.ToDouble(this.textBox2.Text)) * 1000;


            long minimum_delete_time = Convert.ToInt64(Convert.ToDouble(this.textBox3.Text)) * 1000;
            long maximum_delete_time = Convert.ToInt64(Convert.ToDouble(this.textBox4.Text)) * 1000;

            if (minimum_delete_time >= maximum_delete_time)
            {
                minimum_delete_time = 0;
                maximum_delete_time = 0;
            }

            if (minimum_delete_time < min)
            {
                minimum_delete_time = 0;
            }

            if (minimum_delete_time > max)
            {
                minimum_delete_time = max;
            }

            if (maximum_delete_time < min)
            {
                maximum_delete_time = 0;
            }

            if (maximum_delete_time >= max)
            {
                maximum_delete_time = max;
            }

            int minimum_i = 0;
            int maximum_i = 0;

            Initial_data init_data = new Initial_data("test3.txt", reg1, ekg1);

            init_data.Row1_Shift_Time_To_0(); //Сдвигаем время к 0
            init_data.Row1_Smothing();        // Сглаживаем полученные данные

            long[,] row_1new = init_data.get_row1();
            int b_new = init_data.get_b();

            for (int i = 0; i < b_new; i++)
            {
                if (minimum_delete_time > row_1new[i, 0])
                {
                    minimum_i = i;
                }
            }

            for (int i = 0; i < b_new; i++)
            {
                if (maximum_delete_time > row_1new[i, 0])
                {
                    maximum_i = i;
                }
            }
            int diff_i    = maximum_i - minimum_i;
            int b_new_del = b_new - diff_i;


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


            if (radioButton1.Checked)
            {
                long[,] row_11new = new long[b_new, 1 + potok2];

                for (int i = 0; i < b_new; i++)
                {
                    row_11new[i, 0] = row_1new[i, 0];
                }

                for (int i = 0; i < b_new; i++)
                {
                    if (i < maximum_i && i > minimum_i)
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = 0;
                        }
                    }
                    else
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = row_1new[i, z];
                        }
                    }
                }

                init_data.set_row1(row_11new);
                init_data.set_b(b_new);
                init_data.Row1_Write_In_File("test3.txt");
            }

            if (radioButton2.Checked)
            {
                long[,] row_11new = new long[b_new_del, 1 + potok2];

                for (int i = 0; i < b_new_del; i++)
                {
                    row_11new[i, 0] = row_1new[i, 0];
                }

                for (int i = 0; i < b_new_del; i++)
                {
                    if (i < minimum_i)
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = row_1new[i, z];
                        }
                    }
                    else
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = row_1new[i + diff_i, z];
                        }
                    }
                }

                init_data.set_row1(row_11new);
                init_data.set_b(b_new_del);
                init_data.Row1_Write_In_File("test3.txt");
            }
        }
Example #3
0
        /// <summary>
        /// Вернуть точки ЭКГ
        /// </summary>
        /// <param name="combobox3">Данные регулировки</param>
        public void Return_Point_EKG(String combobox3)
        {
            int b = initial_data.get_b();

            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;
            bool dtr       = false;
            int  dtch      = 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];
            }
        }
Example #4
0
        private void button2_Click(object sender, EventArgs e)//Редактировать. Особые точки
        {
            label11.Text = " ";

            int min = Convert.ToInt32(Convert.ToDouble(this.textBox8.Text));
            int max = Convert.ToInt32(Convert.ToDouble(this.textBox7.Text));


            int minimum_delete_period = Convert.ToInt32(Convert.ToDouble(this.textBox6.Text));
            int maximum_delete_period = Convert.ToInt32(Convert.ToDouble(this.textBox5.Text));

            if (minimum_delete_period >= maximum_delete_period)
            {
                minimum_delete_period = 0;
                maximum_delete_period = 0;
            }

            if (minimum_delete_period < min)
            {
                minimum_delete_period = 0;
            }

            if (minimum_delete_period > max)
            {
                minimum_delete_period = max;
            }

            if (maximum_delete_period < min)
            {
                maximum_delete_period = 0;
            }

            if (maximum_delete_period >= max)
            {
                maximum_delete_period = max;
            }

            int minimum_i = 0;
            int maximum_i = 0;

            Initial_data init_data = new Initial_data("test3.txt", reg1, ekg1);

            init_data.Row1_Shift_Time_To_0(); //Сдвигаем время к 0
            init_data.Row1_Smothing();        // Сглаживаем полученные данные
            init_data.Row2_Calculate();
            init_data.Row3_Average_Canal_Reg();

            long[,] row_1new = init_data.get_row1();
            int b_new = init_data.get_b();

            Initial_processing.Divided_by_periods_data divided_row = new Initial_processing.Divided_by_periods_data(init_data, combobox_3);
            divided_row.Calculate_Data_In_Period();
            //  divided_row.delete_zero_in_period();

            minimum_i = Convert.ToInt32(divided_row.Return_Length_X_Zero(minimum_delete_period, 0));
            maximum_i = Convert.ToInt32(divided_row.Return_Length_X_Zero(maximum_delete_period, 0));

            int diff_i    = maximum_i - minimum_i;
            int b_new_del = b_new - diff_i;

            if (radioButton4.Checked)
            {
                long[,] row_11new = new long[b_new, 1 + potok2];

                for (int i = 0; i < b_new; i++)
                {
                    row_11new[i, 0] = row_1new[i, 0];
                }

                for (int i = 0; i < b_new; i++)
                {
                    if (i < maximum_i && i > minimum_i)
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = 0;
                        }
                    }
                    else
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = row_1new[i, z];
                        }
                    }
                }

                init_data.set_row1(row_11new);
                init_data.set_b(b_new);
                init_data.Row1_Write_In_File("test3.txt");
            }

            if (radioButton3.Checked)
            {
                long[,] row_11new = new long[b_new_del, 1 + potok2];

                for (int i = 0; i < b_new_del; i++)
                {
                    row_11new[i, 0] = row_1new[i, 0];
                }

                for (int i = 0; i < b_new_del; i++)
                {
                    if (i < minimum_i)
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = row_1new[i, z];
                        }
                    }
                    else
                    {
                        for (int z = 1; z <= potok2; z++)
                        {
                            row_11new[i, z] = row_1new[i + diff_i, z];
                        }
                    }
                }

                init_data.set_row1(row_11new);
                init_data.set_b(b_new_del);
                init_data.Row1_Write_In_File("test3.txt");
            }

            label11.Text = "Готово";
        }
Example #5
0
        /// <summary>
        /// Построить график ФПГ и е производной
        /// </summary>
        public void MakeGraph_On_Chosen_Canal()
        {
            long[,] row_1 = initdata.get_row1();
            long[] row_3 = initdata.get_row3();
            long[] row_4 = initdata.get_row4();
            int    b     = initdata.get_b();


            for (int y = 100; y < b - 10; y++)
            {
                if (maximum < row_1[y, initdata.REG])
                {
                    maximum = row_1[y, initdata.REG];
                }

                if (minimum > row_1[y, initdata.REG])
                {
                    minimum = row_1[y, initdata.REG];
                }
            }

            if ((maximum - minimum) < 200)
            {
                shift_grafh     = 200;
                shift_grafh_ekg = 200;
            }
            else if ((maximum - minimum) > 500)
            {
                shift_grafh     = -500;
                shift_grafh_ekg = 400;
            }
            else if ((maximum - minimum) > 1000)
            {
                shift_grafh     = -5500;
                shift_grafh_ekg = 5500;
            }
            else
            {
                shift_grafh_ekg = 200;
                shift_grafh     = -300;
            }


            // Создадим список точек для кривой f1(x)
            PointPairList f1_list      = new PointPairList();
            PointPairList f2_list      = new PointPairList();
            PointPairList f3_list      = new PointPairList();
            PointPairList f4_list      = new PointPairList();
            PointPairList f5_list_diff = new PointPairList();

            // Заполним массив точек для кривой f1-3(x)
            for (int y = 3; y < b - 10; y++)
            {
                f1_list.Add(row_1[y, 0] / 1000, row_4[y] + (shift_grafh_ekg));
                f2_list.Add(row_1[y, 0] / 1000, 570);
                f3_list.Add(row_1[y, 0] / 1000, shift_grafh);

                f4_list.Add(row_1[y, 0] / 1000, row_1[y, initdata.REG]);
                f5_list_diff.Add(row_1[y, 0] / 1000, row_3[y] / 10 + shift_grafh);
            }

            pane.XAxis.Title.Text = "t, мc";
            pane.YAxis.Title.Text = "R, Ом";
            pane.Title.Text       = "Данные";

            LineItem f1_curve      = pane.AddCurve("ЭКГ", f1_list, Color.Blue, SymbolType.None);
            LineItem f2_curve      = pane.AddCurve("", f2_list, Color.Black, SymbolType.None);
            LineItem f3_curve      = pane.AddCurve("", f3_list, Color.Black, SymbolType.None);
            LineItem f4_curve      = pane.AddCurve(" РЭГ", f4_list, Color.Red, SymbolType.None);
            LineItem f5_curve_diff = pane.AddCurve("Производная РЭГ", f5_list_diff, Color.Green, SymbolType.None);
        }