diff --git a/EcomAnalysis/Form1.Designer.cs b/EcomAnalysis/Form1.Designer.cs index aa045e7..7e123c9 100644 --- a/EcomAnalysis/Form1.Designer.cs +++ b/EcomAnalysis/Form1.Designer.cs @@ -47,16 +47,17 @@ this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.label10 = new System.Windows.Forms.Label(); - this.TxtSubject = new System.Windows.Forms.TextBox(); - this.label11 = new System.Windows.Forms.Label(); this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.label10 = new System.Windows.Forms.Label(); + this.TxtSubject = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); this.BtnSaveSceneTable = new System.Windows.Forms.Button(); this.saveFileDialogCsv = new System.Windows.Forms.SaveFileDialog(); this.label12 = new System.Windows.Forms.Label(); this.TxtVisit = new System.Windows.Forms.TextBox(); + this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.SuspendLayout(); // // label1 @@ -250,6 +251,7 @@ this.columnHeader1, this.columnHeader2, this.columnHeader3, + this.columnHeader9, this.columnHeader4, this.columnHeader5, this.columnHeader6, @@ -284,16 +286,39 @@ // // columnHeader4 // + this.columnHeader4.DisplayIndex = 4; this.columnHeader4.Text = "潜時"; this.columnHeader4.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.columnHeader4.Width = 100; // // columnHeader5 // + this.columnHeader5.DisplayIndex = 5; this.columnHeader5.Text = "心拍数"; this.columnHeader5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.columnHeader5.Width = 100; // + // columnHeader6 + // + this.columnHeader6.DisplayIndex = 6; + this.columnHeader6.Text = "瞬目回数"; + this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader6.Width = 100; + // + // columnHeader7 + // + this.columnHeader7.DisplayIndex = 7; + this.columnHeader7.Text = "瞳孔径:右"; + this.columnHeader7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader7.Width = 100; + // + // columnHeader8 + // + this.columnHeader8.DisplayIndex = 8; + this.columnHeader8.Text = "瞳孔径:左"; + this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader8.Width = 100; + // // label10 // this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -326,24 +351,6 @@ this.label11.TabIndex = 19; this.label11.Text = "被験者"; // - // columnHeader6 - // - this.columnHeader6.Text = "瞬目回数"; - this.columnHeader6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.columnHeader6.Width = 100; - // - // columnHeader7 - // - this.columnHeader7.Text = "瞳孔径:右"; - this.columnHeader7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.columnHeader7.Width = 100; - // - // columnHeader8 - // - this.columnHeader8.Text = "瞳孔径:左"; - this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; - this.columnHeader8.Width = 100; - // // BtnSaveSceneTable // this.BtnSaveSceneTable.Location = new System.Drawing.Point(191, 359); @@ -382,6 +389,13 @@ this.TxtVisit.TabIndex = 23; this.TxtVisit.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; // + // columnHeader9 + // + this.columnHeader9.DisplayIndex = 3; + this.columnHeader9.Text = "EC回数"; + this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.columnHeader9.Width = 100; + // // Form1 // this.AllowDrop = true; @@ -458,6 +472,7 @@ private System.Windows.Forms.SaveFileDialog saveFileDialogCsv; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox TxtVisit; + private System.Windows.Forms.ColumnHeader columnHeader9; } } diff --git a/EcomAnalysis/Form1.cs b/EcomAnalysis/Form1.cs index 7adea3c..235c36e 100644 --- a/EcomAnalysis/Form1.cs +++ b/EcomAnalysis/Form1.cs @@ -14,7 +14,7 @@ public partial class Form1 : Form { private string[] _HeaderItems = { - "stimNo", "sceneNo", "stimTime", "contact time", "Feedback", "RR", "gazeVx", "gazeVy", "pupilR", "pupilL" }; + "stimNo", "sceneNo", "stimTime", "target", "contact time", "Feedback", "RR", "gazeVx", "gazeVy", "pupilR", "pupilL" }; private Dictionary _SceneNoAssign = new Dictionary(); private List _Data = new List(); private List _SceneTable = new List(); @@ -103,6 +103,7 @@ scDat.FBCount = dat.Count(c => c.Feedback > 0); scDat.ECTime = dat.Count(c => c.Feedback == 5) * 15.0 + dat.OrderBy(s => s.SceneTime).Select(s=>s.ContactTime).Last(); + scDat.Latency = dat.Where(c => c.Feedback > 0).Count()==0 ? 0 : dat.Where(c => c.Feedback > 0).Select(s => s.SceneTime).First(); var validRR = dat.Where(s => s.RR >= RR_MIN && s.RR <= RR_MAX); @@ -111,9 +112,21 @@ scDat.Pupil.R = dat.Select(s => s.Pupil.R).Average(); scDat.Pupil.L = dat.Select(s => s.Pupil.L).Average(); + // アイコンタクト回数カウント + var datArr = dat.ToArray(); + scDat.ECCount = 0; + var noContact = true; + for (var i = 0; i < datArr.Count(); i++) { + if (datArr[i].Target > 0 && noContact) { + scDat.ECCount++; + noContact = false; + } + if (datArr[i].Target == 0 && datArr[i].GazeV.x >= 0) noContact = true; + } + var items = new string[] { $"{scDat.SceneNo}", $"{scDat.FBCount} 回", - $"{scDat.ECTime:0.00} 秒", $"{scDat.Latency:0.00} 秒", + $"{scDat.ECTime:0.00} 秒", $"{scDat.ECCount} 回", $"{scDat.Latency:0.00} 秒", $"{scDat.Beat:0.00} bpm", $"{scDat.Blink} 回", $"{scDat.Pupil.R:0.00} mm", $"{scDat.Pupil.L:0.00} mm"}; listView1.Items.Add(new ListViewItem(items)); @@ -122,6 +135,7 @@ _ScMean.FBCount = _SceneTable.Select(s => s.FBCount).Average(); _ScMean.ECTime = _SceneTable.Select(s => s.ECTime).Average(); + _ScMean.ECCount = _SceneTable.Select(s => s.ECCount).Average(); var validLatency = _SceneTable.Where(s => s.FBCount > 0); _ScMean.Latency = validLatency.Count() > 0 ? validLatency.Select(s => s.Latency).Average() : 0; var validBeat = _SceneTable.Where(s => s.Beat > 0); @@ -134,6 +148,7 @@ "平均", $"{_ScMean.FBCount:0.00} 回", $"{_ScMean.ECTime:0.00} 秒", + $"{_ScMean.ECCount:0.00} 回", $"{_ScMean.Latency:0.00} 秒", $"{_ScMean.Beat:0.00} bpm", $"{_ScMean.Blink:0.00} 回", @@ -207,6 +222,7 @@ var ld = new LogData(); ld.StimNo = int.Parse(line[headerCol["stimNo"]]); ld.SceneTime = double.Parse(line[headerCol["stimTime"]]); + ld.Target = int.Parse(line[headerCol["target"]]); ld.ContactTime = double.Parse(line[headerCol["contact time"]]); ld.Feedback = int.Parse(line[headerCol["Feedback"]]); ld.RR = int.Parse(line[headerCol["RR"]]); diff --git a/EcomAnalysis/LogData.cs b/EcomAnalysis/LogData.cs index 2987421..c723503 100644 --- a/EcomAnalysis/LogData.cs +++ b/EcomAnalysis/LogData.cs @@ -24,7 +24,7 @@ public Point2f GazeV; // 注視点(視野カメラ座標) //public Point2f Shift; // ずれ //public Point2f GazeI; // 注視点(画像座標) - //public int Target; // ターゲット判定 + public int Target; // ターゲット判定 public double ContactTime; // 目標コンタクト時間 public int Feedback; // フィードバック //public int TrainingLevel; // トレーニングレベル @@ -37,6 +37,7 @@ public int FBCount; public int Blink; public double ECTime; + public int ECCount; public double Latency; public double Beat; public LR Pupil; @@ -45,6 +46,7 @@ class SceneMean { public double FBCount; public double ECTime; + public double ECCount; public double Latency; public double Beat; public double Blink;