Exemple #1
0
        private void ReadResults()   //parse the .csv files with tracking results
        {
            string resultsPath = "";
            var    files       = Directory.EnumerateFiles(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")));

            foreach (string current in files)
            {
                if (current.Contains(".csv"))
                {
                    resultsPath = current; break;
                }
            }

            if (!resultsPath.Equals(""))
            {
                using (var streamReader = new StreamReader(resultsPath)) {
                    String[] rows = Regex.Split(streamReader.ReadToEnd(), "\r\n");
                    for (int i = 3; i < rows.Count(); i++)
                    {
                        if (rows[i].Length > 5) //to eliminate empty spaces at the end
                        {
                            String[] splitLine = rows[i].Split(',');

                            RightMidPointXs.Add(float.Parse(splitLine[1])); //for now we're skipping probability -> stepping over every third column
                            RightMidPointYs.Add(GaitVideoHeight - float.Parse(splitLine[2]));
                            LeftMidPointXs.Add(float.Parse(splitLine[4]));
                            LeftMidPointYs.Add(GaitVideoHeight - float.Parse(splitLine[5]));
                            SuperButtXs.Add(float.Parse(splitLine[7]));
                            SuperButtYs.Add(GaitVideoHeight - float.Parse(splitLine[8]));
                            NoseXs.Add(float.Parse(splitLine[10]));
                            NoseYs.Add(GaitVideoHeight - float.Parse(splitLine[11]));

                            FrontRightHeelXs.Add(float.Parse(splitLine[13])); //heel marker
                            FrontRightHeelYs.Add(GaitVideoHeight - float.Parse(splitLine[14]));
                            FrontRightXs.Add(float.Parse(splitLine[16]));     //toe marker
                            FrontRightYs.Add(GaitVideoHeight - float.Parse(splitLine[17]));

                            FrontLeftHeelXs.Add(float.Parse(splitLine[19]));
                            FrontLeftHeelYs.Add(GaitVideoHeight - float.Parse(splitLine[20]));
                            FrontLeftXs.Add(float.Parse(splitLine[22]));
                            FrontLeftYs.Add(GaitVideoHeight - float.Parse(splitLine[23]));

                            HindRightHeelXs.Add(float.Parse(splitLine[25]));
                            HindRightHeelYs.Add(GaitVideoHeight - float.Parse(splitLine[26]));
                            HindRightXs.Add(float.Parse(splitLine[28]));
                            HindRightYs.Add(GaitVideoHeight - float.Parse(splitLine[29]));

                            HindLeftHeelXs.Add(float.Parse(splitLine[31]));
                            HindLeftHeelYs.Add(GaitVideoHeight - float.Parse(splitLine[32]));
                            HindLeftXs.Add(float.Parse(splitLine[34]));
                            HindLeftYs.Add(GaitVideoHeight - float.Parse(splitLine[35]));
                        }
                    }
                }
            }
        }
Exemple #2
0
        // MARK: UI Methods

        private void GaitExportButton_Click(object sender, RoutedEventArgs e)
        {
            PrepSEM();
            SaveCurrentState();
            ExportStaticGaitData();
            ExportDynamicGaitData();
            //ExportCrossCorrelation();
            MessageBox.Show("Both static and dynamic data were exported.", "Data Exported", MessageBoxButton.OK);
            Process.Start("explorer.exe", GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export");
        }
Exemple #3
0
        // MARK: Export Cross Correlation Data - NOT IN USE CURRENTLY

        private void ExportCrossCorrelation()
        {
            StringBuilder csv;
            string        newLine;

            csv = new StringBuilder();

            newLine = string.Format("{0},{1},{2},{3},{4}", "Index", "Hind Paws", "Fore Paws", "Left Hind to Right Fore", "Right Hind to Left Fore"); //headers
            csv.AppendLine(newLine);

            for (int i = 0; i < HindLimbsCrossCorrelation.Count; i++)
            {
                newLine = string.Format("{0},{1},{2},{3},{4}", i, HindLimbsCrossCorrelation[i], ForeLimbsCrossCorrelation[i], HindLeftToForeRightCC[i], HindRightToForeLeftCC[i]);
                csv.AppendLine(newLine);
            }

            File.WriteAllText(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export\\" + "cross_correlation.csv", csv.ToString());
        }
Exemple #4
0
        // Adjust Settings Button
        private void GaitAdjustSettingsButton_Click(object sender, RoutedEventArgs e)
        {
            string stateFolder = GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gaitsavedstate";

            string gaitVideoName = GaitVideoPath.Substring(GaitVideoPath.LastIndexOf("\\") + 1, GaitVideoPath.LastIndexOf(".") - GaitVideoPath.LastIndexOf("\\"));
            string gaitTempPath  = GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\temp-" + gaitVideoName;
            var    files         = Directory.EnumerateFiles(gaitTempPath);
            var    file          = ""; //might crash

            foreach (var currentImg in files)
            {
                if (currentImg.Contains(".png"))
                {
                    file = currentImg;
                    break;
                }
            }
            BarInteraction();

            MeasureWindow window = new MeasureWindow(file, stateFolder); //spawn the same settings window as before

            if (window.ShowDialog() == true)
            {
                RealWorldMultiplier = window.getSinglePixelSize();
                TreadmillSpeed      = float.Parse(window.TreadmillSpeedTextBox.Text);
                if ((bool)window.AnalysisTypeRadioFreeWalking.IsChecked)
                {
                    IsFreeRun = true;
                }
                else
                {
                    IsFreeRun = false;
                }

                SetStaticData();
                UpdateFrame(false);
                EnableInteraction();
            }
            else
            {
                EnableInteraction();
            }
        }
Exemple #5
0
        private void SaveCurrentState()
        {
            string stateFolder = GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gaitsavedstate";

            Directory.CreateDirectory(stateFolder);

            //saving input params
            List <string> tempList = new List <string>();

            tempList.Add(RealWorldMultiplier.ToString());
            tempList.Add(TreadmillSpeed.ToString());
            tempList.Add(IsFreeRun ? "1" : "0");
            tempList.Add(bias.ToString());
            System.IO.File.WriteAllLines(stateFolder + "\\inputParams.txt", tempList);

            // Save inStance lists and metrics
            SaveInStanceData(stateFolder);
            SaveMetrics(stateFolder);
        }
Exemple #6
0
        // MARK: Read Saved data or calculate from scratch


        private void ReadCurrentState(bool loadPrevious)
        {
            string stateFolder = GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gaitsavedstate";

            // Gait Input Parameters
            if (loadPrevious)
            {
                if (File.Exists(stateFolder + "\\inputParams.txt"))
                {
                    List <double> tempList = File.ReadAllLines(stateFolder + "\\inputParams.txt").ToList().ConvertAll(item => double.Parse(item));
                    if (tempList.Count >= 3)
                    {
                        RealWorldMultiplier = tempList[0];
                        TreadmillSpeed      = tempList[1];
                        IsFreeRun           = tempList[2] == 1;
                    }
                    if (tempList.Count > 3)
                    {
                        bias = tempList[3];
                    }
                    else
                    {
                        bias = 0.25;    // Old versions of VGL have this default bias
                    }
                }
            }

            // Read in stance List
            if (loadPrevious && Directory.Exists(stateFolder) && File.Exists(stateFolder + "\\HindLeftInStance.txt") && File.Exists(stateFolder + "\\HindRightInStance.txt") && File.Exists(stateFolder + "\\FrontLeftInStance.txt") && File.Exists(stateFolder + "\\FrontRightInStance.txt"))
            {
                HindLeftInStance   = File.ReadAllLines(stateFolder + "\\HindLeftInStance.txt").ToList().ConvertAll(item => int.Parse(item));
                HindRightInStance  = File.ReadAllLines(stateFolder + "\\HindRightInStance.txt").ToList().ConvertAll(item => int.Parse(item));
                FrontLeftInStance  = File.ReadAllLines(stateFolder + "\\FrontLeftInStance.txt").ToList().ConvertAll(item => int.Parse(item));
                FrontRightInStance = File.ReadAllLines(stateFolder + "\\FrontRightInStance.txt").ToList().ConvertAll(item => int.Parse(item));

                if (File.Exists(stateFolder + "\\HindLeftMidPointXs.txt") && File.Exists(stateFolder + "\\HindLeftMidPointYs.txt") && File.Exists(stateFolder + "\\HindRightMidPointXs.txt") && File.Exists(stateFolder + "\\HindRightMidPointYs.txt") &&
                    File.Exists(stateFolder + "\\FrontLeftMidPointXs.txt") && File.Exists(stateFolder + "\\FrontLeftMidPointYs.txt") && File.Exists(stateFolder + "\\FrontRightMidPointXs.txt") && File.Exists(stateFolder + "\\FrontRightMidPointYs.txt"))
                {
                    HindLeftMidPointXs = File.ReadAllLines(stateFolder + "\\HindLeftMidPointXs.txt").ToList().ConvertAll(item => double.Parse(item));
                    HindLeftMidPointYs = File.ReadAllLines(stateFolder + "\\HindLeftMidPointYs.txt").ToList().ConvertAll(item => double.Parse(item));

                    HindRightMidPointXs = File.ReadAllLines(stateFolder + "\\HindRightMidPointXs.txt").ToList().ConvertAll(item => double.Parse(item));
                    HindRightMidPointYs = File.ReadAllLines(stateFolder + "\\HindRightMidPointYs.txt").ToList().ConvertAll(item => double.Parse(item));

                    FrontLeftMidPointXs = File.ReadAllLines(stateFolder + "\\FrontLeftMidPointXs.txt").ToList().ConvertAll(item => double.Parse(item));
                    FrontLeftMidPointYs = File.ReadAllLines(stateFolder + "\\FrontLeftMidPointYs.txt").ToList().ConvertAll(item => double.Parse(item));

                    FrontRightMidPointXs = File.ReadAllLines(stateFolder + "\\FrontRightMidPointXs.txt").ToList().ConvertAll(item => double.Parse(item));
                    FrontRightMidPointYs = File.ReadAllLines(stateFolder + "\\FrontRightMidPointYs.txt").ToList().ConvertAll(item => double.Parse(item));
                }

                MessageBox.Show("Loaded saved data from previous session.", "Data Loaded", MessageBoxButton.OK);
            }
            else
            {
                // Calculate in stance arrays for all paws (0 means that in the current frame the paw is in swing and 1 means that it's in stance)
                if (IsFreeRun)
                {
                    HindLeftInStance   = GetCatWalkInStanceArray(HindLeftXs, HindLeftYs, HindLeftHeelXs, HindLeftHeelYs, ref HindLeftMidPointXs, ref HindLeftMidPointYs);
                    HindRightInStance  = GetCatWalkInStanceArray(HindRightXs, HindRightYs, HindRightHeelXs, HindRightHeelYs, ref HindRightMidPointXs, ref HindRightMidPointYs);
                    FrontLeftInStance  = GetCatWalkInStanceArray(FrontLeftXs, FrontLeftYs, FrontLeftHeelXs, FrontLeftHeelYs, ref FrontLeftMidPointXs, ref FrontLeftMidPointYs);
                    FrontRightInStance = GetCatWalkInStanceArray(FrontRightXs, FrontRightYs, FrontRightHeelXs, FrontRightHeelYs, ref FrontRightMidPointXs, ref FrontRightMidPointYs);
                }
                else
                {
                    HindLeftInStance   = GetTreadMillInStanceArray(HindLeftXs);
                    HindRightInStance  = GetTreadMillInStanceArray(HindRightXs);
                    FrontLeftInStance  = GetTreadMillInStanceArray(FrontLeftXs);
                    FrontRightInStance = GetTreadMillInStanceArray(FrontRightXs);
                }
            }
        }
Exemple #7
0
        // MARK: Dynamic Data Export Methods

        private void ExportDynamicGaitData()   //exports all dynamic data into separate CSVs by paw and stride (Eg. hindleft_stride3, frontleft_stride2, etc.)
        {
            StringBuilder csv;
            string        newLine;

            for (int i = 0; i < HindLeftNumberOfStrides; i++)   //Hind Left
            {
                csv = new StringBuilder();

                //headers
                newLine = string.Format("{0},{1},{2},{3},{4}", "Frame", "Stride Length", "Paw Angle", "Stance Width", "Step Angle");
                csv.AppendLine(newLine);

                //values for each Frame for a given stride
                for (int currentFrame = HindLeftSwitchPositions[i * 2]; currentFrame < HindLeftSwitchPositions[i * 2 + 2]; currentFrame++)
                {
                    string formattedAngle = "";              //empty by default
                    CalculateCenterOfMass(currentFrame);     //TODO: don't remember why I'm calculating the angle all over again
                    if (HindLeftInStance[currentFrame] == 1) //if it's stance actually caluclate the angle, else just leave it blank (because it's swing and we don't want to include those values)
                    {
                        double angle = GetPawAngle(HindLeftYs[currentFrame], HindLeftHeelYs[currentFrame], HindLeftXs[currentFrame], HindLeftHeelXs[currentFrame], CenterOfMassY, SuperButtYs[currentFrame], CenterOfMassX, SuperButtXs[currentFrame]);
                        formattedAngle = string.Format("{0:00.00}", angle);
                    }

                    float  midPointTop          = (HindRightHeelYs[currentFrame] + HindRightYs[currentFrame]) / 2;
                    float  midPointBottom       = (HindLeftHeelYs[currentFrame] + HindLeftYs[currentFrame]) / 2;
                    string formattedStanceWidth = string.Format("{0:00.00}", (midPointTop - midPointBottom) * RealWorldMultiplier);

                    newLine = string.Format("{0},{1},{2},{3},{4}", currentFrame, HindLeftStrides[i], formattedAngle, formattedStanceWidth, "");
                    csv.AppendLine(newLine);
                }

                File.WriteAllText(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export\\" + "hindleft_stride" + i + ".csv", csv.ToString());
            }

            for (int i = 0; i < HindRightNumberOfStrides; i++)   //Hind Right
            {
                csv = new StringBuilder();

                //headers
                newLine = string.Format("{0},{1},{2},{3},{4}", "Frame", "Stride Length", "Paw Angle", "Stance Width", "Step Angle");
                csv.AppendLine(newLine);

                //values for each Frame for a given stride
                for (int currentFrame = HindRightSwitchPositions[i * 2]; currentFrame < HindRightSwitchPositions[i * 2 + 2]; currentFrame++)
                {
                    string formattedAngle = "";
                    CalculateCenterOfMass(currentFrame);
                    if (HindRightInStance[currentFrame] == 1)
                    {
                        double angle = GetPawAngle(HindRightYs[currentFrame], HindRightHeelYs[currentFrame], HindRightXs[currentFrame], HindRightHeelXs[currentFrame], CenterOfMassY, SuperButtYs[currentFrame], CenterOfMassX, SuperButtXs[currentFrame]);
                        formattedAngle = string.Format("{0:00.00}", angle);
                    }

                    float  midPointTop          = (HindRightHeelYs[currentFrame] + HindRightYs[currentFrame]) / 2;
                    float  midPointBottom       = (HindLeftHeelYs[currentFrame] + HindLeftYs[currentFrame]) / 2;
                    string formattedStanceWidth = string.Format("{0:00.00}", (midPointTop - midPointBottom) * RealWorldMultiplier);

                    newLine = string.Format("{0},{1},{2},{3},{4}", currentFrame, HindRightStrides[i], formattedAngle, formattedStanceWidth, "");
                    csv.AppendLine(newLine);
                }

                File.WriteAllText(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export\\" + "hindright_stride" + i + ".csv", csv.ToString());
            }

            for (int i = 0; i < FrontLeftNumberOfStrides; i++)   //Front Left
            {
                csv = new StringBuilder();

                //headers
                newLine = string.Format("{0},{1},{2},{3},{4}", "Frame", "Stride Length", "Paw Angle", "Stance Width", "Step Angle");
                csv.AppendLine(newLine);

                //values for each Frame for a given stride
                for (int currentFrame = FrontLeftSwitchPositions[i * 2]; currentFrame < FrontLeftSwitchPositions[i * 2 + 2]; currentFrame++)
                {
                    string formattedAngle = "";
                    CalculateCenterOfMass(currentFrame);
                    if (FrontLeftInStance[currentFrame] == 1)
                    {
                        double angle = GetPawAngle(FrontLeftYs[currentFrame], FrontLeftHeelYs[currentFrame], FrontLeftXs[currentFrame], FrontLeftHeelXs[currentFrame], NoseYs[currentFrame], CenterOfMassY, NoseXs[currentFrame], CenterOfMassX);
                        formattedAngle = string.Format("{0:00.00}", angle);
                    }

                    float  midPointTop          = (FrontRightHeelYs[currentFrame] + FrontRightYs[currentFrame]) / 2;
                    float  midPointBottom       = (FrontLeftHeelYs[currentFrame] + FrontLeftYs[currentFrame]) / 2;
                    string formattedStanceWidth = string.Format("{0:00.00}", (midPointTop - midPointBottom) * RealWorldMultiplier);

                    newLine = string.Format("{0},{1},{2},{3},{4}", currentFrame, FrontLeftStrides[i], formattedAngle, formattedStanceWidth, "");
                    csv.AppendLine(newLine);
                }

                File.WriteAllText(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export\\" + "frontleft_stride" + i + ".csv", csv.ToString());
            }

            for (int i = 0; i < FrontRightNumberOfStrides; i++)   //Front Right
            {
                csv = new StringBuilder();

                //headers
                newLine = string.Format("{0},{1},{2},{3},{4}", "Frame", "Stride Length", "Paw Angle", "Stance Width", "Step Angle");
                csv.AppendLine(newLine);

                //values for each Frame for a given stride
                for (int currentFrame = FrontRightSwitchPositions[i * 2]; currentFrame < FrontRightSwitchPositions[i * 2 + 2]; currentFrame++)
                {
                    string formattedAngle = "";
                    CalculateCenterOfMass(currentFrame);
                    if (FrontRightInStance[currentFrame] == 1)
                    {
                        double angle = GetPawAngle(FrontRightYs[currentFrame], FrontRightHeelYs[currentFrame], FrontRightXs[currentFrame], FrontRightHeelXs[currentFrame], NoseYs[currentFrame], CenterOfMassY, NoseXs[currentFrame], CenterOfMassX);
                        formattedAngle = string.Format("{0:00.00}", angle);
                    }

                    float  midPointTop          = (FrontRightHeelYs[currentFrame] + FrontRightYs[currentFrame]) / 2;
                    float  midPointBottom       = (FrontLeftHeelYs[currentFrame] + FrontLeftYs[currentFrame]) / 2;
                    string formattedStanceWidth = string.Format("{0:00.00}", (midPointTop - midPointBottom) * RealWorldMultiplier);

                    newLine = string.Format("{0},{1},{2},{3},{4}", currentFrame, FrontRightStrides[i], formattedAngle, formattedStanceWidth, "");
                    csv.AppendLine(newLine);
                }

                File.WriteAllText(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export\\" + "frontright_stride" + i + ".csv", csv.ToString());
            }
        }
Exemple #8
0
        //MARK: Static Data Export Methods

        private void ExportStaticGaitData()   //exports all static data into a single csv file
        {
            var csv     = new StringBuilder();
            var newLine = string.Format("{0},{1},{2},{3},{4}", "", "Left Hind", "Right Hind", "Left Fore", "Right Fore");

            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Average Stance (ms)", HindLeftAverageStanceDuration, HindRightAverageStanceDuration, FrontLeftAverageStanceDuration, FrontRightAverageStanceDuration);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Standard Error of Mean", HindLeftAverageStanceDurationSEM, HindRightAverageStanceDurationSEM, FrontLeftAverageStanceDurationSEM, FrontRightAverageStanceDurationSEM);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Average Swing (ms)", HindLeftAverageSwingDuration, HindRightAverageSwingDuration, FrontLeftAverageSwingDuration, FrontRightAverageSwingDuration);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Standard Error of Mean", HindLeftAverageSwingDurationSEM, HindRightAverageSwingDurationSEM, FrontLeftAverageSwingDurationSEM, FrontRightAverageSwingDurationSEM);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Average Stride (ms)", HindLeftAverageStanceDuration + HindLeftAverageSwingDuration, HindRightAverageStanceDuration + HindRightAverageSwingDuration, FrontLeftAverageStanceDuration + FrontLeftAverageSwingDuration, FrontRightAverageStanceDuration + FrontRightAverageSwingDuration);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Standard Error of Mean", HindLeftStrideDurationSEM, HindRightStrideDurationSEM, FrontLeftStrideDurationSEM, FrontRightStrideDurationSEM);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Percentage Stance", LHStancePercentageLabel.Text, RHStancePercentageLabel.Text, LFStancePercentageLabel.Text, RFStancePercentageLabel.Text);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Percentage Swing", LHSwingPercentageLabel.Text, RHSwingPercentageLabel.Text, LFSwingPercentageLabel.Text, RFSwingPercentageLabel.Text);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Swing to Stance", LHSwingToStanceLabel.Text, RHSwingToStanceLabel.Text, LFSwingToStanceLabel.Text, RFSwingToStanceLabel.Text);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Stride Frequency (Hz)", LHFrequencyLabel.Text, RHFrequencyLabel.Text, LFFrequencyLabel.Text, RFFrequencyLabel.Text);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Number of Strides", HindLeftNumberOfStrides, HindRightNumberOfStrides, FrontLeftNumberOfStrides, FrontRightNumberOfStrides);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Stride Length Variability", LHStrideLengthVariabilityLabel.Text, RHStrideLengthVariabilityLabel.Text, LFStrideLengthVariabilityLabel.Text, RFStrideLengthVariabilityLabel.Text);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Gait Symmetry", LFGaitSymmetryLabel.Text, LFGaitSymmetryLabel.Text, LFGaitSymmetryLabel.Text, LFGaitSymmetryLabel.Text);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Paw Angle Avg (deg)", HindLeftPawAngleAvg, HindRightPawAngleAvg, FrontLeftPawAngleAvg, FrontRightPawAngleAvg);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Standard Error of Mean", HindLeftPawAngleSEM, HindRightPawAngleSEM, FrontLeftPawAngleSEM, FrontRightPawAngleSEM);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Stance Width Avg (mm)", HindStanceWidthAvg, HindStanceWidthAvg, ForeStanceWidthAvg, ForeStanceWidthAvg);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Standard Error of Mean", HindStanceWidthSEM, HindStanceWidthSEM, ForeStanceWidthSEM, ForeStanceWidthSEM);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Stride Length Avg (mm)", HindLeftStrideLenAvg, HindRightStrideLenAvg, FrontLeftStrideLenAvg, FrontRightStrideLenAvg);
            csv.AppendLine(newLine);

            newLine = string.Format("{0},{1},{2},{3},{4}", "Standard Error of Mean", HindLeftStrideLenSEM, HindRightStrideLenSEM, FrontLeftStrideLenSEM, FrontRightStrideLenSEM);
            csv.AppendLine(newLine);

            if (!Directory.Exists(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export"))
            {
                Directory.CreateDirectory(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export");
            }
            File.WriteAllText(GaitVideoPath.Substring(0, GaitVideoPath.LastIndexOf("\\")) + "\\gait-export\\staticdata.csv", csv.ToString());
        }