Example #1
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()); }
     }
 }