From b01e42364cb66e3aa591ac9e6c2f3af102b05bb8 Mon Sep 17 00:00:00 2001 From: EmineTopcu <50247946+EmineTopcu@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:55:53 -0400 Subject: [PATCH] Options in 2D rendering Version: 3.0.1 --- .../Display/TwoDRenderControl.Designer.cs | 61 +++++++++++++++--- .../Controls/Display/TwoDRenderControl.cs | 22 ++++++- SiliFish.UI/Resources/BuildDate.txt | Bin 44 -> 44 bytes SiliFish.UI/SiliFish.UI.csproj | 2 +- SiliFish/SiliFish.csproj | 2 +- 5 files changed, 75 insertions(+), 12 deletions(-) diff --git a/SiliFish.UI/Controls/Display/TwoDRenderControl.Designer.cs b/SiliFish.UI/Controls/Display/TwoDRenderControl.Designer.cs index a84822b..68367d4 100644 --- a/SiliFish.UI/Controls/Display/TwoDRenderControl.Designer.cs +++ b/SiliFish.UI/Controls/Display/TwoDRenderControl.Designer.cs @@ -32,6 +32,9 @@ private void InitializeComponent() { gr2DCellPoolLegend = new GroupBox(); p2DRenderOptions = new Panel(); + cb2DMuscleCells = new CheckBox(); + cb2DInterneuron = new CheckBox(); + cb2DMotoneuron = new CheckBox(); ud2DNodeSize = new General.UpDownControl(); ud2DLinkSize = new General.UpDownControl(); cb2DOffline = new CheckBox(); @@ -74,6 +77,9 @@ private void InitializeComponent() // p2DRenderOptions // p2DRenderOptions.BackColor = Color.FromArgb(236, 239, 241); + p2DRenderOptions.Controls.Add(cb2DMuscleCells); + p2DRenderOptions.Controls.Add(cb2DInterneuron); + p2DRenderOptions.Controls.Add(cb2DMotoneuron); p2DRenderOptions.Controls.Add(ud2DNodeSize); p2DRenderOptions.Controls.Add(ud2DLinkSize); p2DRenderOptions.Controls.Add(cb2DOffline); @@ -91,9 +97,45 @@ private void InitializeComponent() p2DRenderOptions.TabIndex = 55; p2DRenderOptions.Visible = false; // + // cb2DMuscleCells + // + cb2DMuscleCells.Checked = true; + cb2DMuscleCells.CheckState = CheckState.Checked; + cb2DMuscleCells.Location = new Point(134, 56); + cb2DMuscleCells.Name = "cb2DMuscleCells"; + cb2DMuscleCells.Size = new Size(115, 20); + cb2DMuscleCells.TabIndex = 80; + cb2DMuscleCells.Text = "Muscle Cells"; + cb2DMuscleCells.UseVisualStyleBackColor = true; + cb2DMuscleCells.CheckedChanged += cb2DCellSelection_CheckedChanged; + // + // cb2DInterneuron + // + cb2DInterneuron.Checked = true; + cb2DInterneuron.CheckState = CheckState.Checked; + cb2DInterneuron.Location = new Point(134, 4); + cb2DInterneuron.Name = "cb2DInterneuron"; + cb2DInterneuron.Size = new Size(103, 20); + cb2DInterneuron.TabIndex = 78; + cb2DInterneuron.Text = "Interneurons"; + cb2DInterneuron.UseVisualStyleBackColor = true; + cb2DInterneuron.CheckedChanged += cb2DCellSelection_CheckedChanged; + // + // cb2DMotoneuron + // + cb2DMotoneuron.Checked = true; + cb2DMotoneuron.CheckState = CheckState.Checked; + cb2DMotoneuron.Location = new Point(134, 30); + cb2DMotoneuron.Name = "cb2DMotoneuron"; + cb2DMotoneuron.Size = new Size(115, 20); + cb2DMotoneuron.TabIndex = 79; + cb2DMotoneuron.Text = "Motoneurons"; + cb2DMotoneuron.UseVisualStyleBackColor = true; + cb2DMotoneuron.CheckedChanged += cb2DCellSelection_CheckedChanged; + // // ud2DNodeSize // - ud2DNodeSize.Location = new Point(319, 2); + ud2DNodeSize.Location = new Point(423, 2); ud2DNodeSize.Name = "ud2DNodeSize"; ud2DNodeSize.Size = new Size(18, 23); ud2DNodeSize.TabIndex = 77; @@ -103,7 +145,7 @@ private void InitializeComponent() // // ud2DLinkSize // - ud2DLinkSize.Location = new Point(319, 28); + ud2DLinkSize.Location = new Point(423, 28); ud2DLinkSize.Name = "ud2DLinkSize"; ud2DLinkSize.Size = new Size(18, 23); ud2DLinkSize.TabIndex = 76; @@ -128,7 +170,7 @@ private void InitializeComponent() // cb2DShowUnselectedNodes.Checked = true; cb2DShowUnselectedNodes.CheckState = CheckState.Checked; - cb2DShowUnselectedNodes.Location = new Point(145, 58); + cb2DShowUnselectedNodes.Location = new Point(262, 56); cb2DShowUnselectedNodes.Name = "cb2DShowUnselectedNodes"; cb2DShowUnselectedNodes.Size = new Size(180, 20); cb2DShowUnselectedNodes.TabIndex = 74; @@ -139,7 +181,7 @@ private void InitializeComponent() // cb2DHideNonspiking // cb2DHideNonspiking.AutoSize = true; - cb2DHideNonspiking.Location = new Point(8, 6); + cb2DHideNonspiking.Location = new Point(8, 4); cb2DHideNonspiking.Name = "cb2DHideNonspiking"; cb2DHideNonspiking.Size = new Size(120, 19); cb2DHideNonspiking.TabIndex = 73; @@ -165,7 +207,7 @@ private void InitializeComponent() // l2DLinkSize // l2DLinkSize.AutoSize = true; - l2DLinkSize.Location = new Point(249, 32); + l2DLinkSize.Location = new Point(353, 32); l2DLinkSize.Name = "l2DLinkSize"; l2DLinkSize.Size = new Size(64, 15); l2DLinkSize.TabIndex = 71; @@ -176,7 +218,7 @@ private void InitializeComponent() // cb2DChemJunc.Checked = true; cb2DChemJunc.CheckState = CheckState.Checked; - cb2DChemJunc.Location = new Point(145, 6); + cb2DChemJunc.Location = new Point(262, 4); cb2DChemJunc.Name = "cb2DChemJunc"; cb2DChemJunc.Size = new Size(85, 20); cb2DChemJunc.TabIndex = 58; @@ -188,7 +230,7 @@ private void InitializeComponent() // cb2DGapJunc.Checked = true; cb2DGapJunc.CheckState = CheckState.Checked; - cb2DGapJunc.Location = new Point(145, 32); + cb2DGapJunc.Location = new Point(262, 30); cb2DGapJunc.Name = "cb2DGapJunc"; cb2DGapJunc.Size = new Size(80, 20); cb2DGapJunc.TabIndex = 59; @@ -199,7 +241,7 @@ private void InitializeComponent() // l2DNodeSize // l2DNodeSize.AutoSize = true; - l2DNodeSize.Location = new Point(249, 6); + l2DNodeSize.Location = new Point(353, 6); l2DNodeSize.Name = "l2DNodeSize"; l2DNodeSize.Size = new Size(59, 15); l2DNodeSize.TabIndex = 69; @@ -383,5 +425,8 @@ private void InitializeComponent() private SiliFishWebView webView2DRender; private General.UpDownControl ud2DNodeSize; private General.UpDownControl ud2DLinkSize; + private CheckBox cb2DMuscleCells; + private CheckBox cb2DInterneuron; + private CheckBox cb2DMotoneuron; } } \ No newline at end of file diff --git a/SiliFish.UI/Controls/Display/TwoDRenderControl.cs b/SiliFish.UI/Controls/Display/TwoDRenderControl.cs index f0d70ab..4f3135b 100644 --- a/SiliFish.UI/Controls/Display/TwoDRenderControl.cs +++ b/SiliFish.UI/Controls/Display/TwoDRenderControl.cs @@ -82,8 +82,21 @@ internal void RenderIn2D(bool refresh) //If the full rendering has never been done, a brand new 2D rendering need to be created rather than refreshing the old one if (refresh && !cb2DHideNonspiking.Checked && !rendered2DFull) refresh = false; - List cellPools = model.CellPools; - List activePools = model.CellPools.Where(cp => cp.Cells.Any(c => c.IsActivelySpiking(GlobalSettings.ActivityThresholdSpikeCount))).ToList(); + List cellPools;//FUTURE - there can be more options, like sensory, supraspinal, etc + if (cb2DInterneuron.Checked && cb2DMotoneuron.Checked && cb2DMuscleCells.Checked) + { + cellPools = model.CellPools; + } + else + { + cellPools = (cb2DMotoneuron.Checked ? model.MotoNeuronPools : []).Concat( + (cb2DInterneuron.Checked ? model.InterNeuronPools : []).Concat( + cb2DMuscleCells.Checked ? model.MusclePools : [] + ) + ).ToList(); + } + + List activePools = cellPools.Where(cp => cp.Cells.Any(c => c.IsActivelySpiking(GlobalSettings.ActivityThresholdSpikeCount))).ToList(); List inactivePools = cellPools.Except(activePools).ToList(); string html; if (cb2DHideNonspiking.CheckState == CheckState.Checked && simulation != null && simulation.SimulationRun) @@ -208,5 +221,10 @@ private void cb2DHideNonspiking_CheckStateChanged(object sender, EventArgs e) { RenderIn2D(true); } + + private void cb2DCellSelection_CheckedChanged(object sender, EventArgs e) + { + RenderIn2D(true); + } } } diff --git a/SiliFish.UI/Resources/BuildDate.txt b/SiliFish.UI/Resources/BuildDate.txt index 487550a99ca9b1ab9c114ecb35af7df9962e18c2..cc02e7fbccefe67cc8095694f2c05cff01b8ffd5 100644 GIT binary patch literal 44 rcmezW&xpZ*!HB_xK^I6{07+vY9RkFL3|2sK10ZS2V9vnHz{LOnvcd)V literal 44 scmezW&xpZ*!HB_xK^I6{07)YTQ-%;AX~bX!7O`S5W-w>qW#D1}0JDw;1ONa4 diff --git a/SiliFish.UI/SiliFish.UI.csproj b/SiliFish.UI/SiliFish.UI.csproj index 9e23e63..dc372a0 100644 --- a/SiliFish.UI/SiliFish.UI.csproj +++ b/SiliFish.UI/SiliFish.UI.csproj @@ -6,7 +6,7 @@ true enable true - 3.0.0 + 3.0.1 fishbone2BlueBG.png Resources\fishbone2BlueBG.ico 7.0 diff --git a/SiliFish/SiliFish.csproj b/SiliFish/SiliFish.csproj index 5ac6a46..9606b20 100644 --- a/SiliFish/SiliFish.csproj +++ b/SiliFish/SiliFish.csproj @@ -5,7 +5,7 @@ net8.0 x64 - 3.0.0 + 3.0.1 $(NoWarn);SYSLIB1045