From e9ae8f3c6d23e191d4c3462eec47cecc61ee9b9a Mon Sep 17 00:00:00 2001 From: moco Date: Wed, 27 Nov 2024 02:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=86=E5=92=8C=E7=9F=A9?= =?UTF-8?q?=E5=BD=A2=20=E5=8C=85=E6=8B=AC=E8=AE=A1=E7=AE=97=E5=85=89?= =?UTF-8?q?=E5=AD=90=E9=87=8F=20v0.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/PBAnaly/MainForm.Designer.cs | 134 ++-- src/PBAnaly/MainForm.cs | 4 +- src/PBAnaly/Module/BioanalysisMannage.cs | 656 ++++++++++++++++-- .../UI/BioanayImagePaletteForm.Designer.cs | 123 ++-- src/PBAnaly/UI/BioanayImagePaletteForm.cs | 25 +- 5 files changed, 734 insertions(+), 208 deletions(-) diff --git a/src/PBAnaly/MainForm.Designer.cs b/src/PBAnaly/MainForm.Designer.cs index b263d4c..d79fda7 100644 --- a/src/PBAnaly/MainForm.Designer.cs +++ b/src/PBAnaly/MainForm.Designer.cs @@ -81,17 +81,17 @@ this.metroPanel_RightTop.Dock = System.Windows.Forms.DockStyle.Fill; this.metroPanel_RightTop.HorizontalScrollbarBarColor = true; this.metroPanel_RightTop.HorizontalScrollbarHighlightOnWheel = false; - this.metroPanel_RightTop.HorizontalScrollbarSize = 9; - this.metroPanel_RightTop.Location = new System.Drawing.Point(280, 0); + this.metroPanel_RightTop.HorizontalScrollbarSize = 7; + this.metroPanel_RightTop.Location = new System.Drawing.Point(210, 0); this.metroPanel_RightTop.Margin = new System.Windows.Forms.Padding(0); this.metroPanel_RightTop.Name = "metroPanel_RightTop"; - this.metroPanel_RightTop.Size = new System.Drawing.Size(746, 69); + this.metroPanel_RightTop.Size = new System.Drawing.Size(559, 55); this.metroPanel_RightTop.TabIndex = 12; this.metroPanel_RightTop.Theme = MetroFramework.MetroThemeStyle.Dark; this.metroPanel_RightTop.UseCustomBackColor = true; this.metroPanel_RightTop.VerticalScrollbarBarColor = true; this.metroPanel_RightTop.VerticalScrollbarHighlightOnWheel = false; - this.metroPanel_RightTop.VerticalScrollbarSize = 9; + this.metroPanel_RightTop.VerticalScrollbarSize = 7; // // materialButton_log // @@ -102,11 +102,11 @@ this.materialButton_log.HighEmphasis = true; this.materialButton_log.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_log.Icon"))); this.materialButton_log.Location = new System.Drawing.Point(581, 0); - this.materialButton_log.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.materialButton_log.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.materialButton_log.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_log.Name = "materialButton_log"; this.materialButton_log.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_log.Size = new System.Drawing.Size(113, 69); + this.materialButton_log.Size = new System.Drawing.Size(113, 55); this.materialButton_log.TabIndex = 19; this.materialButton_log.Text = "操作日志"; this.materialButton_log.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -123,11 +123,11 @@ this.materialButton_setting.HighEmphasis = true; this.materialButton_setting.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_setting.Icon"))); this.materialButton_setting.Location = new System.Drawing.Point(468, 0); - this.materialButton_setting.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.materialButton_setting.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.materialButton_setting.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_setting.Name = "materialButton_setting"; this.materialButton_setting.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_setting.Size = new System.Drawing.Size(113, 69); + this.materialButton_setting.Size = new System.Drawing.Size(113, 55); this.materialButton_setting.TabIndex = 18; this.materialButton_setting.Text = "系统设置"; this.materialButton_setting.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -145,11 +145,11 @@ this.materialButton_curveimage.HighEmphasis = true; this.materialButton_curveimage.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_curveimage.Icon"))); this.materialButton_curveimage.Location = new System.Drawing.Point(339, 0); - this.materialButton_curveimage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.materialButton_curveimage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.materialButton_curveimage.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_curveimage.Name = "materialButton_curveimage"; this.materialButton_curveimage.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_curveimage.Size = new System.Drawing.Size(129, 69); + this.materialButton_curveimage.Size = new System.Drawing.Size(129, 55); this.materialButton_curveimage.TabIndex = 17; this.materialButton_curveimage.Text = "泳道波形图"; this.materialButton_curveimage.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -167,11 +167,11 @@ this.materialButton_analyzedata.HighEmphasis = true; this.materialButton_analyzedata.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_analyzedata.Icon"))); this.materialButton_analyzedata.Location = new System.Drawing.Point(226, 0); - this.materialButton_analyzedata.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.materialButton_analyzedata.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.materialButton_analyzedata.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_analyzedata.Name = "materialButton_analyzedata"; this.materialButton_analyzedata.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_analyzedata.Size = new System.Drawing.Size(113, 69); + this.materialButton_analyzedata.Size = new System.Drawing.Size(113, 55); this.materialButton_analyzedata.TabIndex = 16; this.materialButton_analyzedata.Text = "分析数据"; this.materialButton_analyzedata.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -189,11 +189,11 @@ this.materialButton_outimage.HighEmphasis = true; this.materialButton_outimage.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_outimage.Icon"))); this.materialButton_outimage.Location = new System.Drawing.Point(113, 0); - this.materialButton_outimage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.materialButton_outimage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.materialButton_outimage.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_outimage.Name = "materialButton_outimage"; this.materialButton_outimage.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_outimage.Size = new System.Drawing.Size(113, 69); + this.materialButton_outimage.Size = new System.Drawing.Size(113, 55); this.materialButton_outimage.TabIndex = 15; this.materialButton_outimage.Text = "导出图像"; this.materialButton_outimage.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -211,11 +211,11 @@ this.materialButton_LoadData.HighEmphasis = true; this.materialButton_LoadData.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_LoadData.Icon"))); this.materialButton_LoadData.Location = new System.Drawing.Point(0, 0); - this.materialButton_LoadData.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.materialButton_LoadData.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.materialButton_LoadData.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_LoadData.Name = "materialButton_LoadData"; this.materialButton_LoadData.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_LoadData.Size = new System.Drawing.Size(113, 69); + this.materialButton_LoadData.Size = new System.Drawing.Size(113, 55); this.materialButton_LoadData.TabIndex = 14; this.materialButton_LoadData.Text = "加载数据"; this.materialButton_LoadData.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -251,7 +251,7 @@ this.materialButton_return.Depth = 0; this.materialButton_return.HighEmphasis = true; this.materialButton_return.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_return.Icon"))); - this.materialButton_return.Location = new System.Drawing.Point(512, 0); + this.materialButton_return.Location = new System.Drawing.Point(0, 36); this.materialButton_return.Margin = new System.Windows.Forms.Padding(0); this.materialButton_return.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_return.Name = "materialButton_return"; @@ -416,12 +416,12 @@ this.materialButton_miniAnalyze.Depth = 0; this.materialButton_miniAnalyze.HighEmphasis = true; this.materialButton_miniAnalyze.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_miniAnalyze.Icon"))); - this.materialButton_miniAnalyze.Location = new System.Drawing.Point(5, 236); - this.materialButton_miniAnalyze.Margin = new System.Windows.Forms.Padding(5, 8, 5, 8); + this.materialButton_miniAnalyze.Location = new System.Drawing.Point(4, 186); + this.materialButton_miniAnalyze.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.materialButton_miniAnalyze.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_miniAnalyze.Name = "materialButton_miniAnalyze"; this.materialButton_miniAnalyze.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_miniAnalyze.Size = new System.Drawing.Size(267, 60); + this.materialButton_miniAnalyze.Size = new System.Drawing.Size(200, 48); this.materialButton_miniAnalyze.TabIndex = 7; this.materialButton_miniAnalyze.Text = "微孔版分析"; this.materialButton_miniAnalyze.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -437,12 +437,12 @@ this.materialButton_roiAnalyze.Depth = 0; this.materialButton_roiAnalyze.HighEmphasis = true; this.materialButton_roiAnalyze.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_roiAnalyze.Icon"))); - this.materialButton_roiAnalyze.Location = new System.Drawing.Point(5, 160); - this.materialButton_roiAnalyze.Margin = new System.Windows.Forms.Padding(5, 8, 5, 8); + this.materialButton_roiAnalyze.Location = new System.Drawing.Point(4, 126); + this.materialButton_roiAnalyze.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.materialButton_roiAnalyze.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_roiAnalyze.Name = "materialButton_roiAnalyze"; this.materialButton_roiAnalyze.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_roiAnalyze.Size = new System.Drawing.Size(267, 60); + this.materialButton_roiAnalyze.Size = new System.Drawing.Size(200, 48); this.materialButton_roiAnalyze.TabIndex = 6; this.materialButton_roiAnalyze.Text = "ROIs分析"; this.materialButton_roiAnalyze.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -457,12 +457,12 @@ this.materialButton_dotcounts.Depth = 0; this.materialButton_dotcounts.HighEmphasis = true; this.materialButton_dotcounts.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_dotcounts.Icon"))); - this.materialButton_dotcounts.Location = new System.Drawing.Point(5, 312); - this.materialButton_dotcounts.Margin = new System.Windows.Forms.Padding(5, 8, 5, 8); + this.materialButton_dotcounts.Location = new System.Drawing.Point(4, 246); + this.materialButton_dotcounts.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.materialButton_dotcounts.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_dotcounts.Name = "materialButton_dotcounts"; this.materialButton_dotcounts.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_dotcounts.Size = new System.Drawing.Size(267, 60); + this.materialButton_dotcounts.Size = new System.Drawing.Size(200, 48); this.materialButton_dotcounts.TabIndex = 8; this.materialButton_dotcounts.Text = "菌落计数"; this.materialButton_dotcounts.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -477,12 +477,12 @@ this.materialButton_acidAnalyze.Depth = 0; this.materialButton_acidAnalyze.HighEmphasis = true; this.materialButton_acidAnalyze.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_acidAnalyze.Icon"))); - this.materialButton_acidAnalyze.Location = new System.Drawing.Point(5, 84); - this.materialButton_acidAnalyze.Margin = new System.Windows.Forms.Padding(5, 8, 5, 8); + this.materialButton_acidAnalyze.Location = new System.Drawing.Point(4, 66); + this.materialButton_acidAnalyze.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.materialButton_acidAnalyze.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_acidAnalyze.Name = "materialButton_acidAnalyze"; this.materialButton_acidAnalyze.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_acidAnalyze.Size = new System.Drawing.Size(267, 60); + this.materialButton_acidAnalyze.Size = new System.Drawing.Size(200, 48); this.materialButton_acidAnalyze.TabIndex = 5; this.materialButton_acidAnalyze.Text = "泳道分析"; this.materialButton_acidAnalyze.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -497,12 +497,12 @@ this.materialButton_correction.Depth = 0; this.materialButton_correction.HighEmphasis = true; this.materialButton_correction.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_correction.Icon"))); - this.materialButton_correction.Location = new System.Drawing.Point(5, 388); - this.materialButton_correction.Margin = new System.Windows.Forms.Padding(5, 8, 5, 8); + this.materialButton_correction.Location = new System.Drawing.Point(4, 306); + this.materialButton_correction.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.materialButton_correction.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_correction.Name = "materialButton_correction"; this.materialButton_correction.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_correction.Size = new System.Drawing.Size(267, 60); + this.materialButton_correction.Size = new System.Drawing.Size(200, 48); this.materialButton_correction.TabIndex = 9; this.materialButton_correction.Text = "蛋白归一化"; this.materialButton_correction.Type = MaterialSkin.Controls.MaterialButton.MaterialButtonType.Contained; @@ -519,12 +519,12 @@ this.materialButton_imageProcess.Font = new System.Drawing.Font("宋体", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.materialButton_imageProcess.HighEmphasis = true; this.materialButton_imageProcess.Icon = ((System.Drawing.Image)(resources.GetObject("materialButton_imageProcess.Icon"))); - this.materialButton_imageProcess.Location = new System.Drawing.Point(5, 8); - this.materialButton_imageProcess.Margin = new System.Windows.Forms.Padding(5, 8, 5, 8); + this.materialButton_imageProcess.Location = new System.Drawing.Point(4, 6); + this.materialButton_imageProcess.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6); this.materialButton_imageProcess.MouseState = MaterialSkin.MouseState.HOVER; this.materialButton_imageProcess.Name = "materialButton_imageProcess"; this.materialButton_imageProcess.NoAccentTextColor = System.Drawing.Color.Empty; - this.materialButton_imageProcess.Size = new System.Drawing.Size(267, 60); + this.materialButton_imageProcess.Size = new System.Drawing.Size(200, 48); this.materialButton_imageProcess.TabIndex = 4; this.materialButton_imageProcess.Text = "图像处理"; this.materialButton_imageProcess.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -539,11 +539,10 @@ this.CompanyIcon_pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.CompanyIcon_pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; this.CompanyIcon_pictureBox.Image = global::PBAnaly.Properties.Resources.京仪科技定稿_画板_1_副本2; - this.CompanyIcon_pictureBox.Location = new System.Drawing.Point(4, 4); - this.CompanyIcon_pictureBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.CompanyIcon_pictureBox.Location = new System.Drawing.Point(3, 3); this.CompanyIcon_pictureBox.Name = "CompanyIcon_pictureBox"; this.tableLayoutPanel1.SetRowSpan(this.CompanyIcon_pictureBox, 2); - this.CompanyIcon_pictureBox.Size = new System.Drawing.Size(272, 100); + this.CompanyIcon_pictureBox.Size = new System.Drawing.Size(204, 80); this.CompanyIcon_pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.CompanyIcon_pictureBox.TabIndex = 16; this.CompanyIcon_pictureBox.TabStop = false; @@ -551,9 +550,9 @@ // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 280F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 210F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 437F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 328F)); this.tableLayoutPanel1.Controls.Add(this.tl_right_main_view, 1, 2); this.tableLayoutPanel1.Controls.Add(this.metroPanel_RightTop, 1, 0); this.tableLayoutPanel1.Controls.Add(this.CompanyIcon_pictureBox, 0, 0); @@ -561,30 +560,30 @@ this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 1, 1); this.tableLayoutPanel1.Controls.Add(this.pl_right, 2, 1); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 30); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 24); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 69F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 39F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 31F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1463, 726); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1097, 581); this.tableLayoutPanel1.TabIndex = 18; // // tl_right_main_view // this.tl_right_main_view.ColumnCount = 2; this.tl_right_main_view.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tl_right_main_view.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 432F)); + this.tl_right_main_view.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 324F)); this.tl_right_main_view.Controls.Add(this.DataProcess_panel, 0, 0); this.tl_right_main_view.Dock = System.Windows.Forms.DockStyle.Fill; - this.tl_right_main_view.Location = new System.Drawing.Point(280, 108); + this.tl_right_main_view.Location = new System.Drawing.Point(210, 86); this.tl_right_main_view.Margin = new System.Windows.Forms.Padding(0); this.tl_right_main_view.Name = "tl_right_main_view"; this.tl_right_main_view.RowCount = 2; this.tl_right_main_view.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tl_right_main_view.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tl_right_main_view.Size = new System.Drawing.Size(746, 618); + this.tl_right_main_view.Size = new System.Drawing.Size(559, 495); this.tl_right_main_view.TabIndex = 0; // // DataProcess_panel @@ -593,12 +592,11 @@ this.tl_right_main_view.SetColumnSpan(this.DataProcess_panel, 2); this.DataProcess_panel.Dock = System.Windows.Forms.DockStyle.Fill; this.DataProcess_panel.EdgeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50))))); - this.DataProcess_panel.Location = new System.Drawing.Point(4, 4); - this.DataProcess_panel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.DataProcess_panel.Location = new System.Drawing.Point(3, 3); this.DataProcess_panel.Name = "DataProcess_panel"; - this.DataProcess_panel.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6); + this.DataProcess_panel.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5); this.tl_right_main_view.SetRowSpan(this.DataProcess_panel, 2); - this.DataProcess_panel.Size = new System.Drawing.Size(738, 610); + this.DataProcess_panel.Size = new System.Drawing.Size(553, 489); this.DataProcess_panel.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this.DataProcess_panel.TabIndex = 19; this.DataProcess_panel.Text = "panel1"; @@ -613,10 +611,10 @@ this.flowLayoutPanel1.Controls.Add(this.materialButton_correction); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 110); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.flowLayoutPanel1.Location = new System.Drawing.Point(2, 88); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(274, 614); + this.flowLayoutPanel1.Size = new System.Drawing.Size(206, 491); this.flowLayoutPanel1.TabIndex = 18; // // flowLayoutPanel2 @@ -632,10 +630,10 @@ this.flowLayoutPanel2.Controls.Add(this.materialButton_forward); this.flowLayoutPanel2.Controls.Add(this.materialButton_return); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel2.Location = new System.Drawing.Point(280, 69); + this.flowLayoutPanel2.Location = new System.Drawing.Point(210, 55); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(746, 39); + this.flowLayoutPanel2.Size = new System.Drawing.Size(559, 31); this.flowLayoutPanel2.TabIndex = 19; // // pl_right @@ -643,12 +641,12 @@ this.pl_right.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(39)))), ((int)(((byte)(51)))), ((int)(((byte)(63))))); this.pl_right.Dock = System.Windows.Forms.DockStyle.Fill; this.pl_right.EdgeColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(41)))), ((int)(((byte)(50))))); - this.pl_right.Location = new System.Drawing.Point(1029, 71); - this.pl_right.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pl_right.Location = new System.Drawing.Point(771, 57); + this.pl_right.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pl_right.Name = "pl_right"; - this.pl_right.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.pl_right.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel1.SetRowSpan(this.pl_right, 2); - this.pl_right.Size = new System.Drawing.Size(431, 653); + this.pl_right.Size = new System.Drawing.Size(324, 522); this.pl_right.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this.pl_right.TabIndex = 20; this.pl_right.Text = "panel1"; @@ -657,28 +655,26 @@ // this.thunderLabel1.BackColor = System.Drawing.Color.Transparent; this.thunderLabel1.ForeColor = System.Drawing.Color.WhiteSmoke; - this.thunderLabel1.Location = new System.Drawing.Point(12, 6); - this.thunderLabel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.thunderLabel1.Location = new System.Drawing.Point(9, 5); this.thunderLabel1.Name = "thunderLabel1"; - this.thunderLabel1.Size = new System.Drawing.Size(267, 20); + this.thunderLabel1.Size = new System.Drawing.Size(200, 16); this.thunderLabel1.TabIndex = 19; - this.thunderLabel1.Text = "PBAnaly v0.1.1"; + this.thunderLabel1.Text = "PBAnaly v0.1.2"; // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; - this.ClientSize = new System.Drawing.Size(1471, 760); + this.ClientSize = new System.Drawing.Size(1103, 608); this.Controls.Add(this.thunderLabel1); this.Controls.Add(this.tableLayoutPanel1); this.DrawerAutoHide = false; this.FormStyle = MaterialSkin.Controls.MaterialForm.FormStyles.ActionBar_None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "MainForm"; - this.Padding = new System.Windows.Forms.Padding(4, 30, 4, 4); + this.Padding = new System.Windows.Forms.Padding(3, 24, 3, 3); this.Text = "MainForm"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); diff --git a/src/PBAnaly/MainForm.cs b/src/PBAnaly/MainForm.cs index 601f69f..f10d02b 100644 --- a/src/PBAnaly/MainForm.cs +++ b/src/PBAnaly/MainForm.cs @@ -317,13 +317,13 @@ namespace PBAnaly { return; } - BioanalysisMannage bioanalysisMannage = new BioanalysisMannage(selectedFilePath, pl_right); + BioanalysisMannage bioanalysisMannage = new BioanalysisMannage(selectedFilePath, pl_right, bioanalysisMannages); DataProcess_panel.Controls.Add(bioanalysisMannage.GetImagePanel); bioanalysisMannage.GetImagePanel.BringToFront(); - bioanalysisMannages[selectedFilePath] = bioanalysisMannage; + diff --git a/src/PBAnaly/Module/BioanalysisMannage.cs b/src/PBAnaly/Module/BioanalysisMannage.cs index acd6caa..176eff8 100644 --- a/src/PBAnaly/Module/BioanalysisMannage.cs +++ b/src/PBAnaly/Module/BioanalysisMannage.cs @@ -1,7 +1,11 @@ using AntdUI; +using Aspose.Pdf; using Aspose.Pdf.AI; using Aspose.Pdf.Drawing; +using MetroFramework.Drawing.Html; +using OpenCvSharp.Flann; using PBAnaly.UI; +using PBBiologyVC; using ScottPlot.Panels; using ScottPlot.Plottables; using SixLabors.ImageSharp; @@ -12,6 +16,7 @@ using System.Collections.Generic; using System.Drawing; using System.IO; using System.Net; +using System.Runtime.ConstrainedExecution; using System.Threading; using System.Windows.Forms; @@ -43,8 +48,21 @@ namespace PBAnaly.Module public int colorIndex; } + + public struct RectAttribute + { + public System.Drawing.Rectangle rect; + public Pseudo_infoVC pdinfovc; + } + private struct CirceAndInfo + { + public System.Drawing.Point center; + public System.Drawing.Point Radius { get; set; } + public Pseudo_infoVC pdinfovc; + } #endregion #region 变量 + private Dictionary bioanalysisMannages; private string path; private string mark_path; private string tif_marker_path; @@ -84,17 +102,34 @@ namespace PBAnaly.Module private bool CircleOn = false; private bool rectOn = false; - private List rectangles = new List(); // 存储所有绘制完成的矩形 + private bool isRecDragging = false; + private List rectangles = new List(); // 存储所有绘制完成的矩形 private System.Drawing.Rectangle? currentRectangle = null; // 当前正在绘制的矩形 private System.Drawing.Point leftTopPoint; // 矩形左上角的起始点 private bool drawRect = false; // 是否正在绘制 + private System.Drawing.Point recDragStart; + private System.Drawing.Rectangle recDragRect; + private RectAttribute rectOriginalRect; + private int rectDragStartIndex = -1; + + private bool drawCircle = false;//是否绘制圆 + private bool isCirDragging = false; + private List CircleAndInfoList = new List(); + private System.Drawing.Point cirDragStart; + private System.Drawing.Point circleCenter; + private System.Drawing.Point circleRadio; + private int cirDragStartIndex = -1; + private CirceAndInfo cireOriginalCire; + private System.Drawing.Point startPoint = new System.Drawing.Point(-10, 0); private System.Drawing.Point endPoint = new System.Drawing.Point(-10, 0); private bool isStartCircleDragged, isEndCircleDragged; - - + + private enum Corner { None,TopLeft,TopRight,BottomLeft,BottomRight,drawMouse} + + private Corner rectActiveCorner = Corner.None; #endregion #endregion @@ -266,7 +301,7 @@ namespace PBAnaly.Module #endregion #endregion - public BioanalysisMannage(string _path, ReaLTaiizor.Controls.Panel _pl_right) + public BioanalysisMannage(string _path, ReaLTaiizor.Controls.Panel _pl_right, Dictionary bioanalysisMannages) { isUpdateAlg = false; this.pl_right = _pl_right; @@ -313,6 +348,10 @@ namespace PBAnaly.Module algThread.Start(); isUpdateAlg = true;// 开始可以更新算法 + + + bioanalysisMannages[_path] = this; + this.bioanalysisMannages = bioanalysisMannages; } #region 方法 @@ -376,11 +415,15 @@ namespace PBAnaly.Module imagePaletteForm.hpb_line.Click += Hpb_line_Click; imagePanel.wdb_title.MouseDown += Wdb_title_Click; - + imagePanel.FormClosing += ImagePanel_FormClosing; + imagePanel.FormClosed += ImagePanel_FormClosed; imagePaletteForm.hpb_rect.Click += hpb_rect_Click; + imagePaletteForm.hpb_circe.Click += Hpb_circe_Click; + + } - + private void ReadTif() { @@ -547,8 +590,89 @@ namespace PBAnaly.Module } + private bool IsPointInRectangles(System.Drawing.Point point, List rectangles,out Corner cner,out RectAttribute curRect,out int index) + { + curRect = new RectAttribute(); + cner = Corner.None; + index = 0; + foreach (var rect in rectangles) + { + System.Drawing.Point topLeft = new System.Drawing.Point(rect.rect.Left, rect.rect.Top); + System.Drawing.Point topRight = new System.Drawing.Point(rect.rect.Right, rect.rect.Top); + System.Drawing.Point bottomLeft = new System.Drawing.Point(rect.rect.Left, rect.rect.Bottom); + System.Drawing.Point bottomRight = new System.Drawing.Point(rect.rect.Right, rect.rect.Bottom); + if (ImageProcess.IsNearCorner(point,new System.Drawing.Point(rect.rect.Left,rect.rect.Top),CircleRadius)) + { + imagePanel.image_pl.Cursor = Cursors.SizeNWSE; + cner = Corner.TopLeft; + curRect = rect; + return true; + } + else if (ImageProcess.IsNearCorner(point, new System.Drawing.Point(rect.rect.Right, rect.rect.Top), CircleRadius)) + { + imagePanel.image_pl.Cursor = Cursors.SizeNESW; + cner = Corner.TopRight; + curRect = rect; + return true; + } + else if (ImageProcess.IsNearCorner(point, new System.Drawing.Point(rect.rect.Left, rect.rect.Bottom), CircleRadius)) + { + imagePanel.image_pl.Cursor = Cursors.SizeNESW; + cner = Corner.BottomLeft; + curRect = rect; + return true; + } + else if (ImageProcess.IsNearCorner(point, new System.Drawing.Point(rect.rect.Right, rect.rect.Bottom), CircleRadius)) + { + imagePanel.image_pl.Cursor = Cursors.SizeNWSE; + cner = Corner.BottomRight; + curRect = rect; + return true; + } + + else if (rect.rect.Contains(point)) + { + imagePanel.image_pl.Cursor = Cursors.SizeAll; + cner = Corner.drawMouse; + curRect = rect; + return true; + } + index++; + + } + return false; + } + // 判断点是否在圆圈内 + private bool IsPointInCircle(System.Drawing.Point point, List circleCenter ,out Corner cner, out CirceAndInfo curRect, out int index) + { + cner = Corner.None; + curRect = new CirceAndInfo(); + index = 0; + foreach (var circle in circleCenter) + { + int radius = (int)Math.Sqrt(Math.Pow(circle.center.X - circle.Radius.X, 2) + Math.Pow(circle.center.Y - circle.Radius.Y, 2)); + double distance = Math.Sqrt(Math.Pow(point.X - circle.center.X, 2) + Math.Pow(point.Y - circle.center.Y, 2)); + if (ImageProcess.IsNearCorner(point, circle.Radius, CircleRadius)) + { + imagePanel.image_pl.Cursor = Cursors.SizeNESW; + curRect = circle; + cner = Corner.BottomLeft; + return true; + } + else if (distance <= radius) + { + curRect = circle; + cner = Corner.drawMouse; + imagePanel.image_pl.Cursor = Cursors.SizeAll; + return true; + } + index++; + } + + return false; + } #endregion @@ -639,61 +763,319 @@ namespace PBAnaly.Module ImageProcess.DrawCircle(g, srart, CircleRadius, Pens.Blue, Brushes.LightBlue); ImageProcess.DrawCircle(g, end, CircleRadius, Pens.Blue, Brushes.LightBlue); } - if(leftTopPoint != System.Drawing.Point.Empty) + + + int index = 0; + foreach (var rect in rectangles) { - // 绘制所有已绘制的矩形 - foreach (var rect in rectangles) + + System.Drawing.Rectangle p = rect.rect; + if (isRecDragging) { - e.Graphics.DrawRectangle(Pens.Blue, rect); + if (index == rectDragStartIndex) + { + p = recDragRect; + + } } - // 绘制当前正在绘制的矩形 + var r = ImageProcess.ConvertRealRectangleToPictureBox(p, imagePanel.image_pl); + e.Graphics.DrawRectangle(Pens.Red, r); + + System.Drawing.Point[] corners = new System.Drawing.Point[] + { + new System.Drawing.Point(r.Left, r.Top), // 左上角 + new System.Drawing.Point(r.Right, r.Top), // 右上角 + new System.Drawing.Point(r.Left, r.Bottom), // 左下角 + new System.Drawing.Point(r.Right, r.Bottom) // 右下角 + }; + foreach (var item in corners) + { + + ImageProcess.DrawCircle(g, new System.Drawing.Point(item.X, item.Y), CircleRadius, Pens.Blue, Brushes.LightBlue); + } + + if (!isRecDragging) + { + + // 画标签 + if (rect.pdinfovc != null) + { + // 指向线的起点在矩形的顶部中心 + System.Drawing.Point centerTopPoint = new System.Drawing.Point( + r.Left + r.Width / 2, + r.Top + ); + + // 指向线的终点在矩形上方10像素 + System.Drawing.Point labelPoint = new System.Drawing.Point( + centerTopPoint.X, + centerTopPoint.Y - 10 + ); + // 画垂直的指向线 + g.DrawLine(Pens.Red, centerTopPoint, labelPoint); + string labelText = ""; + if (algAttribute.scientificON) + { + + + labelText = $"ROI:{index+1},AOD:{util.GetscientificNotation(rect.pdinfovc.AOD)},IOD:{util.GetscientificNotation(rect.pdinfovc.IOD)}," + + $"\r\nmaxOD:{util.GetscientificNotation(rect.pdinfovc.maxOD)},minOD:{util.GetscientificNotation(rect.pdinfovc.minOD)},Count:{util.GetscientificNotation(rect.pdinfovc.Count)}"; + } + else + { + labelText = $"ROI:{index + 1},AOD:{rect.pdinfovc.AOD},IOD:{rect.pdinfovc.IOD}," + + $"\r\nmaxOD:{rect.pdinfovc.maxOD},minOD:{rect.pdinfovc.minOD},Count:{rect.pdinfovc.Count}"; // 标签编号 + } + + Font font = new Font("Arial", 8); // 字体 + Brush brush = Brushes.Red; // 字体颜色 + g.DrawString(labelText, font, brush, labelPoint.X - 10, labelPoint.Y - 15); + } + } + index++; + } + + if (drawRect) + { if (currentRectangle.HasValue) { - e.Graphics.DrawRectangle(Pens.Red, currentRectangle.Value); + var r = ImageProcess.ConvertRealRectangleToPictureBox(currentRectangle.Value, imagePanel.image_pl); + e.Graphics.DrawRectangle(Pens.Red, r); } } + + index = 0; + foreach (var item in CircleAndInfoList) + { + var centerPoint = ImageProcess.ConvertRealToPictureBox(item.center, imagePanel.image_pl); + var radiusPoint = ImageProcess.ConvertRealToPictureBox(item.Radius, imagePanel.image_pl); + int radius = (int)Math.Sqrt(Math.Pow(centerPoint.X - radiusPoint.X, 2) + Math.Pow(centerPoint.Y - radiusPoint.Y, 2)); + if (isCirDragging) + { + if (index == cirDragStartIndex) + { + centerPoint = ImageProcess.ConvertRealToPictureBox(circleCenter, imagePanel.image_pl); + radiusPoint = ImageProcess.ConvertRealToPictureBox(circleRadio, imagePanel.image_pl); ; + radius = (int)Math.Sqrt(Math.Pow(centerPoint.X - radiusPoint.X, 2) + Math.Pow(centerPoint.Y - radiusPoint.Y, 2)); + } + + } + + e.Graphics.DrawEllipse(Pens.Red, centerPoint.X - radius, centerPoint.Y - radius, radius * 2, radius * 2); + ImageProcess.DrawCircle(g, new System.Drawing.Point(radiusPoint.X, radiusPoint.Y), CircleRadius, Pens.Blue, Brushes.LightBlue); + + if (!isCirDragging) + { + // 画标签 + if (item.pdinfovc != null) + { + // 指向线的终点在矩形上方10像素 + System.Drawing.Point labelPoint = new System.Drawing.Point( + centerPoint.X, + centerPoint.Y - radius - 10 + ); + // 画垂直的指向线 + g.DrawLine(Pens.Red, centerPoint, labelPoint); + string labelText = ""; + if (algAttribute.scientificON) + { + + + labelText = $"ROI:{index + 1},AOD:{util.GetscientificNotation(item.pdinfovc.AOD)},IOD:{util.GetscientificNotation(item.pdinfovc.IOD)}," + + $"\r\nmaxOD:{util.GetscientificNotation(item.pdinfovc.maxOD)},minOD:{util.GetscientificNotation(item.pdinfovc.minOD)},Count:{util.GetscientificNotation(item.pdinfovc.Count)}"; + } + else + { + labelText = $"ROI:{index + 1},AOD:{item.pdinfovc.AOD},IOD:{item.pdinfovc.IOD}," + + $"\r\nmaxOD:{item.pdinfovc.maxOD},minOD:{item.pdinfovc.minOD},Count:{item.pdinfovc.Count}"; // 标签编号 + } + Font font = new Font("Arial", 8); // 字体 + Brush brush = Brushes.Red; // 字体颜色 + g.DrawString(labelText, font, brush, labelPoint.X - 10, labelPoint.Y - 15); + } + } + index++; + } + + if (drawCircle) + { + var curCirRadioPoint = ImageProcess.ConvertRealToPictureBox(circleRadio, imagePanel.image_pl); + var curCirCenterPoint = ImageProcess.ConvertRealToPictureBox(circleCenter, imagePanel.image_pl); + int radius = (int)Math.Sqrt(Math.Pow(curCirCenterPoint.X - curCirRadioPoint.X, 2) + Math.Pow(curCirCenterPoint.Y - curCirRadioPoint.Y, 2)); + e.Graphics.DrawEllipse(Pens.Red, curCirCenterPoint.X - radius, curCirCenterPoint.Y - radius, radius * 2, radius * 2); + ImageProcess.DrawCircle(g, new System.Drawing.Point(curCirRadioPoint.X, curCirRadioPoint.Y), CircleRadius, Pens.Blue, Brushes.LightBlue); + } + } private void Image_pl_MouseUp(object sender, MouseEventArgs e) { System.Drawing.Point readLoction = ImageProcess.GetRealImageCoordinates(imagePanel.image_pl, e.Location); - if (isDragging && e.Button == MouseButtons.Left) - { - imagePanel.pl_bg_panel.Cursor = Cursors.Default; - isDragging = false; - } - else if ((drawLine && e.Button == MouseButtons.Left) || (isStartCircleDragged || isEndCircleDragged)) - { - drawLine = false; - lineOn = false; - isStartCircleDragged = false; - isEndCircleDragged = false; - imagePanel.image_pl.Invalidate(); - // 计算距离 - double deltaX = endPoint.X - startPoint.X; - double deltaY = endPoint.Y - startPoint.Y; - var value = Math.Sqrt(deltaX * deltaX + deltaY * deltaY); - imagePaletteForm.flb_act_mm.Text = value.ToString() + " mm"; - imagePaletteForm.flb_act_mm.Refresh(); - } - else if(drawRect && e.Button == MouseButtons.Left) + if (e.Button == MouseButtons.Left) { - if (drawRect && currentRectangle.HasValue) + if (isDragging) { - // 完成绘制并保存矩形 - rectangles.Add(currentRectangle.Value); - currentRectangle = null; - drawRect = false; + imagePanel.pl_bg_panel.Cursor = Cursors.Default; + isDragging = false; } + else if ((drawLine) || (isStartCircleDragged || isEndCircleDragged)) + { + drawLine = false; + lineOn = false; + isStartCircleDragged = false; + isEndCircleDragged = false; + imagePanel.image_pl.Invalidate(); - drawRect = false; - rectOn = false; + // 计算距离 + double deltaX = endPoint.X - startPoint.X; + double deltaY = endPoint.Y - startPoint.Y; + var value = Math.Sqrt(deltaX * deltaX + deltaY * deltaY); + imagePaletteForm.flb_act_mm.Text = value.ToString() + " mm"; + imagePaletteForm.flb_act_mm.Refresh(); + } + else if (drawRect) + { + if (currentRectangle.HasValue) + { + RectAttribute rab = new RectAttribute(); + rab.rect = currentRectangle.Value; - + // 计算光子数并展示出来 + float _max = algAttribute.colorValue; + float _min = algAttribute.colorMinValue; + Pseudo_infoVC curpdinfovc = null; + unsafe + { + fixed (byte* pseu_16_byte_src = image_org_byte) + { + curpdinfovc = pbpvc.get_pseudo_info_rect_vc(pseu_16_byte_src, 16, (ushort)image_org_L16.Width, (ushort)image_org_L16.Height, + _max, _min, currentRectangle.Value.X, currentRectangle.Value.Y, currentRectangle.Value.Width, currentRectangle.Value.Height); + + } + } + if (curpdinfovc != null) + rab.pdinfovc = curpdinfovc; + // 完成绘制并保存矩形 + rectangles.Add(rab); + currentRectangle = null; + drawRect = false; + + + + + imagePanel.image_pl.Invalidate(); + } + + drawRect = false; + rectOn = false; + + + } + else if (drawCircle && CircleOn) + { + CirceAndInfo rab = new CirceAndInfo(); + rab.center = circleCenter; + rab.Radius = circleRadio; + + if (CircleAndInfoList.Count == 0) + { + imagePaletteForm.CIRCLE_R = (int)Math.Sqrt(Math.Pow(rab.center.X - rab.Radius.X, 2) + Math.Pow(rab.center.Y - rab.Radius.Y, 2)); + + } + else + { + + double angleInRadians = 90 * Math.PI / 180; // Convert degrees to radians + double x = rab.center.X + imagePaletteForm.CIRCLE_R * Math.Cos(angleInRadians); + double y = rab.center.Y + imagePaletteForm.CIRCLE_R * Math.Sin(angleInRadians); + + rab.Radius = new System.Drawing.Point((int)x, (int)y); + } + + // 计算光子数并展示出来 + float _max = algAttribute.colorValue; + float _min = algAttribute.colorMinValue; + int radius = (int)Math.Sqrt(Math.Pow(rab.center.X - rab.Radius.X, 2) + Math.Pow(rab.center.Y - rab.Radius.Y, 2)); + Pseudo_infoVC curpdinfovc = null; + unsafe + { + fixed (byte* pseu_16_byte_src = image_org_byte) + { + curpdinfovc = pbpvc.get_pseudo_info_circle_vc(pseu_16_byte_src, 16, + (ushort)image_org_L16.Width, (ushort)image_org_L16.Height, _max, _min, rab.center.X, rab.center.Y, radius); + + } + } + if (curpdinfovc != null) + rab.pdinfovc = curpdinfovc; + // 完成绘制并保存矩形 + CircleAndInfoList.Add(rab); + + drawCircle = false; + CircleOn = false; + imagePanel.image_pl.Invalidate(); + + + } + else if (isRecDragging) + { + RectAttribute rattb = new RectAttribute(); + rattb.rect = recDragRect; + // 计算光子数并展示出来 + float _max = algAttribute.colorValue; + float _min = algAttribute.colorMinValue; + Pseudo_infoVC curpdinfovc = null; + unsafe + { + fixed (byte* pseu_16_byte_src = image_org_byte) + { + curpdinfovc = pbpvc.get_pseudo_info_rect_vc(pseu_16_byte_src, 16, (ushort)image_org_L16.Width, (ushort)image_org_L16.Height, + _max, _min, recDragRect.X, recDragRect.Y, recDragRect.Width, recDragRect.Height); + + } + } + if (curpdinfovc != null) + rattb.pdinfovc = curpdinfovc; + rectangles[rectDragStartIndex] = rattb; + isRecDragging = false; + rectActiveCorner = Corner.None; + rectDragStartIndex = -1; + + imagePanel.image_pl.Invalidate(); + + } + else if (isCirDragging) + { + CirceAndInfo circeAndInfo = new CirceAndInfo(); + + circeAndInfo.Radius = circleRadio; + circeAndInfo.center = circleCenter; + + float _max = algAttribute.colorValue; + float _min = algAttribute.colorMinValue; + int radius = (int)Math.Sqrt(Math.Pow(circeAndInfo.center.X - circeAndInfo.Radius.X, 2) + Math.Pow(circeAndInfo.center.Y - circeAndInfo.Radius.Y, 2)); + Pseudo_infoVC curpdinfovc = null; + unsafe + { + fixed (byte* pseu_16_byte_src = image_org_byte) + { + curpdinfovc = pbpvc.get_pseudo_info_circle_vc(pseu_16_byte_src, 16, + (ushort)image_org_L16.Width, (ushort)image_org_L16.Height, _max, _min, circeAndInfo.center.X, circeAndInfo.center.Y, radius); + + } + } + circeAndInfo.pdinfovc = curpdinfovc; + + CircleAndInfoList[cirDragStartIndex] = circeAndInfo; + isCirDragging = false; + cirDragStartIndex = -1; + imagePanel.image_pl.Invalidate(); + } } + } @@ -705,6 +1087,22 @@ namespace PBAnaly.Module endPoint = readLoction; // 更新终点位置 imagePanel.image_pl.Invalidate(); // 触发重绘 } + else if (drawRect && e.Button == MouseButtons.Left) + { + // 动态调整矩形大小 + int x = Math.Min(leftTopPoint.X, readLoction.X); + int y = Math.Min(leftTopPoint.Y, readLoction.Y); + int width = Math.Abs(readLoction.X - leftTopPoint.X); + int height = Math.Abs(readLoction.Y - leftTopPoint.Y); + + currentRectangle = new System.Drawing.Rectangle(x, y, width, height); + imagePanel.image_pl.Invalidate(); // 触发重绘 + } + else if (drawCircle && e.Button == MouseButtons.Left) + { + circleRadio = readLoction; + imagePanel.image_pl.Invalidate(); + } else if (isDragging && e.Button == MouseButtons.Left) { int deltaX = e.X - mouseDownPosition.X; @@ -724,11 +1122,94 @@ namespace PBAnaly.Module if (imagePanel.pl_bg_panel.Bottom < imagePanel.pl_panel_image.ClientSize.Height) imagePanel.pl_bg_panel.Top = imagePanel.pl_panel_image.ClientSize.Height - imagePanel.pl_bg_panel.Height; } + } + else if (ImageProcess.IsNearCorner(readLoction, startPoint, CircleRadius) || ImageProcess.IsNearCorner(readLoction, endPoint, CircleRadius)) + { + imagePanel.image_pl.Cursor = Cursors.Hand; + } + else if (isRecDragging) + { + recDragRect = rectOriginalRect.rect; + switch (rectActiveCorner) + { + case Corner.drawMouse: + int offsetX = readLoction.X - recDragStart.X; + int offsetY = readLoction.Y - recDragStart.Y; + recDragRect.X += offsetX; + recDragRect.Y += offsetY; + + break; + case Corner.TopLeft: + recDragRect.Width += recDragRect.X - readLoction.X; + recDragRect.Height += recDragRect.Y - readLoction.Y; + recDragRect.X = readLoction.X; + recDragRect.Y = readLoction.Y; + + break; + case Corner.TopRight: + recDragRect.Width = readLoction.X - recDragRect.X; + recDragRect.Height += recDragRect.Y - readLoction.Y; + recDragRect.Y = readLoction.Y; + + break; + case Corner.BottomLeft: + recDragRect.Width += recDragRect.X - readLoction.X; + recDragRect.Height = readLoction.Y - recDragRect.Y; + recDragRect.X = readLoction.X; + + break; + case Corner.BottomRight: + recDragRect.Width = readLoction.X - recDragRect.X; + recDragRect.Height = readLoction.Y - recDragRect.Y; + + break; + default: + break; + } + imagePanel.image_pl.Invalidate(); // 触发重绘 + } + else if (isCirDragging) + { + if (rectActiveCorner != Corner.None) + { + if (rectActiveCorner == Corner.drawMouse) + { + // 计算鼠标位置与起始拖拽点的偏移量 + int offsetX = readLoction.X - cirDragStart.X; + int offsetY = readLoction.Y - cirDragStart.Y; + + // 更新圆心位置 + circleCenter.X += offsetX; + circleCenter.Y += offsetY; + circleRadio.X += offsetX; + circleRadio.Y += offsetY; + + // 重新设置起始拖拽点为当前鼠标位置,以便下一次计算 + cirDragStart = readLoction; + + + } + else + { + circleRadio = readLoction; + } + } + imagePanel.image_pl.Invalidate(); + + + } + else if (IsPointInRectangles(readLoction, rectangles, out var cner, out var cr, out var index)) // 遍历是否在所有矩形或者角点附近 + { + + } + else if (IsPointInCircle(readLoction, CircleAndInfoList, out var cner1, out var curRect, out var index1)) + { + } else if (isStartCircleDragged) { startPoint = readLoction; - + imagePanel.image_pl.Invalidate(); } else if (isEndCircleDragged) @@ -736,23 +1217,7 @@ namespace PBAnaly.Module endPoint = readLoction; imagePanel.image_pl.Invalidate(); } - else if (ImageProcess.IsNearCorner(readLoction,startPoint,CircleRadius) || ImageProcess.IsNearCorner(readLoction, endPoint, CircleRadius)) - { - imagePanel.image_pl.Cursor = Cursors.Hand; - } - else if(drawRect && e.Button == MouseButtons.Left) - { - // 动态调整矩形大小 - int x = Math.Min(leftTopPoint.X, e.X); - int y = Math.Min(leftTopPoint.Y, e.Y); - int width = Math.Abs(e.X - leftTopPoint.X); - int height = Math.Abs(e.Y - leftTopPoint.Y); - - currentRectangle = new System.Drawing.Rectangle(x, y, width, height); - imagePanel.image_pl.Invalidate(); // 触发重绘 - } - - else + else { imagePanel.image_pl.Cursor = Cursors.Default; } @@ -773,6 +1238,20 @@ namespace PBAnaly.Module drawLine = true; startPoint = readLoction; } + else if (rectOn) + { + // 开始绘制新矩形 + drawRect = true; + leftTopPoint = readLoction; + currentRectangle = new System.Drawing.Rectangle(readLoction.X, readLoction.Y, 0, 0); + } + else if (CircleOn) + { + //开始绘制圆形 + drawCircle = true; + circleRadio = readLoction; + circleCenter = readLoction; + } else if (imagePanel.IsImageLargerThanPanel()) { isDragging = true; @@ -792,12 +1271,31 @@ namespace PBAnaly.Module isEndCircleDragged = true; } - else if (rectOn) + else if (IsPointInCircle(readLoction, CircleAndInfoList, out var cner1, out var curRect, out var index1)) { - // 开始绘制新矩形 - drawRect = true; - leftTopPoint = e.Location; - currentRectangle = new System.Drawing.Rectangle(e.X, e.Y, 0, 0); + rectActiveCorner = cner1; + if (rectActiveCorner != Corner.None) + { + isCirDragging = true; + cirDragStart = readLoction; + cireOriginalCire = curRect; + circleCenter = curRect.center; + circleRadio = curRect.Radius; + cirDragStartIndex = index1; + } + + } + else if (IsPointInRectangles(readLoction, rectangles, out var cner, out var cr, out var index)) + { + rectActiveCorner = cner; + + if (rectActiveCorner != Corner.None) + { + isRecDragging = true; + recDragStart = readLoction; + rectOriginalRect = cr; + rectDragStartIndex = index; + } } } else if (e.Button == MouseButtons.Right) @@ -810,10 +1308,38 @@ namespace PBAnaly.Module imagePaletteForm.flb_act_mm.Text = ("0"); imagePaletteForm.flb_act_mm.Refresh(); } + else if (IsPointInCircle(readLoction, CircleAndInfoList, out var cner1, out var curRect, out var index1)) + { + CircleAndInfoList.RemoveAt(index1); + imagePanel.image_pl.Invalidate(); + } + else if (IsPointInRectangles(readLoction, rectangles, out var cner, out var cr, out var index)) + { + rectangles.RemoveAt(index); + imagePanel.image_pl.Invalidate(); + } } } + + private void ImagePanel_FormClosing(object sender, FormClosingEventArgs e) + { + if (this.imagePaletteForm != null) + { + this.imagePaletteForm.Close(); + this.imagePaletteForm.Dispose(); + this.imagePaletteForm = null; + } + this.pl_right.Controls.Clear(); + + } + + private void ImagePanel_FormClosed(object sender, FormClosedEventArgs e) + { + this.bioanalysisMannages[path] = null; + this.bioanalysisMannages.Remove(path); + } #endregion #region imagePaletteForm private void Hpb_line_Click(object sender, EventArgs e) @@ -825,6 +1351,10 @@ namespace PBAnaly.Module { rectOn = true; } + private void Hpb_circe_Click(object sender, EventArgs e) + { + CircleOn = true; + } #endregion #endregion #region 对外接口 diff --git a/src/PBAnaly/UI/BioanayImagePaletteForm.Designer.cs b/src/PBAnaly/UI/BioanayImagePaletteForm.Designer.cs index 63bb7f9..55fcb04 100644 --- a/src/PBAnaly/UI/BioanayImagePaletteForm.Designer.cs +++ b/src/PBAnaly/UI/BioanayImagePaletteForm.Designer.cs @@ -42,12 +42,12 @@ this.foxLabel1 = new ReaLTaiizor.Controls.FoxLabel(); this.foxLabel4 = new ReaLTaiizor.Controls.FoxLabel(); this.hpb_line = new ReaLTaiizor.Controls.HopePictureBox(); - this.hpb_wand = new ReaLTaiizor.Controls.HopePictureBox(); - this.hpb_xianduan = new ReaLTaiizor.Controls.HopePictureBox(); this.ftb_r = new ReaLTaiizor.Controls.FoxTextBox(); - this.hpb_rect = new ReaLTaiizor.Controls.HopePictureBox(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); - this.hpb_circe = new ReaLTaiizor.Controls.HopePictureBox(); + this.hpb_wand = new AntdUI.Avatar(); + this.hpb_xianduan = new AntdUI.Avatar(); + this.hpb_circe = new AntdUI.Avatar(); + this.hpb_rect = new AntdUI.Avatar(); this.panel2 = new AntdUI.Panel(); this.collapseItem2 = new AntdUI.CollapseItem(); this.cb_colortable = new System.Windows.Forms.ComboBox(); @@ -67,11 +67,7 @@ this.cll_panel = new AntdUI.Collapse(); this.collapseItem3 = new AntdUI.CollapseItem(); ((System.ComponentModel.ISupportInitialize)(this.hpb_line)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_wand)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_xianduan)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_rect)).BeginInit(); this.tableLayoutPanel3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_circe)).BeginInit(); this.panel2.SuspendLayout(); this.collapseItem2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); @@ -276,34 +272,6 @@ this.hpb_line.TabStop = false; this.hpb_line.TextRenderingType = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; // - // hpb_wand - // - this.hpb_wand.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(196)))), ((int)(((byte)(204))))); - this.hpb_wand.Image = global::PBAnaly.Properties.Resources.魔术棒_魔法_魔术_一键; - this.hpb_wand.Location = new System.Drawing.Point(105, 3); - this.hpb_wand.Name = "hpb_wand"; - this.hpb_wand.PixelOffsetType = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; - this.hpb_wand.Size = new System.Drawing.Size(28, 27); - this.hpb_wand.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.hpb_wand.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - this.hpb_wand.TabIndex = 13; - this.hpb_wand.TabStop = false; - this.hpb_wand.TextRenderingType = System.Drawing.Text.TextRenderingHint.SystemDefault; - // - // hpb_xianduan - // - this.hpb_xianduan.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(196)))), ((int)(((byte)(204))))); - this.hpb_xianduan.Image = global::PBAnaly.Properties.Resources.线段__1_; - this.hpb_xianduan.Location = new System.Drawing.Point(71, 3); - this.hpb_xianduan.Name = "hpb_xianduan"; - this.hpb_xianduan.PixelOffsetType = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; - this.hpb_xianduan.Size = new System.Drawing.Size(28, 27); - this.hpb_xianduan.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.hpb_xianduan.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - this.hpb_xianduan.TabIndex = 12; - this.hpb_xianduan.TabStop = false; - this.hpb_xianduan.TextRenderingType = System.Drawing.Text.TextRenderingHint.SystemDefault; - // // ftb_r // this.ftb_r.BackColor = System.Drawing.Color.Transparent; @@ -322,22 +290,6 @@ this.ftb_r.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; this.ftb_r.UseSystemPasswordChar = false; // - // hpb_rect - // - this.hpb_rect.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(196)))), ((int)(((byte)(204))))); - this.hpb_rect.Dock = System.Windows.Forms.DockStyle.Fill; - this.hpb_rect.Image = global::PBAnaly.Properties.Resources._10矩形; - this.hpb_rect.Location = new System.Drawing.Point(2, 2); - this.hpb_rect.Margin = new System.Windows.Forms.Padding(2); - this.hpb_rect.Name = "hpb_rect"; - this.hpb_rect.PixelOffsetType = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; - this.hpb_rect.Size = new System.Drawing.Size(30, 30); - this.hpb_rect.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.hpb_rect.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - this.hpb_rect.TabIndex = 10; - this.hpb_rect.TabStop = false; - this.hpb_rect.TextRenderingType = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; - // // tableLayoutPanel3 // this.tableLayoutPanel3.ColumnCount = 5; @@ -361,19 +313,49 @@ this.tableLayoutPanel3.Size = new System.Drawing.Size(266, 113); this.tableLayoutPanel3.TabIndex = 0; // + // hpb_wand + // + this.hpb_wand.Dock = System.Windows.Forms.DockStyle.Fill; + this.hpb_wand.Image = global::PBAnaly.Properties.Resources.魔术棒_魔法_魔术_一键; + this.hpb_wand.ImageFit = AntdUI.TFit.Contain; + this.hpb_wand.Location = new System.Drawing.Point(105, 3); + this.hpb_wand.Name = "hpb_wand"; + this.hpb_wand.Size = new System.Drawing.Size(28, 28); + this.hpb_wand.TabIndex = 14; + this.hpb_wand.Text = "a"; + // + // hpb_xianduan + // + this.hpb_xianduan.Dock = System.Windows.Forms.DockStyle.Fill; + this.hpb_xianduan.Image = global::PBAnaly.Properties.Resources.线段__1_; + this.hpb_xianduan.ImageFit = AntdUI.TFit.Contain; + this.hpb_xianduan.Location = new System.Drawing.Point(71, 3); + this.hpb_xianduan.Name = "hpb_xianduan"; + this.hpb_xianduan.Size = new System.Drawing.Size(28, 28); + this.hpb_xianduan.TabIndex = 13; + this.hpb_xianduan.Text = "a"; + // // hpb_circe // - this.hpb_circe.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(196)))), ((int)(((byte)(204))))); - this.hpb_circe.Image = global::PBAnaly.Properties.Resources.圆形1; + this.hpb_circe.Dock = System.Windows.Forms.DockStyle.Fill; + this.hpb_circe.Image = global::PBAnaly.Properties.Resources.圆形; + this.hpb_circe.ImageFit = AntdUI.TFit.Contain; this.hpb_circe.Location = new System.Drawing.Point(37, 3); this.hpb_circe.Name = "hpb_circe"; - this.hpb_circe.PixelOffsetType = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; - this.hpb_circe.Size = new System.Drawing.Size(28, 27); - this.hpb_circe.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.hpb_circe.SmoothingType = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - this.hpb_circe.TabIndex = 11; - this.hpb_circe.TabStop = false; - this.hpb_circe.TextRenderingType = System.Drawing.Text.TextRenderingHint.SystemDefault; + this.hpb_circe.Size = new System.Drawing.Size(28, 28); + this.hpb_circe.TabIndex = 0; + this.hpb_circe.Text = "a"; + // + // hpb_rect + // + this.hpb_rect.Dock = System.Windows.Forms.DockStyle.Fill; + this.hpb_rect.Image = global::PBAnaly.Properties.Resources._10矩形; + this.hpb_rect.ImageFit = AntdUI.TFit.Contain; + this.hpb_rect.Location = new System.Drawing.Point(3, 3); + this.hpb_rect.Name = "hpb_rect"; + this.hpb_rect.Size = new System.Drawing.Size(28, 28); + this.hpb_rect.TabIndex = 0; + this.hpb_rect.Text = "a"; // // panel2 // @@ -396,7 +378,7 @@ // this.collapseItem2.Controls.Add(this.tableLayoutPanel3); this.collapseItem2.Expand = true; - this.collapseItem2.Location = new System.Drawing.Point(19, 433); + this.collapseItem2.Location = new System.Drawing.Point(19, 99); this.collapseItem2.Name = "collapseItem2"; this.collapseItem2.Size = new System.Drawing.Size(266, 113); this.collapseItem2.TabIndex = 1; @@ -637,8 +619,7 @@ // collapseItem1 // this.collapseItem1.Controls.Add(this.tableLayoutPanel1); - this.collapseItem1.Expand = true; - this.collapseItem1.Location = new System.Drawing.Point(19, 59); + this.collapseItem1.Location = new System.Drawing.Point(-266, -302); this.collapseItem1.Name = "collapseItem1"; this.collapseItem1.Size = new System.Drawing.Size(266, 302); this.collapseItem1.TabIndex = 0; @@ -661,7 +642,7 @@ // collapseItem3 // this.collapseItem3.Expand = true; - this.collapseItem3.Location = new System.Drawing.Point(19, 618); + this.collapseItem3.Location = new System.Drawing.Point(19, 284); this.collapseItem3.Margin = new System.Windows.Forms.Padding(2); this.collapseItem3.Name = "collapseItem3"; this.collapseItem3.Size = new System.Drawing.Size(266, 154); @@ -679,11 +660,7 @@ this.Name = "BioanayImagePaletteForm"; this.Text = "BioanayImagePaletteForm"; ((System.ComponentModel.ISupportInitialize)(this.hpb_line)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_wand)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_xianduan)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.hpb_rect)).EndInit(); this.tableLayoutPanel3.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.hpb_circe)).EndInit(); this.panel2.ResumeLayout(false); this.collapseItem2.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); @@ -716,11 +693,8 @@ private ReaLTaiizor.Controls.FoxLabel foxLabel1; private System.Windows.Forms.PictureBox pb_bgimage; private ReaLTaiizor.Controls.FoxLabel foxLabel4; - private ReaLTaiizor.Controls.HopePictureBox hpb_wand; - private ReaLTaiizor.Controls.HopePictureBox hpb_xianduan; private ReaLTaiizor.Controls.FoxTextBox ftb_r; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; - private ReaLTaiizor.Controls.HopePictureBox hpb_circe; private AntdUI.Panel panel2; private AntdUI.CollapseItem collapseItem2; private AntdUI.Panel panel1; @@ -739,6 +713,9 @@ public System.Windows.Forms.ComboBox cb_colortable; public ReaLTaiizor.Controls.HopePictureBox hpb_line; public ReaLTaiizor.Controls.FoxLabel flb_act_mm; - public ReaLTaiizor.Controls.HopePictureBox hpb_rect; + public AntdUI.Avatar hpb_circe; + public AntdUI.Avatar hpb_rect; + public AntdUI.Avatar hpb_xianduan; + public AntdUI.Avatar hpb_wand; } } \ No newline at end of file diff --git a/src/PBAnaly/UI/BioanayImagePaletteForm.cs b/src/PBAnaly/UI/BioanayImagePaletteForm.cs index 0fb97c9..ca947dc 100644 --- a/src/PBAnaly/UI/BioanayImagePaletteForm.cs +++ b/src/PBAnaly/UI/BioanayImagePaletteForm.cs @@ -1,4 +1,6 @@ -using System; +using Aspose.Pdf.Drawing; +using Aspose.Pdf; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -12,9 +14,30 @@ namespace PBAnaly.UI { public partial class BioanayImagePaletteForm : Form { + private int roi_w = 20; + private int roi_h = 20; + private int circle_r = 10; public BioanayImagePaletteForm() { InitializeComponent(); } + + #region 对外接口 + public int ROI_W + { + get { return roi_w; } + set { roi_w = value; ftb_w.Text = roi_w.ToString(); } + } + public int ROI_H + { + get { return roi_h; } + set { roi_h = value; ftb_h.Text = roi_h.ToString(); } + } + public int CIRCLE_R + { + get { return circle_r; } + set { circle_r = value; ftb_r.Text = circle_r.ToString(); } + } + #endregion } }