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

WIP [ENH,MAINT] MNE Scan - Plugin/Scene/GUI separation #887

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

gabrielbmotta
Copy link
Collaborator

A quick overview of the current state of plugins before we talk about this PR.

What is a Plugin in MNE-CPP?

A plugin is a library that is loaded at runtime that follows a set API. Plugins inherit from an abstract base class defined in the application library. Plugins can be recompiled separatley from the main aplication and, as long as the main application and the plugin are using the same abstract base-class api, there should be no issues.

Plugins are currently all loaded in at once soon after the main application starts execution. Plugins are loaded in based only on their .dll/.a/.o files.

What is a plugin in MNE Scan?

In MNE Scan, a plugin is a subclass of either AbstactSensor or AbstractAlgorithm, both of which are subclasses of AbstractPlugin. AbstractPlugin is a subclass of QThread, making it so that plugins are threads.

Plugins have inputs and outputs that can asynchronously send and receive data.Plugins are added to the "scene" and can be connected to each other based on matching inputs and ouputs.

AbstractSenor-derived plugins are limited to one intance per "scene", and typically only have ouputs. AbstractAlgorithm plugins have no limit in their number of instances, and typically have either both an input and an output, or just an input.

Plugins are very closely linked to their GUI elements, and their APIs are responsible for providing the main application with a lot of gui elements and information. Currently the only gui elements that are abstracted away from the plugins are the plugin startup widgets (which are typically implemented as a separate class but still returned by the plugin), and the data viewers (which get instantiated by the main application based on the type of data being outputed).

Plugins currently only do work by being a link in the overall plugin pipeline, and only affect other plugins by either recieving/passing blocks of data, or by modifying some shared value in that same data.


With all that being said:

This PR aims to decouple the GUI, plugins, and the plugin scene, such that it can allow us to build plugins that provide functionality outside just the "scene" pipeine context. The API and organization is by no means final and I'd really appreciate input.

  • New class PluginGUI to take over the functionality of GUI management from AbstractPlugin.
  • New options in Abtract plugin of whether a plugin has a gui and whether a plugin should be addable to the plugin scene. Currently is true for all existing types plugins.
  • So far only FiffSimulator and WriteToFile are "converted".

@codecov
Copy link

codecov bot commented Feb 2, 2022

Codecov Report

Merging #887 (d26ec52) into main (bd31738) will increase coverage by 6.79%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
+ Coverage   30.20%   36.99%   +6.79%     
==========================================
  Files         452      196     -256     
  Lines       39208    11553   -27655     
==========================================
- Hits        11841     4274    -7567     
+ Misses      27367     7279   -20088     
Impacted Files Coverage Δ
libraries/fiff/fiff_types.h 0.00% <0.00%> (-100.00%) ⬇️
libraries/fiff/fiff_info_base.h 0.00% <0.00%> (-100.00%) ⬇️
libraries/mne/mne_sourcespace.h 0.00% <0.00%> (-100.00%) ⬇️
libraries/connectivity/network/network.h 0.00% <0.00%> (-100.00%) ⬇️
libraries/rtprocessing/helpers/filterkernel.h 0.00% <0.00%> (-100.00%) ⬇️
libraries/inverse/hpiFit/hpifit.h 0.00% <0.00%> (-60.00%) ⬇️
libraries/fiff/fiff_stream.h 0.00% <0.00%> (-50.00%) ⬇️
libraries/connectivity/connectivitysettings.h 50.00% <0.00%> (-50.00%) ⬇️
libraries/fiff/fiff_info.h 0.00% <0.00%> (-25.00%) ⬇️
libraries/utils/mnemath.h 0.00% <0.00%> (-16.00%) ⬇️
... and 272 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant