Embedding time-series plot of mne-qt-browser into our own GUI?

:question: If you have a question or issue with MNE-Python, please include the following info:

  • MNE version: 1.1+
  • operating system: macOS 12 / Windows 10 / Ubuntu 18.04

:page_facing_up: Please also provide relevant code snippets – ideally a minimal working example (MWE).

Hi,

I am interested in embedding an ICA component time-series plot into our own GUI. We would like the robust characteristics of the current mne-qt-browser.

  1. Is it possible to use mne-qt-browser to plot an ICA time series?
  2. Is it possible to extract a Widget from mne-qt-browser that contains the ICA time-series dynamic plot that we can then stick into our own GUI?
  3. If it is possible, any idea how we would do this? :stuck_out_tongue:

Reference code WIP: [ENH] Draft GUI for labeling components by adam2392 · Pull Request #66 · mne-tools/mne-icalabel · GitHub

cc: @mscheltienne @Richard @marsipu @larsoner who might know some.

Have you read

?

I have not, but the first issue’s simple 3 liner looks promising!!

Thanks for linking :slight_smile:

Hey Adam,

do you mean ICA.plot_sources with ICA time series? That should be already implemented.

Extracting the Plot-Widget should be also possible too but maybe not straight-forward since it is embedded into the MNEQtBrowser with all its functions.

But this weekend in fact I wanted to work on separating the core data-plot from the other elements to facilitate independent usage.

Best wishes

Martin

1 Like

@adam2392 is this maybe something we should even have in the Qt browser proper?

Hi @marsipu

Yes all I would like to do is add a single ICA time series at a time. Say there are 15 components, then I would like to show only 1 at a time.

Is the following 3 lines you mention here sufficient for that?

I guess there’s no easy way to render a single time-trace dynamically from a set of traces, so I would possibly need to “reconstruct” an ICA object in the background to plot again each time.

Sorry what do you mean here? What’s QTBrowser “proper”?

Is the following 3 lines you mention here sufficient for that?

To add MNEQtBrowser to another Application this should suffice. Though there will still be all other UI-elements (toolbar, scrollbars) visible. Just the plot would be self.mne.view (instance of BrowserView). But I don’t think you can create it without MNEQtBrowser at the moment.

I guess there’s no easy way to render a single time-trace dynamically from a set of traces, so I would possibly need to “reconstruct” an ICA object in the background to plot again each time.

Yes, that would probably the easiest way, while a more hackier solution involving modifying all relevant parameters and adding traces dynamically should be possible too but also more work.
Maybe if we refactor the plot BrowserView out of MNEQtBrowser we could also expose some developer API for adding traces, modifying number of shown channels, etc. … .
Since I am working on a similar project, I might suggest a PR about that in the next days.