コード例 #1
0
        private void buttonStreamShimmer2_Click(object sender, EventArgs e)
        {
            buttonStreamShimmer2.Enabled = false;
            buttonStopShimmer2.Enabled   = true;
            _firstTimeShimmer2           = true;

            //SetupFilters();

            ////ECG-HR Conversion
            if (_enableECGtoHRConversion)
            {
                ECGtoHR = new ECGToHR(ShimmerDevice2.GetSamplingRate(), TrainingPeriodECG, NumberOfHeartBeatsToAverageECG);
            }
            ExGLeadOffCounter     = 0;
            ExGLeadOffCounterSize = (int)ShimmerDevice2.GetSamplingRate();
            ShimmerIdSetup.Clear();
            ShimmerDevice2.StartStreaming();
        }
コード例 #2
0
        private void SetupFilters()
        {
            //Create NQ Filters
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_16BIT) > 0)) && EnableNQF)
            {
                double cutoff = ShimmerDevice.GetSamplingRate() / 2;
                NQF_Exg1Ch1 = new Filter(Filter.LOW_PASS, ShimmerDevice.GetSamplingRate(), new double[] { cutoff });
                NQF_Exg1Ch2 = new Filter(Filter.LOW_PASS, ShimmerDevice.GetSamplingRate(), new double[] { cutoff });
            }

            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_16BIT) > 0)) && EnableNQF)
            {
                double cutoff = ShimmerDevice.GetSamplingRate() / 2;
                NQF_Exg2Ch1 = new Filter(Filter.LOW_PASS, ShimmerDevice.GetSamplingRate(), new double[] { cutoff });
                NQF_Exg2Ch2 = new Filter(Filter.LOW_PASS, ShimmerDevice.GetSamplingRate(), new double[] { cutoff });
            }

            //Create High Pass Filters for EXG

            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_16BIT) > 0)) && EnableHPF_0_05HZ)
            {
                HPF_Exg1Ch1 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.05 });
                HPF_Exg1Ch2 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.05 });
            }

            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_16BIT) > 0)) && EnableHPF_0_05HZ)
            {
                HPF_Exg2Ch1 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.05 });
                HPF_Exg2Ch2 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.05 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_16BIT) > 0)) && EnableHPF_0_5HZ)
            {
                HPF_Exg1Ch1 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.5 });
                HPF_Exg1Ch2 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.5 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_16BIT) > 0)) && EnableHPF_0_5HZ)
            {
                HPF_Exg2Ch1 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.5 });
                HPF_Exg2Ch2 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.5 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_16BIT) > 0)) && EnableHPF_5HZ)
            {
                HPF_Exg1Ch1 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 5 });
                HPF_Exg1Ch2 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 5 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_16BIT) > 0)) && EnableHPF_5HZ)
            {
                HPF_Exg2Ch1 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 5 });
                HPF_Exg2Ch2 = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 5 });
            }

            //Create Band Stop Filters for EXG
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_16BIT) > 0)) && EnableBSF_49_51HZ)
            {
                BSF_Exg1Ch1 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 49, 51 });
                BSF_Exg1Ch2 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 49, 51 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_16BIT) > 0)) && EnableBSF_49_51HZ)
            {
                BSF_Exg2Ch1 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 49, 51 });
                BSF_Exg2Ch2 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 49, 51 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG1_16BIT) > 0)) && EnableBSF_59_61HZ)
            {
                BSF_Exg1Ch1 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 59, 61 });
                BSF_Exg1Ch2 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 59, 61 });
            }
            if ((((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_24BIT) > 0) || ((ShimmerDevice.GetEnabledSensors() & (int)Shimmer.SensorBitmapShimmer3.SENSOR_EXG2_16BIT) > 0)) && EnableBSF_59_61HZ)
            {
                BSF_Exg2Ch1 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 59, 61 });
                BSF_Exg2Ch2 = new Filter(Filter.BAND_STOP, ShimmerDevice.GetSamplingRate(), new double[] { 59, 61 });
            }

            //PPG-HR Conversion
            if (EnablePPGtoHRConversion)
            {
                PPGtoHeartRateCalculation = new PPGToHRAlgorithm(ShimmerDevice.GetSamplingRate(), NumberOfHeartBeatsToAverage, TrainingPeriodPPG);
                LPF_PPG = new Filter(Filter.LOW_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 5 });
                HPF_PPG = new Filter(Filter.HIGH_PASS, ShimmerDevice.GetSamplingRate(), new double[] { 0.5 });
            }
        }