Skip to content

Commit

Permalink
Update editor layout
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Jun 25, 2022
1 parent 3087b54 commit 7157224
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 40 deletions.
91 changes: 83 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,88 @@
# ZMQInterface plugin
A plugin enabling the interfacing of [ZeroMQ](http:https://zeromq.org/) clients to Open Ephys. The interface exposes all data and events and allows to provide events to the application, enabling the creation of advanced visualization and monitoring add-ons. For more information, go to our [wiki](https://open-ephys.atlassian.net/wiki/spaces/OEW/pages/1547206701/ZMQInterface) and find out how to use this plugin.
# ZMQ Interface

![zmq-interface-screenshot](Resources/zmq-interface.png)

Streams continuous data, events, and spikes via [ZeroMQ](http:https://zeromq.org/).


## Installation
### Installing the 0MQ library
For windows, linux, and mac, the required files are already included for the plugin

### Building the plugins
Building the plugins requires [CMake](https://cmake.org/). Detailed instructions on how to build open ephys plugins with CMake can be found in [our wiki](https://open-ephys.atlassian.net/wiki/spaces/OEW/pages/1259110401/Plugin+CMake+Builds).
(Coming soon)


## Usage

(add link to documentation)



## Building from source

First, follow the instructions on [this page](https://open-ephys.github.io/gui-docs/Developer-Guide/Compiling-the-GUI.html) to build the Open Ephys GUI.

**Important:** This plugin is intended for use with the pre-release core application, version 0.6.0. The GUI should be compiled from the [`development-juce6`](https://github.com/open-ephys/plugin-gui/tree/development-juce6) branch, rather than the `master` branch.

Then, clone this repository into a directory at the same level as the `plugin-GUI`, e.g.:

```
Code
├── plugin-GUI
│ ├── Build
│ ├── Source
│ └── ...
├── OEPlugins
│ └── zmq-interface
│ ├── Build
│ ├── Source
│ └── ...
```

### Windows

**Requirements:** [Visual Studio](https://visualstudio.microsoft.com/) and [CMake](https://cmake.org/install/)

From the `Build` directory, enter:

```bash
cmake -G "Visual Studio 17 2022" -A x64 ..
```

Next, launch Visual Studio and open the `OE_PLUGIN_zmq-interface.sln` file that was just created. Select the appropriate configuration (Debug/Release) and build the solution.

Selecting the `INSTALL` project and manually building it will copy the `.dll` and any other required files into the GUI's `plugins` directory. The next time you launch the GUI from Visual Studio, the ZMQ Interface plugin should be available.


### Linux

**Requirements:** [CMake](https://cmake.org/install/)

From the `Build` directory, enter:

```bash
cmake -G "Unix Makefiles" ..
cd Debug
make -j
make install
```

This will build the plugin and copy the `.so` file into the GUI's `plugins` directory. The next time you launch the GUI compiled version of the GUI, the ZMQ Interface plugin should be available.


### macOS

**Requirements:** [Xcode](https://developer.apple.com/xcode/) and [CMake](https://cmake.org/install/)

From the `Build` directory, enter:

```bash
cmake -G "Xcode" ..
```

Next, launch Xcode and open the `zmq-interface.xcodeproj` file that now lives in the “Build” directory.

Running the `ALL_BUILD` scheme will compile the plugin; running the `INSTALL` scheme will install the `.bundle` file to `/Users/<username>/Library/Application Support/open-ephys/plugins-api`. The ZMQ Interface plugin should be available the next time you launch the GUI from Xcode.


## Attribution
Originally developed by [Francesco Battaglia](https://github.com/fpbattaglia) at [Memory Dynamics Lab](https://www.memorydynamics.org/).
Updated and maintained by [András Széll](https://github.com/aszell).

This plugin was originally developed by [Francesco Battaglia](https://github.com/fpbattaglia) at [Memory Dynamics Lab](https://www.memorydynamics.org/), and was later updated by [András Széll](https://github.com/aszell). It is now being maintained by the Allen Institute.
Binary file added Resources/zmq-interface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 18 additions & 32 deletions Source/ZmqInterfaceEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,23 @@
*/

/*
==============================================================================
ZmqInterfaceEditor.cpp
Created: 22 Sep 2015 9:42:44am
Author: Francesco Battaglia
==============================================================================
*/




#include "ZmqInterfaceEditor.h"
#include "ZmqInterface.h"

class ZmqInterfaceEditor::ZmqInterfaceEditorListBox: public ListBox,
private ListBoxModel, public AsyncUpdater
{
public:

ZmqInterfaceEditorListBox(const String noItemsText, ZmqInterfaceEditor *e):
ListBox(String(), nullptr), noItemsMessage(noItemsText)
ListBox(String(), nullptr), noItemsMessage(noItemsText)
{
editor = e;
setModel(this);

backgroundGradient = ColourGradient(Colour(190, 190, 190), 0.0f, 0.0f,
Colour(185, 185, 185), 0.0f, 120.0f, false);
backgroundGradient.addColour(0.2f, Colour(155, 155, 155));
backgroundGradient = ColourGradient(Colour(220, 220, 220), 0.0f, 0.0f,
Colour(195, 195, 195), 0.0f, 120.0f, false);
backgroundGradient.addColour(0.2f, Colour(185, 185, 185));

backgroundColor = Colour(155, 155, 155);

Expand Down Expand Up @@ -119,22 +107,19 @@ private ListBoxModel, public AsyncUpdater

if (!CoreServices::getAcquisitionStatus())
{
g.drawText ("Waiting for acqusition",
0, 0, getWidth(), getHeight() / 2,
Justification::centred, true);
g.drawText ("Waiting...",
10, 0, getWidth(), getHeight() / 2,
Justification::centredLeft, true);
}
else
{
g.drawText (noItemsMessage,
0, 0, getWidth(), getHeight() / 2,
Justification::centred, true);
10, 0, getWidth(), getHeight() / 2,
Justification::centredLeft, true);
}
}
}




private:
const String noItemsMessage;
ZmqInterfaceEditor *editor;
Expand All @@ -158,25 +143,26 @@ ZmqInterfaceEditor::ZmqInterfaceEditor(GenericProcessor *parentNode): GenericEdi

desiredWidth = 280;

listBox = std::make_unique<ZmqInterfaceEditorListBox>(String("No App connected"), this);
listBox->setBounds(100,45,170,80);
listBox = std::make_unique<ZmqInterfaceEditorListBox>(String("None"), this);
listBox->setBounds(112,45,160,80);
addAndMakeVisible(listBox.get());

listTitle = std::make_unique<Label>("ListBox Label", "List of connected apps:");
listTitle = std::make_unique<Label>("ListBox Label", "Connected apps:");
listTitle->setColour(Label::textColourId, Colours::black);
listTitle->setBounds(100,27,170,15);
listTitle->setBounds(112,27,160,15);
listTitle->setFont(Font("Fira Code", "SemiBold", 14.0f));
addAndMakeVisible(listTitle.get());

addComboBoxParameterEditor("Stream", 10, 22);
addComboBoxParameterEditor("Stream", 15, 22);
parameterEditors.getLast()->setBounds(15, 22, 120, 42);

// addSelectedChannelsParameterEditor("Channels", 10, 67);
Parameter* maskChansParam = getProcessor()->getParameter("Channels");
maskchannelsEditor = std::make_unique<MaskChannelsParameterEditor>(maskChansParam);
maskchannelsEditor->setBounds(10, 67, maskchannelsEditor->getWidth(), maskchannelsEditor->getHeight());
maskchannelsEditor->setBounds(15, 67, maskchannelsEditor->getWidth(), maskchannelsEditor->getHeight());
addAndMakeVisible(maskchannelsEditor.get());

addTextBoxParameterEditor("data_port", 10, 87);
addTextBoxParameterEditor("data_port", 15, 87);
}

ZmqInterfaceEditor::~ZmqInterfaceEditor()
Expand Down
10 changes: 10 additions & 0 deletions Source/ZmqInterfaceEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,23 @@ struct ZmqApplication;
class ZmqInterfaceEditor: public GenericEditor
{
public:

/** Constructor */
ZmqInterfaceEditor(GenericProcessor *parentNode);

/** Destructor */
virtual ~ZmqInterfaceEditor();

/** Refresh list of connected apps */
void refreshListAsync();

/** Updates list of connected apps */
void startAcquisition() override;

/** Updates list of connected apps */
void stopAcquisition() override;

/** Sets pointer to mask channels underlying parameter */
void updateMaskChannelsParameter(Parameter* param);

private:
Expand Down

0 comments on commit 7157224

Please sign in to comment.