Chapter 5. PyAnatomist

API to access Anatomist with python scripts.

Includes Anatomist C++ API bindings.

API

Libraries

  • libpyanatomist

Main features

  • See the epydoc documentation
  • Enables two means of communication with Anatomist application : exchanging messages on socket or using C++ API bindings
  • Allows access to Anatomist API and manipulation of Anatomist objects and state from python scripts and shells
  • Allows to write Anatomist plugins in python

Required environment variables

  • BRAINVISA_SHARE
  • PYTHONPATH

Tutorial and examples

See the programming part of Anatomist tutorial.

To execute these examples, use "ipython -qthread <example>.py". (They need that a QT event loop is running)

See the examples in the following order:

More advanced examples:
  • sphere.py: subclassing Anatomist objects
  • control.py: plugging new conrols / actions in Anatomist views
  • addMenuEntry.py: customizing object-specific menus
  • fusion.py: registering new fusion types
  • anaevensimplerviewer.py, which is as its name says, an even simplified of the anasimpleviewer application, which may also be used as a programming example. Its code is in the "bin/"" directory of the binary packages
Using anatomist API in Brainvisa processes: