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

Add configuration GUI for NeuropixelsV2e #214

Merged
merged 25 commits into from
Aug 20, 2024
Merged

Add configuration GUI for NeuropixelsV2e #214

merged 25 commits into from
Aug 20, 2024

Conversation

bparks13
Copy link
Member

@bparks13 bparks13 commented Aug 13, 2024

This PR aims to add a configuration GUI at each level of NeuropixelsV2e. Individual ProbeConfiguration variables can be selected to open a GUI that modifies the individual probe configuration, or the ConfigureNeuropixelsV2eHeadstage can be double-clicked to open up a dialog with both possible probes in tabs, and the NeuropixelsV2eBno055 in a separate tab.

After opening the GUI, there are two tabs that will initially be blank (Probe A / Probe B); to show the probes for editing, select a calibration file on the right side. Alternatively, you can set the calibration file from the property editor in the main Bonsai editor.

Controls: Mouse wheel zooms in/out, left-click and drag will select contacts, left-click will select a single contact or will clear the selection if no contact is selected, middle-click and drag will pan the contacts.

On the right side there is a scroll bar that can be used to move the probe up and down, which is useful when zooming in to get to the top or bottom quickly.

To change the enabled channels (enabled channels are in blue, disabled channels are gray), select any number of channels, and choose Enable Contacts. To clear the currently selected channels without enabling them, press Clear Selection.

Channel presets can also be used for each probe separately, choose any preset from the drop-down menu and it will automatically populate the correct channels.

Menu drop-downs (File -> NeuropixelsV2e -> Probe A/B) can be used to load or save the JSON file (the ProbeInterface file), or to reset the selected channels you can load the default from that menu.

Closes #88
Fixes #137
Partially fixes #182

bparks13 added 16 commits July 12, 2024 16:05
- Create ProbeInterface submodule
- Add NuGet packages to Design
- Add common framework files
- Add resources
- Ensure GUI gain calibration parsing matches configuration parsing
- Prevent reference overwriting
- Ensure that Bno055 state is correctly saved
- Update submodule
- Enforce 384 channels in the channel map
- Update contacts to be more easily seen, and that numbers fit inside the contact
- Correctly copy device name/address
- Rename "Contacts" to "Electrodes"
- Zoom in on the mouse pointer
- Always show contact numbers, even when disabled
- Add position labels to track bar
- Make contacts more visible
- Automatically resize scale depending on zoom level
- Spelling
- Based on feedback given from issue-186
- Update variable names to be more clear
- Formatting fixes
- Update XML comments to reflect convention correctly
- Add all missing XML comments
- Refactor to use NeuropixelsV2QuadShankProbeConfiguration directly
- During zoom, keep focus centered on cursor
- Add boundary for zooming in
- Update documentation
- Add check for incorrect tag type when toggling contact status
- Add probe configuration dialog
- Individual probe configuration variables can be selected in Bonsai and pop up their own dialog
- Double clicking the ConfigureNeuropixelsV2e operator will place each probe configuration dialog in its own tab
- Double clicking the ConfigureNeuropixelsV2eHeadstage operator will place the device dialog in its own tab, with both probe configuration tabs inside of that
- Update .gitignore to ignore .vscode and .csproj.user files
- Fix scaling due to resolution differences
- Reorganize GUI elements
- Check if the probe is in view after every zoom event
- Check for probe in view after panning event
- Add tooltips to buttons
- Ensure that configuration options are not saved unless the user presses Okay
@bparks13 bparks13 added the feature New planned feature label Aug 13, 2024
@bparks13 bparks13 added this to the 0.2.0 milestone Aug 13, 2024
This was linked to issues Aug 13, 2024
@jonnew
Copy link
Member

jonnew commented Aug 14, 2024

The first thing I will do is look at the ProbeInterface code so we can create a nuget package. Once thats taken care of, we can remove the submodule and try, reference the nuget package instead, and try the automated build again.

- Add remarks for ProbeConfiguration variables
- Add Category attributes to Neuropixels properties
- Remove submodule and reference OpenEphys.ProbeInterface directly from NuGet
- Remove AnyCPU options
@bparks13 bparks13 requested a review from jonnew August 14, 2024 22:09
@jonnew
Copy link
Member

jonnew commented Aug 15, 2024

Functionally, I have not found an issue yet. Design wise, here are my notes:

image

@bparks13
Copy link
Member Author

@jonnew I'll get to work on these. Couple of clarifying comments/questions:

File menu drop-down: Are you wanting it to be a flat file menu, or modifying the current levels to match the strings given? Meaning, would it still be NeuropixelsV2e -> Probe A | B -> "new strings here"? That would be easy enough to do.

The documentation link is something that I saw in the Bonsai.ONIX.Design library and copied over, currently it is (or should be) pointing to the new Onix1 Bonsai docs page, but it does not automatically update. The F1 help that can be reached from the main Bonsai editor points to the same or similar page, so we should be fine just removing the documentation link label from the GUI.

- Remove documentation link
- Link the trackbar size to the zedGraph size
- Align GUI elements
- Reduce thickness of the scale lines when zoomed out
- Change wording of open/save file menus for clarity
- Add Open Ephys logo to all dialogs
- Remove empty .gitmodules file
@jonnew
Copy link
Member

jonnew commented Aug 19, 2024

I dont like ParseGainCalibrationFile() because it does not reflect hardware and does not check that the file is in the correct format. Its nice to have this information below, but what happens if there is nonsense in the file?

@bparks13
Copy link
Member Author

@jonnew This function is not meant to reflect hardware, it is purely a parsing function for the file itself because the ReadGainCorrection() method assumes that we already know the serial number, but in the GUI we have no way to access the serial number on the hardware. I added it as a sanity check while configuring the GUI so that the user could make sure that they were using the correct gain calibration file before trying to run the workflow and getting an exception then.

Regarding the file format, there is also no checking for the file format when the workflow is running and the gain correction is read, so what I can do is add some checking of the file format and also refactor it a little bit so that the two methods are calling the same underlying function to ensure consistency.

jonnew and others added 3 commits August 20, 2024 13:01
- Similify some GUI elements
- Remove file parsing, SN and Gain display (not because they are a bad
  idea but because parsing is redundant with that done in the main
  library. To do it correctly, the main library should have a file
  template the compare against in a static method that can be accesssed
  from the GUI).
- Don't allow manual resizing of splitter panels
- Minor adjustments to controls spacing and alignment
- Remove unused methods / controls
- Add check if a file exists to hide/show probe panel
Copy link
Member

@jonnew jonnew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review was performed outside of github via integration testing and talking on discord.

@jonnew jonnew merged commit 60e22f1 into main Aug 20, 2024
6 checks passed
@jonnew jonnew deleted the issue-88 branch August 20, 2024 18:27
@jonnew
Copy link
Member

jonnew commented Aug 20, 2024

Merged 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature
Projects
None yet
2 participants