示例#1
0
 private void button8_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //P-Analysis ---------------------------------
         checkSaveSub.IsChecked = true;
         checkSample.IsChecked  = false;
         doTransform(0);
         sub.Close();
         //Concat Sub files & export ---------------------------------
         List <string> concat_txt      = TheTool.concatFile_OWS(sub_t.list_fileSave, true, 2);
         string        path_saveFolder = TheURL.totalView_path_saveRoot + @"[NEu]\" + sub_t.getSubSubFolder();
         TheTool.Folder_CreateIfMissing(path_saveFolder);
         string path_concatFile = path_saveFolder + @"\concat.csv";
         TheTool.exportFile(concat_txt, path_concatFile, false);
         //Learn MinMax & export ---------------------------------
         TheMinMaxNormaliz.getDataTable(path_concatFile);
         TheMinMaxNormaliz.buildMinMax_Euclidian_Table();
         TheTool.export_dataTable_to_CSV(path_saveFolder + @"\minmax.csv", TheMinMaxNormaliz.dt_MinMax_Euclidian);
         //--------------------
         doTransform(1);
         sub.confirmOnClose = true;
     }
     catch { }
 }
示例#2
0
        //Output is f2 and so on
        void selectCandidate_withText(
            string path_saveFolder,
            int methodSelection, int loopTime)
        {
            temp_summary.Clear();
            DateTime time_start = DateTime.Now;
            String   name       = TheTool.getFileName_byPath(path_saveFolder);

            TheTool.Folder_CreateIfMissing(path_saveFolder);
            path_saveFolder = path_saveFolder + @"\";
            //-----------------
            string         path_prefix = path_saveFolder + name + " Quality fi";
            List <Feature> list_S0     = model_generator.process02_selectCandidate(path_prefix, methodSelection, loopTime);

            temp_posture_current = TheMapData.convertfeaturelist_to_ListIf(list_S0);//add model
            temp_score_regession = model_generator.score_regression_summary;
            //-----------------
            int i = 1;

            foreach (Feature f in list_S0)
            {
                temp_summary.Add(getSummarizedFeature(i, f));
                i++;
            }
            //============================================
            int timespan = (int)DateTime.Now.Subtract(time_start).TotalMilliseconds;

            //----------------
            summary_total.Add("----- " + name + " (" + timespan + " ms) -----");
            summary_total.AddRange(temp_summary);
        }
示例#3
0
        //------------------

        private void butAnalyze_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string folderPath  = TheURL.url_saveFolder + "Analysis_" + DateTime.Now.ToString("ddHHmmssff");
                string note_path   = folderPath + @"\note.txt";
                string matrix_path = folderPath + @"\Matrix.csv";
                TheTool.Folder_CreateIfMissing(folderPath);
                List <String> matrix_data = new List <String>();
                String        matrix_Head = "";
                foreach (m_Motion motion in list_motions)
                {
                    matrix_Head += "," + motion.name;
                }
                matrix_data.Add(matrix_Head);
                //-------------------
                String path_RawData;
                foreach (DataRow r in dataTable.Rows)
                {
                    try
                    {
                        path_RawData = r[col_path].ToString();
                        matrix_data.Add(motionAnalysis(path_RawData, folderPath, this.list_motions));
                    }
                    catch (Exception ex) { TheSys.showError(r[col_path].ToString() + " : " + ex.ToString()); }
                }
                //--------------------
                TheTool.exportCSV_orTXT(matrix_path, matrix_data, false);
                TheTool.exportFile(TheSys.getText_List(), note_path, false);
                System.Windows.MessageBox.Show(@"Save to '" + folderPath + "'", "Export Data");
            }
            catch (Exception ex) { TheSys.showError(ex); }
        }
示例#4
0
 void export_Split()
 {
     try
     {
         int aa_start = TheTool.getInt(txtAAstart);
         int aa_range = TheTool.getInt(txtAARange);
         if (aa_range == 0)
         {
             checkAutoArrange.IsChecked = false;
         }
         int aa_i     = 0;
         int aa_i_max = TheTool.getPartition(splitter.Count, aa_range);
         //--------
         foreach (int[] split in splitter)
         {
             DataTable dt_split  = TheTool.dataTable_selectRow_byIndex(dataTable, split[0], split[1]);
             string    save_path = TheURL.url_saveFolder;
             if (checkAutoArrange.IsChecked.Value)
             {
                 save_path += @"\" + (aa_start + aa_i);
                 TheTool.Folder_CreateIfMissing(save_path);
             }
             save_path += @"\" + fileName + " (" + split[0] + "-" + split[1] + ").csv";
             TheTool.export_dataTable_to_CSV(save_path, dt_split);
             aa_i++;
             if (aa_i >= aa_i_max)
             {
                 aa_i = 0;
             }
         }
         System.Windows.MessageBox.Show(@"Save to '" + TheURL.url_saveFolder + "'", "Export CSV");
         txtAAstart.Text = (aa_start + aa_i_max).ToString();
     }
     catch (Exception ex) { TheSys.showError(ex); }
 }
示例#5
0
 private void butExport_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (mode != 1) // 0 = P-Analysis , 1 = Weka mode
         {
             string file_name0;
             if (fileName != "")
             {
                 file_name0 = fileName;
             }
             else
             {
                 file_name0 = DateTime.Now.ToString("MMdd HHmmss");
             }
             string path = TheURL.url_saveFolder + file_name0 + ".csv";
             //-------------
             TheTool.Folder_CreateIfMissing(TheURL.url_saveFolder);
             TheTool.export_dataTable_to_CSV(path, dataTable);
             System.Windows.MessageBox.Show(@"Save to '" + path);
         }
         confirmOnClose = false;
     }
     catch { }
 }
示例#6
0
 private void msr_butFolder_Click(object sender, RoutedEventArgs e)
 {
     try {
         TheTool.Folder_CreateIfMissing(path_folder_convert);
         Process.Start(path_folder_convert);
     }
     catch { }
 }
示例#7
0
        void save_SubTable()
        {
            string folderPath = path_saveRoot + folder_forSave;

            TheTool.Folder_CreateIfMissing(folderPath);
            folderPath = folderPath + @"\" + getSubSubFolder();
            TheTool.Folder_CreateIfMissing(folderPath);
            //
            string filePath = folderPath + @"\" + filename_current + ".csv";//Save in Folder

            TheTool.export_dataTable_to_CSV(filePath, sub_table);
            list_fileSave.Add(filePath);
        }
示例#8
0
 private void butConvertVerLab_Click(object sender, RoutedEventArgs e)
 {
     foreach (DataRow r in dataTable.Rows)
     {
         try
         {
             string path_origin = r[col_path].ToString();
             TheTool.Folder_CreateIfMissing(path_folder_convert);
             string path_save = path_folder_convert + TheTool.getFileName_byPath(path_origin) + ".csv";
             TheConverter.Verlab_convertFile(path_origin, path_save);
         }
         catch (Exception ex) { TheSys.showError(r[col_path].ToString() + " : " + ex.ToString()); }
     }
     System.Windows.MessageBox.Show(@"Save to file\[Convert]\");
 }
示例#9
0
 public static void MSR_convertFile(DataTable dt, string col_path, string path_saveFolder)
 {
     foreach (DataRow r in dt.Rows)
     {
         try
         {
             string path_origin = r[col_path].ToString();
             TheTool.Folder_CreateIfMissing(path_saveFolder);
             string path_save = path_saveFolder + TheTool.getFileName_byPath(path_origin) + ".csv";
             MSR_convertFile(path_origin, path_save);
         }
         catch (Exception ex) { TheSys.showError(r[col_path].ToString() + " : " + ex.ToString()); }
     }
     System.Windows.MessageBox.Show(@"Save to file\[Convert]\");
 }
示例#10
0
 private void butConvertMSRAction_Click(object sender, RoutedEventArgs e)
 {
     foreach (DataRow r in dataTable.Rows)
     {
         try
         {
             string path_origin = r[col_path].ToString();
             TheTool.Folder_CreateIfMissing(path_folder_convert);
             //-----------
             string sub_folder = path_folder_convert + "MSRAction " + TheTool.splitText(TheTool.getFileName_byPath(path_origin), "_")[0];
             TheTool.Folder_CreateIfMissing(sub_folder);
             //-----------
             string path_save = sub_folder + @"\" + TheTool.getFileName_byPath(path_origin) + ".csv";
             TheUKI.saveData_Raw(path_save, TheConverter.MSRAction_convert(path_origin));
         }
         catch (Exception ex) { TheSys.showError(r[col_path].ToString() + " : " + ex.ToString()); }
     }
     System.Windows.MessageBox.Show(@"Save to file\[Convert]\");
 }
示例#11
0
        int ang_techq    = TheUKI.angTechq_SC_HC;    //center to SC-HC
        public void exportFile(string fileName, string folderPrefix, Boolean posture_extraction, Boolean useGlobalMinMax, Boolean showDialog)
        {
            try
            {
                if (data_raw.Count() > 0)
                {
                    List <string> temp;
                    string        folderPath         = TheURL.url_saveFolder + folderPrefix + fileName;
                    string        folderPath_oth     = folderPath + @"\oth";
                    string        path_raw           = folderPath + @"\" + fileName + ".csv";
                    string        path_center_suffix = " (center" + TheUKI.getCenterTechqName(center_techq) + ")";
                    string        path_raw_centered  = folderPath + @"\" + fileName + path_center_suffix + ".csv";
                    string        path_bp            = folderPath + @"\" + fileName + " Atomic.csv";
                    string        path_log           = folderPath_oth + @"\" + fileName + " Log.csv";
                    string        path_plus          = folderPath_oth + @"\" + fileName + " Plus.csv";
                    string        path_movement      = folderPath_oth + @"\" + fileName + " Movement.csv";
                    string        path_GlobalMM      = TheURL.url_saveFolder + "[MinMax].csv";//in case Global
                    if (useGlobalMinMax == false)
                    {
                        path_GlobalMM = "";
                    }
                    TheTool.Folder_CreateIfMissing(folderPath);
                    TheTool.Folder_CreateIfMissing(folderPath_oth);
                    //--- RAW -------------------------------------------
                    TheUKI.saveData_Raw(path_raw, data_raw);
                    //--- RAW center to HipC ----------------------------
                    List <UKI_DataRaw> data_raw_centered = TheUKI.raw_centerBodyJoint(data_raw, center_techq);
                    TheUKI.saveData_Raw_centered(path_raw_centered, data_raw_centered, center_techq);
                    //--- Basic Posture ---------------------------------
                    List <string> data_bp_final = new List <string>();
                    data_bp_final.Add(TheUKI.data_bp_header());
                    data_bp_final.AddRange(TheUKI.getBasicPostureData(data_bp));
                    TheTool.exportCSV_orTXT(path_bp, data_bp_final, false);
                    //--- Log : Additional Data (Non-Analysis) ----------
                    List <string> data_log_final = new List <string>();
                    data_log_final.Add(TheUKI.data_log_header);
                    data_log_final.AddRange(data_log);
                    TheTool.exportCSV_orTXT(path_log, data_log_final, false);
                    //----- Movement Data ---------------------------
                    List <UKI_DataMovement> data_movement_adjusted = TheUKI.adjustMovementData(data_movement);
                    if (!posture_extraction)
                    {
                        TheUKI.exportData_Movement(data_movement_adjusted, path_movement, false);
                    }
                    //--- Additional Data For Analysis -----------------------
                    List <string> data_addition_full = TheUKI.createData_Additional(data_raw, data_raw_centered, data_add_01, center_techq);
                    temp = new List <string>();//data_addition_full with header
                    temp.Add(TheUKI.data_addition_full_header);
                    temp.AddRange(data_addition_full);
                    TheTool.exportCSV_orTXT(path_plus, temp, false);

                    //===================================================================
                    if (posture_extraction)
                    {
                        string folderPath_PE      = folderPath + @"\PosExtract";
                        string folderPath_Sparse  = folderPath + @"\Sparse";
                        string folderPath_Entropy = folderPath + @"\Entropy";
                        //
                        string path_note          = folderPath + @"\note.txt";
                        string path_plus_normal   = folderPath_oth + @"\" + fileName + " Plus Normal.csv";
                        string path_plus_discrete = folderPath_oth + @"\" + fileName + " Plus Descrete.csv";
                        string path_ang           = folderPath_oth + @"\" + fileName + " ANG(" + TheUKI.getAngTechqName(ang_techq) + ").csv";
                        //
                        string path_PE_raw_centered_extract = folderPath_PE + @"\" + fileName + " Extracted-01" + path_center_suffix + ".csv";
                        string path_PE_addition_extract     = folderPath_PE + @"\" + fileName + " Extracted-02 Plus.csv";
                        //
                        string path_raw_en           = folderPath_Entropy + @"\" + fileName + " Entropy-01 RAW.csv";
                        string path_raw_centered_en  = folderPath_Entropy + @"\" + fileName + " Entropy-02 RAW" + path_center_suffix + ".csv";
                        string path_plus_normal_en   = folderPath_Entropy + @"\" + fileName + " Entropy-03 Plus Normal.csv";
                        string path_plus_discrete_en = folderPath_Entropy + @"\" + fileName + " Entropy-04 Plus Discrete.csv";
                        string path_ang_en           = folderPath_Entropy + @"\" + fileName + " Entropy-11 ANG.csv";
                        string path_dist_en          = folderPath_Entropy + @"\" + fileName + " Entropy-12 Dist.csv";
                        //
                        TheTool.Folder_CreateIfMissing(folderPath_PE);
                        TheTool.Folder_CreateIfMissing(folderPath_Sparse);
                        TheTool.Folder_CreateIfMissing(folderPath_Entropy);
                        //--- Normalize & Discretize -------------------------
                        DataTable data_addition_normalized = ThePosExtract.getNormalizedTable(path_plus, path_GlobalMM, true);
                        TheTool.export_dataTable_to_CSV(path_plus_normal, data_addition_normalized);
                        DataTable data_discritized = TheTool.dataTable_discritize10Partition(data_addition_normalized);
                        TheTool.export_dataTable_to_CSV(path_plus_discrete, data_discritized);
                        //----- Angle Data ----------------------------------------
                        List <UKI_DataAngular> data_ang = TheUKI.calAngle_fromRaw(data_raw, ang_techq);
                        TheUKI.saveData_Ang(path_ang, data_ang);//save original
                        //----- (Prepare Key List) ----------------------
                        List <int[]> list_keyPose_Range = new List <int[]>();
                        list_keyPose_Range.AddRange(ThePosExtract.extractKeyPose_MyAlgo(data_movement_adjusted));
                        List <int> list_keyPose_ID = new List <int>();
                        list_keyPose_ID.AddRange(ThePosExtract.getKeyPose_ID_StartEnd(list_keyPose_Range));
                        //----- Movement Data ---------------------------
                        TheUKI.exportData_Movement(data_movement_adjusted, path_movement, true);//must be after "calMinimaMaxima"
                        //----- Basic Posture Analysis ------------------
                        List <UKI_Data_BasicPose> data_bp_selected = TheTool.list_SelectRow(data_bp, list_keyPose_ID);
                        ThePosExtract.BasicPostureAnalysis(data_bp_selected, true);
                        TheTool.exportFile(ThePosExtract.log_BasicPostureAnalysis, path_note, false);
                        TheSys.showError(ThePosExtract.log_BasicPostureAnalysis);
                        //----- Raw Extracted Data ----------------------------
                        List <UKI_DataRaw> data_raw_selected = TheTool.list_SelectRow(data_raw_centered, list_keyPose_ID);
                        TheUKI.saveData_Raw_centered(path_PE_raw_centered_extract, data_raw_selected, center_techq);
                        //----- Addition Extracted Data ----------------------------
                        List <String> data_addition_selected = TheTool.list_SelectRow(data_addition_full, list_keyPose_ID);
                        temp = new List <string>();//data_addition_full with header
                        temp.Add(TheUKI.data_addition_full_header);
                        temp.AddRange(data_addition_selected);
                        TheTool.exportCSV_orTXT(path_PE_addition_extract, temp, false);
                        //======= Feature Selecting Using Delta Analysis ==========================
                        ThePosExtract.ChangeAnalysis(path_PE_addition_extract, path_GlobalMM, folderPath_PE, fileName);
                        //======= Feature Selecting Using MI ======================================

                        //======= Entropy =========================================================
                        ThePosExtract.UKI_CalEntropy_Angle(path_ang_en, path_ang, list_keyPose_Range);
                        ThePosExtract.UKI_CalEntropy_Eu(path_dist_en, path_raw, list_keyPose_Range);
                        ThePosExtract.UKI_CalEntropy_1By1(path_raw_en, path_raw, list_keyPose_Range);
                        ThePosExtract.UKI_CalEntropy_1By1(path_raw_centered_en, path_raw_centered, list_keyPose_Range);
                        ThePosExtract.UKI_CalEntropy_1By1(path_plus_normal_en, path_plus_normal, list_keyPose_Range);
                        ThePosExtract.UKI_CalEntropy_1By1(path_plus_discrete_en, path_plus_discrete, list_keyPose_Range);
                        //======= Oth =========================================================
                        //---- Paper : Sparse ---------------------
                        CalSparse_XYZ.calSparse(data_raw_selected, folderPath_Sparse + @"\", fileName);//cal & export
                    }
                    if (showDialog)
                    {
                        System.Windows.MessageBox.Show(@"Save to '" + folderPath + "'", "Export Data");
                    }
                }
            }
            catch (Exception ex) { TheSys.showError("Export: " + ex); }
        }
示例#12
0
        void analyze_combined()
        {
            try
            {
                TheSys.showError("=================================");
                string fileName        = DateTime.Now.ToString("MMdd_HHmmss");
                string path_saveFolder = path_root + "Combine " + fileName + (" (FS)");
                //
                double partition_range = TheTool.getDouble(txtPartitionRange);
                path_saveFolder += "(p=" + partition_range + ")";
                //
                TheTool.Folder_CreateIfMissing(path_saveFolder); path_saveFolder = path_saveFolder + @"\";
                //-----------------
                motionModel_reset();
                summary_total.Clear();
                summary_total.Add(fileName + " Combination");
                if (checkSegment.IsChecked == false)
                {
                    string             path_raw_centered = path_saveFolder + "Combine " + fileName + " (center" + TheUKI.getCenterTechqName(centerTechnique) + ").csv";
                    List <UKI_DataRaw> list_raw_concat   = new List <UKI_DataRaw>();
                    foreach (Instance inst in container.list_inst)
                    {
                        list_raw_concat.AddRange(inst.getDataRaw(true));
                        summary_total.Add("- " + inst.name);
                    }
                    //----- Load Data >> Build Centered Data ---------------------------------------
                    DataTable dt_raw_center = UKI_ThePreprocessor.getDatatable_centered(list_raw_concat, checkExtraFeature.IsChecked.Value);//raw
                    TheTool.export_dataTable_to_CSV(path_raw_centered, dt_raw_center);
                    //----- Process  ---------------------------------------
                    //DataTable dt_raw = CSVReader.ReadCSVFile(path_raw_centered, true);//raw
                    //
                    DataTable dt_threshold_pose1 = dt_raw_center.Clone();
                    dt_threshold_pose1.Rows.Add(dt_raw_center.Rows[0].ItemArray);
                    DataTable dt_threshold_pose2 = dt_raw_center.Clone();
                    dt_threshold_pose2.Rows.Add(dt_raw_center.Rows[dt_raw_center.Rows.Count - 1].ItemArray);

                    analyze_Table(dt_raw_center, path_saveFolder, dt_threshold_pose1, dt_threshold_pose2);
                    motionModel_exportAll(path_saveFolder, "");
                    motionModel_evaluationAll();
                    TheSys.showError(summary_total);
                    TheTool.exportFile(summary_total, path_saveFolder + "result (combined).txt", false);
                }
                else
                {
                    //Assumption: all given Instance has same class
                    List <DataTable> dt_centered_concat_list = new List <DataTable>();
                    List <DataTable> dt_threshold            = new List <DataTable>();
                    UKI_ThePreprocessor.preprocess_CombinedSegmented(container.list_inst, checkExtraFeature.IsChecked.Value, ref dt_centered_concat_list, ref dt_threshold);
                    //-----
                    summary_total.AddRange(UKI_ThePreprocessor.temp_summary);
                    int[] mode  = UKI_ThePreprocessor.temp_mode;
                    int   p_key = 0;
                    foreach (DataTable dt_1pose in dt_centered_concat_list)
                    {
                        //1 Posture of Motion
                        int    p_id                = p_key + 1;
                        string subFolder           = "Pose " + p_id;
                        string path_saveFolder_sub = path_saveFolder + @"\" + subFolder;
                        TheTool.Folder_CreateIfMissing(path_saveFolder_sub);
                        path_saveFolder_sub += @"\";
                        string path_raw_centered = path_saveFolder_sub + " Combine " + fileName + " (center" + TheUKI.getCenterTechqName(centerTechnique) + ").csv";
                        TheTool.export_dataTable_to_CSV(path_raw_centered, dt_1pose);
                        //----------
                        summary_total.Add("");
                        summary_total.Add("Pose" + p_id + ":");
                        foreach (Instance inst in container.list_inst)
                        {
                            if (inst.keyPose.Count() == mode[0])
                            {
                                summary_total.Add("- " + inst.keyPose[p_key][0]
                                                  + "-" + inst.keyPose[p_key][1]
                                                  + " of " + inst.name);
                            }
                        }
                        analyze_Table(dt_1pose, path_saveFolder_sub, dt_threshold[0], dt_threshold[p_id]);
                        p_key++;
                    }
                    motionModel_exportAll(path_saveFolder, " (segmented combined)");
                    motionModel_evaluationAll();
                    summary_total.Add("");
                    //
                    List <string> threshold_data = TheTool.dataTable_CombineShuffle_getListString(dt_threshold);
                    TheTool.exportFile(threshold_data, path_saveFolder + "threshold.csv", false);
                    //
                    TheTool.exportFile(summary_total, path_saveFolder + "result (segmented combined).txt", false);
                    TheSys.showError(summary_total);
                }
            }
            catch (Exception ex)
            {
                TheSys.showError("Combined Analysis : " + ex.ToString());
            }
        }
示例#13
0
 //INPUT = All , Output = All
 void analyze_1By1()
 {
     foreach (Instance inst in container.list_inst)
     {
         //Per File (1 Whole Motion)
         try
         {
             TheSys.showError("=================================");
             string fileName        = TheTool.getFileName_byPath(inst.path);
             string path_saveFolder = path_root + fileName + (" (FS)");
             TheTool.Folder_CreateIfMissing(path_saveFolder); path_saveFolder = path_saveFolder + @"\";
             string path_raw_centered = path_saveFolder + fileName + " (center" + TheUKI.getCenterTechqName(centerTechnique) + ").csv";
             //-----------------
             motionModel_reset();
             //----- Load Data >> Build Centered Data ---------------------------------------
             DataTable dt_raw_center = UKI_ThePreprocessor.getDatatable_centered(inst.getDataRaw(checkExtraFeature.IsChecked.Value), checkExtraFeature.IsChecked.Value);//raw
             //----- Process  ---------------------------------------
             TheTool.export_dataTable_to_CSV(path_raw_centered, dt_raw_center);
             summary_total.Clear();
             summary_total.Add(fileName);
             if (checkSegment.IsChecked == false)
             {
                 DataTable dt_threshold_pose1 = dt_raw_center.Clone();
                 dt_threshold_pose1.Rows.Add(dt_raw_center.Rows[0].ItemArray);
                 DataTable dt_threshold_pose2 = dt_raw_center.Clone();
                 dt_threshold_pose2.Rows.Add(dt_raw_center.Rows[dt_raw_center.Rows.Count - 1].ItemArray);
                 analyze_Table(dt_raw_center, path_saveFolder, dt_threshold_pose1, dt_threshold_pose2);
                 motionModel_exportAll(path_saveFolder, "");
                 motionModel_evaluationAll();
                 summary_total.Add("");
                 TheSys.showError(summary_total);
                 TheTool.exportFile(summary_total, path_saveFolder + "result.txt", false);
             }
             else
             {
                 int          pose_number = 0;
                 List <int[]> key_pose    = inst.getKeyPose();
                 summary_total.Add((key_pose.Count - 1) + " Key Postures");
                 List <DataTable> dt_1pose_list      = TheTool.dataTable_split(dt_raw_center, key_pose);
                 DataTable        dt_threshold_pose1 = dt_raw_center.Clone();
                 dt_threshold_pose1.Rows.Add(dt_1pose_list.First().Rows[0].ItemArray);
                 foreach (DataTable dt_1pose in dt_1pose_list)
                 {
                     DataTable dt_threshold_pose2 = dt_raw_center.Clone();
                     dt_threshold_pose2.Rows.Add(dt_1pose.Rows[dt_1pose.Rows.Count - 1].ItemArray);
                     int    p_id  = pose_number + 1;
                     int    start = inst.keyPose[pose_number][0];
                     int    end   = inst.keyPose[pose_number][1];
                     string txt1  = "Pose" + p_id + ": " + start + "-" + end;
                     summary_total.Add("");
                     summary_total.Add(txt1);
                     //
                     string subFolder           = "Pose" + p_id + " (" + start + "-" + end + ")";
                     string path_saveFolder_sub = path_saveFolder + subFolder;
                     TheTool.Folder_CreateIfMissing(path_saveFolder_sub);
                     path_saveFolder_sub = path_saveFolder_sub + @"\";
                     //TheTool.export_dataTable_to_CSV(path_saveFolder_sub + "data.csv", dt);
                     analyze_Table(dt_1pose, path_saveFolder_sub, dt_threshold_pose1, dt_threshold_pose2);
                     pose_number++;
                 }
                 motionModel_exportAll(path_saveFolder, " (segmented)");
                 motionModel_evaluationAll();
                 summary_total.Add("");
                 TheSys.showError(summary_total);
                 TheTool.exportFile(summary_total, path_saveFolder + "result (segmented).txt", false);
             }
         }
         catch (Exception ex) { TheSys.showError(inst.path + " : " + ex.ToString()); }
     }
 }
示例#14
0
        private void butUKIconvert_Click(object sender, RoutedEventArgs e)
        {
            String fileName;
            String path_raw;
            String path_raw_centered;
            String path_ang;
            String path_ang_en;
            String path_raw_en;
            String path_dist_en;
            int    ang_techq    = comboAngTech.SelectedIndex;   //center of angle
            int    center_techq = comboRawCenter.SelectedIndex; //center of body position

            foreach (DataRow r in dataTable.Rows)
            {
                path_raw = r[col_path].ToString();
                fileName = TheTool.getFileName_byPath(path_raw);
                TheTool.Folder_CreateIfMissing(path_folder_convert + fileName);
                String path_sub_folder = path_folder_convert + fileName + @"\";
                path_raw_centered = path_sub_folder + fileName + " (center" + TheUKI.getCenterTechqName(center_techq) + ").csv";
                path_ang          = path_sub_folder + fileName + " ANG(" + TheUKI.getAngTechqName(ang_techq) + ").csv";
                path_ang_en       = path_sub_folder + fileName + " ANG_Entropy.csv";
                path_raw_en       = path_sub_folder + fileName + " RAW_Entropy.csv";
                path_dist_en      = path_sub_folder + fileName + " Dist_Entropy.csv";
                if (center_techq > 0)
                {
                    path_raw_en = path_sub_folder + fileName +
                                  " (center" + TheUKI.getCenterTechqName(center_techq) + ") RAW_Entropy.csv";
                }
                //----- Raw -----
                List <UKI_DataRaw> list_raw = TheUKI.csv_loadFileTo_DataRaw(path_raw, 0);
                //----- Angle ---------
                List <UKI_DataAngular> list_ang = TheUKI.calAngle_fromRaw(list_raw, ang_techq);
                if (checkUKI_Angle.IsChecked.Value || checkUKI_E_Angle.IsChecked.Value)
                {
                    TheUKI.saveData_Ang(path_ang, list_ang);
                }
                //---------------------
                //List<int> keyPostureId = UKI_getKeyPostureId();
                List <int[]> keyPostureRange = ThePosExtract.getKetPose_Range_from1String(txtUKI_keyID.Text);
                //----- Angle Entropy ---------
                if (checkUKI_E_Angle.IsChecked.Value)
                {
                    ThePosExtract.UKI_CalEntropy_Angle(path_ang_en, path_ang, keyPostureRange);
                }
                //----- Dist ---------
                if (checkUKI_E_Dist.IsChecked.Value)
                {
                    ThePosExtract.UKI_CalEntropy_Eu(path_dist_en, path_raw, keyPostureRange);
                }
                //----- XYZ Entropy ---------
                if (checkUKI_E_XYZ.IsChecked.Value)
                {
                    if (center_techq > 0)
                    {
                        List <UKI_DataRaw> list_raw_centered = TheUKI.raw_centerBodyJoint(list_raw, center_techq);
                        TheUKI.saveData_Raw_centered(path_raw_centered, list_raw_centered, center_techq);
                        ThePosExtract.UKI_CalEntropy_1By1(path_raw_en, path_raw_centered, keyPostureRange);
                    }
                    else
                    {
                        ThePosExtract.UKI_CalEntropy_1By1(path_raw_en, path_raw, keyPostureRange);
                    }
                }
            }
            System.Windows.MessageBox.Show(@"Save to file\[Convert]");
        }