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()); } }
//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()); } } }