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 { } }
void subTable_calJointEuclidian(int fileID, DataTable dt) { try { //================================================= //============= Write Sub Table ================== //build Column First columnAdd_forJoints(dt, col_s_suffix_d); //====================================================== //------ Variable For cal Euclidian Distance double[] lastXYZ = { 0, 0, 0 }; double[] currentXYZ = { 0, 0, 0 }; List <double> list_D; double dist; //====================================================== foreach (string joint in TheTool.joint_list_upperOnly)//Column first method { list_D = new List <double> { }; if (normaliz_method == 4) { TheMinMaxNormaliz.getMinMax(joint, ref temp_Dist_min, ref temp_Dist_max); } //------ Cal AvgC ----------------------------- //double avg_C = TheTool_Stat.calAvg_byCol(dt, joint + "_c", decimalNum); //dataTable.Rows[fileID][joint + col_m_cAvg] = avg_C; //------ Cal Joint D ----------------------------- for (int row = 0; row < dt.Rows.Count; row++) { //------ Cal Euclidian -------------------------------- currentXYZ = TheTool.getDouble_fromJoint(dt, row, joint); if (row == 0) { dt.Rows[row][joint + col_s_suffix_d] = "0"; } else { dist = TheTool_Stat.calEuclidean(currentXYZ, lastXYZ, decimalNum); if (normaliz_method == 4) { dist = TheTool_Stat.calMinMaxNormalize(dist, temp_Dist_min, temp_Dist_max); } dt.Rows[row][joint + col_s_suffix_d] = dist; list_D.Add(dist); } lastXYZ = currentXYZ; } //================================================= //============= Write Main Table ================== calMainTable(list_D, fileID, joint); } } catch { } }
//*************************************************************** //*********************** Super Normalize**************************** //Learn where is Min - Max private void butLearn_Click(object sender, RoutedEventArgs e) { Nullable <bool> openDialog = TheTool.openFileDialog_01(false, ".csv", ""); // Get the selected file name and display in a TextBox if (openDialog == true) { TheMinMaxNormaliz.getDataTable(TheTool.dialog.FileName); if (TheMinMaxNormaliz.minmax_Euclidian_ready) { TheMinMaxNormaliz.showMinMax_Euclidian_Table(); butA2.IsEnabled = true; } ; } }