Visualisation with matplotlib

Questions about BrainVisa usage and installation

Moderators: denghien, riviere

Post Reply
katz
Posts: 5
Joined: Wed Jun 16, 2010 10:52 am

Visualisation with matplotlib

Post by katz »

Hello,

I am trying to code a toolbox for brainvisa. I need to plot some results with matplotlib. The problem is that I can't integrate it in my interface, and I also can't plot my results from the main process. I maybe have to do it with PyQt, but I also didn't succeed to use it with brainvisa.

Thanks

Philippe Katz
Dominique Geffroy
Site Admin
Posts: 161
Joined: Thu Mar 01, 2007 4:22 pm
Location: IFR 49 - Neurospin, Gif-sur-Yvette, France
Contact:

Re: Visualisation with matplotlib

Post by Dominique Geffroy »

Hello,

Could you be more specific ? What exactly didn't work ? Maybe you could show a part of the code you wrote for your toolbox...

It could be useful to have a look at existing BrainVISA processes that redefine the graphical interface.
For example:
- Data Management -> Database Browser : the function overrideGUI is used to replace the default GUI of the process by another one.
- Tools -> Viewers -> Show scalar features : it keeps the default process GUI but execution function runs other GUI functions. maintThreadActions() must be used to run the GUI functions in the main thread (the thread where Qt event loop is running).

Dominique
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: Visualisation with matplotlib

Post by riviere »

Hi,
Integrating matplotlib figures in Qt interfaces is a bit tricky since matplotlib is an abstraction on different possible graphical toolkits: so we have to dig into one of the specific (Qt-based) backends of matplotlib to do it.
There are examples of it in some anatomist python plugins: Matthieu did the job first in his paletteViewer plugin, and there are maybe simpler examples now, for instance in the histogram plugin. Those python plugins are in share/anatomist-<version>/python-plugins/
Denis
katz
Posts: 5
Joined: Wed Jun 16, 2010 10:52 am

Re: Visualisation with matplotlib

Post by katz »

Hello,

Thanks for your answers. So mainThreadAction and overrideGUI where exactly the functions I was looking for, and the examples where helpfull.
I have found also some examples to integrate matplotlib figures in Qt on matplotlib website :
http://matplotlib.sourceforge.net/examp ... in_qt.html

So thank you for your help

Philippe Katz
Post Reply