Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functional onix-headstage-neuropix1 support #315

Merged
merged 8 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.bonsai/*.exe.settings
.bonsai/*.exe.WebView2/
*.user
/OpenEphys.Onix1/ConfigureHeadstageNric1384LoadTest.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ namespace OpenEphys.Onix1.Design
/// <summary>
/// Partial class to create a channel configuration GUI for the <see cref="ConfigureNeuropixelsV2e"/> class.
/// </summary>
public partial class NeuropixelsV1eChannelConfigurationDialog : ChannelConfigurationDialog
public partial class NeuropixelsV1ChannelConfigurationDialog : ChannelConfigurationDialog
{
internal event EventHandler OnZoom;
internal event EventHandler OnFileLoad;

readonly IReadOnlyList<int> ReferenceContactsList = new List<int> { 191, 575, 959 };

/// <summary>
/// Public <see cref="NeuropixelsV1eProbeConfiguration"/> object that is modified by
/// <see cref="NeuropixelsV1eChannelConfigurationDialog"/>.
/// Public <see cref="NeuropixelsV1ProbeConfiguration"/> object that is modified by
/// <see cref="NeuropixelsV1ChannelConfigurationDialog"/>.
/// </summary>
public NeuropixelsV1eProbeConfiguration ProbeConfiguration { get; set; }
public NeuropixelsV1ProbeConfiguration ProbeConfiguration { get; set; }

/// <summary>
/// Initializes a new instance of <see cref="NeuropixelsV1eChannelConfigurationDialog"/>.
/// Initializes a new instance of <see cref="NeuropixelsV1ChannelConfigurationDialog"/>.
/// </summary>
/// <param name="probeConfiguration">A <see cref="NeuropixelsV1eProbeConfiguration"/> object holding the current configuration settings.</param>
public NeuropixelsV1eChannelConfigurationDialog(NeuropixelsV1eProbeConfiguration probeConfiguration)
/// <param name="probeConfiguration">A <see cref="NeuropixelsV1ProbeConfiguration"/> object holding the current configuration settings.</param>
public NeuropixelsV1ChannelConfigurationDialog(NeuropixelsV1ProbeConfiguration probeConfiguration)
: base(probeConfiguration.ChannelConfiguration)
{
zedGraphChannels.ZoomButtons = MouseButtons.None;
Expand Down Expand Up @@ -202,7 +202,7 @@ internal override void HighlightEnabledContacts()
var contactsToEnable = contactObjects.Where(c =>
{
var tag = c.Tag as ContactTag;
var channel = NeuropixelsV1eElectrode.GetChannelNumber(tag.ContactIndex);
var channel = NeuropixelsV1Electrode.GetChannelNumber(tag.ContactIndex);
return ProbeConfiguration.ChannelMap[channel].Index == tag.ContactIndex;
});

Expand Down Expand Up @@ -232,7 +232,7 @@ internal override void UpdateContactLabels()
textObjsToUpdate = textObjs.Where(c =>
{
var tag = c.Tag as ContactTag;
var channel = NeuropixelsV1eElectrode.GetChannelNumber(tag.ContactIndex);
var channel = NeuropixelsV1Electrode.GetChannelNumber(tag.ContactIndex);
return ProbeConfiguration.ChannelMap[channel].Index == tag.ContactIndex;
});

Expand All @@ -247,7 +247,7 @@ internal override string ContactString(int deviceChannelIndex, int index)
return index.ToString();
}

internal void EnableElectrodes(List<NeuropixelsV1eElectrode> electrodes)
internal void EnableElectrodes(List<NeuropixelsV1Electrode> electrodes)
{
ProbeConfiguration.SelectElectrodes(electrodes);
}
Expand Down
153 changes: 153 additions & 0 deletions OpenEphys.Onix1.Design/NeuropixelsV1Dialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions OpenEphys.Onix1.Design/NeuropixelsV1Dialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;
using System.Windows.Forms;

namespace OpenEphys.Onix1.Design
{
/// <summary>
/// Partial class to create a GUI for <see cref="ConfigureNeuropixelsV1e"/>.
/// </summary>
public partial class NeuropixelsV1Dialog : Form
{
readonly NeuropixelsV1ProbeConfigurationDialog ProbeConfigurationDialog;

/// <summary>
/// Public <see cref="IConfigureNeuropixelsV1"/> interface that is manipulated by
/// <see cref="NeuropixelsV1Dialog"/>.
/// </summary>
public IConfigureNeuropixelsV1 ConfigureNode { get; set; }

/// <summary>
/// Initializes a new instance of <see cref="NeuropixelsV1Dialog"/>.
/// </summary>
/// <param name="configureNode">A <see cref="ConfigureNeuropixelsV1e"/> object holding the current configuration settings.</param>
public NeuropixelsV1Dialog(IConfigureNeuropixelsV1 configureNode)
{
InitializeComponent();
Shown += FormShown;

if (configureNode is ConfigureNeuropixelsV1e configureV1e)
{
ConfigureNode = new ConfigureNeuropixelsV1e(configureV1e);
}
else if (configureNode is ConfigureNeuropixelsV1f configureV1f)
{
ConfigureNode = new ConfigureNeuropixelsV1f(configureV1f);
}

ProbeConfigurationDialog = new(ConfigureNode.ProbeConfiguration, ConfigureNode.AdcCalibrationFile, ConfigureNode.GainCalibrationFile)
{
TopLevel = false,
FormBorderStyle = FormBorderStyle.None,
Dock = DockStyle.Fill,
Parent = this
};

panelProbe.Controls.Add(ProbeConfigurationDialog);

this.AddMenuItemsFromDialogToFileOption(ProbeConfigurationDialog);
}

private void FormShown(object sender, EventArgs e)
{
if (!TopLevel)
{
tableLayoutPanel1.Controls.Remove(flowLayoutPanel1);
tableLayoutPanel1.RowCount = 1;

menuStrip.Visible = false;
}

ProbeConfigurationDialog.Show();
}

internal void Okay_Click(object sender, EventArgs e)
{
SaveVariables();

DialogResult = DialogResult.OK;
}

internal void SaveVariables()
{
ConfigureNode.ProbeConfiguration = ProbeConfigurationDialog.ProbeConfiguration;

ConfigureNode.GainCalibrationFile = ProbeConfigurationDialog.textBoxGainCalibrationFile.Text;
ConfigureNode.AdcCalibrationFile = ProbeConfigurationDialog.textBoxAdcCalibrationFile.Text;
}
}
}
Loading