Skip to content

Commit

Permalink
Merge pull request #315 from open-ephys/issue-100-2
Browse files Browse the repository at this point in the history
Functional onix-headstage-neuropix1 support
  • Loading branch information
jonnew authored Oct 14, 2024
2 parents cd87fc4 + 48f3c28 commit 450f829
Show file tree
Hide file tree
Showing 48 changed files with 6,053 additions and 659 deletions.

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

0 comments on commit 450f829

Please sign in to comment.