User Tools

Site Tools


This is an old revision of the document!

Creating images of brain views


One of the reasons why you may want to use NeuroElf is for visualization. And while the online browsing capability is certainly helpful in identifying good visualizations, it can then be very tedious to create an entire series of them (e.g. for different subjects, etc.) by using the GUI directly. Hence I tried to make most of the steps you can perform via the mouse or keyboard scriptable.


Importantly, once the GUI is loaded, pretty much all functions are available by performing a call of the form:

neuroelf_gui('sub_function', 'argument1', [2, 3, 4], {'a', 'b'});

And as a more practical example, let's introduce the screenshot function:

neuroelf_gui('help', 'screenshot')

which returns the help text associated with this function:

ne_screenshot  - create a screenshot file

FORMAT:       ne_screenshot(SRC, EVT, [, object [, filename [, hq]]])

Input fields:

      SRC, EVT    Matlab handle callback inputs (discarded)
      object      can be empty, 0 (main fig), or figure/axes handle
      filename    optional filename (otherwise requested)
      hq          high-quality flag (set to 'high-q' for oversampling)

No output fields.


   neuroelf_gui('screenshot', 'BS123456', 'screenshot_1234.png', 'high-q');

   creates the file 'screenshot_1234.png' with high-quality oversampling
   from satellite window with ID 'BS123456'


Importantly, an “undocked” window is assigned an 8-character long token, which can then be used to address this window from the command line. To script an entire (and useful) function, I would assume the following steps must be performed (with some of them being optional):

  • the files that are to be visualized need to be loaded (or, even better, checked to see if they are loaded already)
  • the files must be “selected” (made the current objects) for NeuroElf's GUI functions to work properly
  • a “scene” must be configured (e.g. which stats maps at what threshold, colors, etc.)
  • at this point, the initial “view” must be set (e.g. for surfaces or rendering views the two angles, zoom factor, etc.)
  • the view is then undocked
  • a screenshot is produced
  • if a movie is to be made, the view can be altered in a loop with taking multiple screenshots

Loading files

I'll write up another page about this, but briefly put, to see if a file is loaded, the easiest way I can think of would be a try/catch construction:

% store filename in a variable,
% which can be constructed from arguments to a function!
objectfilename = '/Users/Jochen/Documents/interesting_stats.vmp';
objectfiletype = 'vmp';
% access to the loaded objects via the xff constructor
x = xff;
% then attempt to access this file
    object = x.Document(objectfilename);
        object = xff(objectfilename);
        if ~isxff(object, objectfiletype)
        error('script:error', 'File %s not readable.', objectfilename);

And once the object is available, it can easily be added to the GUI (and made the current object) using

jochen/screenshots.1464363643.txt.gz · Last modified: 2016/05/27 17:40 by jochen