Chapter 1. BrainVISA/Anatomist libraries API documentation

The Cartograph project

The BrainVISA project (we tried different names for it, "Soma", "Cartograph" but after all BrainVISA is OK to represent the whole environment) includes several C/C++ and Python libraries and commandlines sets, and the two main programs: BrainVISA and Anatomist. You can see it as the whole bundle BrainVisa/Anatomist plus all the programs released in the binary packages. Some of the algorithms are not open source (yet?) but the core libraries and programs are released under the CeCILL-B or CeCILL v2 public licenses. All components needed for the "environment" part (core libraries, data structures, IO systems, GUI parts including all Anatomist and BrainVISA) are open source. The different public libraries and projects are listed here, and their API is more or less documented using Doxygen and Epydoc automatic documentation software. The aimsalgo project has now been open-sourced since version 3.1. Moreover the core libraries which could use a completely free license, that is to say do not depend on GPL code (such as PyQt) have actually moved to CeCILL-B, which is similar to BSD: aims-free (aimsdata, aimsalgo and lower-level libraries, anatomist, soma, build-config and the development tools).

List of projects

project:language:license:description:
aimsalgoC++CeCILL-B Image processing algorithms layer based on aimsdata, now open-source since version 3.1.
aimsdataC++CeCILL-B Data types, IO system, miscelaneous manipulation and basic algorithms on: 4D volumes, meshes, textures, "buckets" (voxels lists), graphs, ...
anatomistC++CeCILL-B Visualization: display layers on Aims objects, 3D rendering, GUI, ...
brainvisaPythonCeCILL v2Processing and pipelining infrastructure, GUI, database
brainrat-gplPythonCeCILL v2 Toolbox BrainVISA dedicated to ex-vivo 3D reconstruction and analysis.
cartobaseC++CeCILL-B Base utility classes and functions: files/streams, smart pointers, exceptions, type identifiers, threads, character strings manipulation, generic object, beginning of new IO system, ...
cartodataC++CeCILL-B Future base types and "clean" API that will replace those from AimsData: for instance 3D/4D volumes will move from AimsData to carto::Volume. CartoBase and CartoData will be the core of all new development.
datamindPython/R?stats, data mining. Datamind GUI will still not be released in our distributions in 3.1 packages because it lacks documentation and we don't want to be submerged by questions. But as datamind libraries are now used in other projects, the libraries will be distributed.
ecatC  Ecat format IO library, taken from the University of Louvain with a few fixes added.
ecat+CCeCILL-BSHFJ layer on top of ecat
graphC++CeCILL-BGraphs and trees
fmriC/PythonCeCILL v2Functional processing toolbox: nipy.neurospin (fMRI) and HRF port to brainvisa
pyaimsC++/PythonCeCILL-BAIMS API bindings for Python
pyaimsalgoC++/PythonCeCILL-BPython bindings for AIMS algorithms (still beginning)
pyanatomistC++/PythonCeCILL v2Anatomist API bindings for Python
shared CeCILL-B Shared data that are needed by several projects
somaPythonCeCILL-B Miscelaneous base libraries in python. This project will probably merge with cartobase and its python bindings (part of pyaims) to represent all the low-level or miscelaneous utility libraries in either C++ or python.
build-configsh and Python scriptsCeCILL-BCompilation tools
vidaIOCCeCILL-BVida format IO library

Dependencies

The following dependecy graph shows which project library is used by other ones (and so shouled be compiled before). The base, lowest-level, of our libraries is CartoBase, and cartobase itself now relies on two external "standard" freeware libraries: libsigc++ and libxml2. Several other external libraries are used by various packages of our software, mainly for GUI and 3D rendering, and also for some IO formats plugins.

In version 3.2, the projects sources have been reorganized in bigger groups, and separated by license, so you should not deal any longer with low-level projects (cartobase, cartodata, graph, ecat/vidaIO, etc). The larger projects are named aims-free, aims-gpl, anatomist-free, anatomist-gpl, soma, axon (formerly the brainvisa program), brainvisa-share. The aims project tree includes both aims-free and aims-gpl, and similarly, anatomist includes anatomist-free and anatomist-gpl. See the sources repository page for details.

sigc++ libxml2 [boost]                           netcdf
    |    |    /                                    |
    |    |   / [blitz++]                           |
    |    |  / /                                    |
   cartobase / shared [vidaIO]  [ecat]  [DCMTK]  [minc]  OpenGL
    |     |  |    |       |       |        |       |       |
  graph cartodata |       |     [ecat+]    |       |       Qt      Python
     \____|_______|_______|________|_______|_______|______/ \______/    |
                              |                                |        |
                            aimsdata ________________         SIP   GSL |
                          /       \                  \      /  |     | /
    ______________aimsalgo   Qwt   anatomist____      pyaims  PyQt  fff
   |    neuron     /   |  \____|___|            \      |    /  |     |
   |         \    /   vip          |             pyanatomist   |  neurospy
   |         sigraph               |                           |
   |   nmr          \              |                           |
   |\____________   [anatomist modules]                        |
   |           | \                   \_________________________|
 bioprocessing | nuclearprocessing                |
              / \                            brainvisa
  connectomist   cortical_surface
Python layers:
soma      aimsdata ___           datamind
    \     |     |     \             :
     \    | anatomist   aimsalgo    :
      \   |     |        |    |     :
      pyaims    |        |  sigraph :
         |   \  |        |    |     :
         | pyanatomist   |    |     :
         |_______________|    |     :
         |               |    |     :
         |         pyaimsalgo |     :
         |____________________|     :
                              |     :
                             pysigraph
[library] are optional parts.
pink components are external freeware software.
grayed components are "private" (closed-source) projects.

As you see there is a number of different projects with quite complex dependencies... Don't panic, the build system manages all this for you.

External libraries

  • libsigc++: signal/slot library and callbacks system
    http://libsigc.sourceforge.net.
    libsigc++ 2.x is needed: 1.x will not work, and 2.0.6 or newer is recommended.
  • libxml2: XML parser library, part of most Unix systems
    http://xmlsoft.org
    A quite recent version of libxml2 is needed
  • OpenGL: 3D graphics - should be part of your system
    http://www.opengl.org
    OpenGL 1.1 or newer will work, but some features of OpenGL 1.2 and 1.3 may be used if available.
  • DCMTK (DICOM Toolkit):
    http://dicom.offis.de/dcmtk.php
    We are using DcmTk 3.5.x.
  • Ecat:
    Ecat format IO library is provided as sources on our ftp site, it is a reorganized version of tools from the University of Louvain (Belgium): http://www.topo.ucl.ac.be/ecat_Clib.html on top of which we made an interface layer to our C++ structures: the ecat+ library. As we made a couple of bugfixes to the original ecat code, changed the include locations and the makefiles system, we suggest to take the sources from our ftp site.
    However this version of Ecat does not compile on Windows. For Windows, please use the official new version of Ecat library which now supports Windows and MinGW.
  • Minc:
    http://www.bic.mni.mcgill.ca/software
    Minc is both a volume image file format, and an image processing library. They are developped in the Montreal Neurological Institute (MNI), McGill University in Montreal. The Minc library needs the netcdf library.
  • NetCDF: Network Common Data Form
    http://www.unidata.ucar.edu/software/netcdf
    machine-independent format for representing array data
  • Qt (user interface):
    http://www.trolltech.com
    Qt 3.x is recommended.
    Qt 2.x is not supported anymore.
    Anatomist may be OK with Qt 2.3.
    Qt 4 is not supported yet in BrainVISA, but Anatomist 3.1 (including python bindings) can now build and run using Qt 4. Porting BrainVISA will still take a little bit of time.
  • Python (script programming, object oriented language):
    http://www.python.org
    See below for versions indications.
  • SIP and PyQt (link between C++/Qt and python):
    http://www.riverbankcomputing.co.uk
    SIP 4.7+ is strongly recommended. 4.5 will allow to compile PyAims and PyAnatomist bindings right now but has bugs which will cause some functions to crash.
  • GSL: Gnu Scientific Library
    http://www.gnu.org/software/gsl
    Numeric, matrix and math library
  • Boost C++
    http://boost.org
    C++ general libraries
    Warning: boost is an optional dependency of cartobase: cartobase will compile and run without it, but some features will be disabled, especially the thread safety in smart pointers, so we very strongly encourage the use boost in cartobase.
  • Blitz++
    http://www.oonumerics.org/blitz
    Object oriented scientific computing library
    Warning: blitz++ is an optional dependency of cartodata: cartodata will compile and run without it, but some features will be disabled, namely the array accessors optimized implementation in Volume classes (expect a factor 5 in performances in this part) and the possibility to support strides, so we strongly encourage the use blitz++ in cartodata.

Compilation instructions

Remarks and prerequisites

Compilers

Some of our C++ libraries fully use the C++ language, including complex templates, but most C++ compilers are buggy. We experienced bugs on every compiler we tried. Up to now only GNU gcc/g++ compilers could build all sources (with appropriate workarounds from place to place in our sources) without crashing or giving inappropriate errors.

We used to provide here a list of compilers which are known not to work, but as we have not recently tried any other compiler than gcc, we have removed this outdated list.

We have tested and successfully compiled the version 3.1 and 3.2 of our software using various gcc 3.x and 4.x versions:

  • gcc 3.2, 3.3, 3.4, 4.0, 4.1, 4.2, 4.3 and 4.4 should work to compile sources of BrainVISA 3.1 and 3.2.
  • We have not tested compiling sources using older compilers (gcc 3.1 and earlier).
Other versions might work but have not been tested.

Supported platforms

  • Linux. It is our main development system, so everything should compile and run fine on most Linux distributions
  • MacOS 10.5.
    MacOS 10.4.
    MacOS 10.3 used to be OK but after a system update, Qt could not compile anymore on my laptop. This was several years ago, and my laptop is dead now, so 10.3 will not be supported anymore.
  • Windows XP. We have ported all programs to Windows using the MinGW environment and gcc 3.2 compiler, and the MSys shell (bash unix-like shell). Using cygwin may work too.
    However, either using MinGW or Cygwin, we had to downgrade gcc to 3.2 because the later releases of gcc/windows introduced some linker problems with advanced C++ templates (MinGW/gcc guys say it is not a bug but rather a "known side effect"). We have not tried gcc 4.x yet.
  • Sun/Solaris is not supported any longer. We have not tried compiling on Solaris for ages.
  • SGI/Irix is not supported any longer. We have not tried compiling on Irix for ages.
  • Other Unix systems have never been tested.

Python language

  • BrainVISA is written in Python language and needs python 2.4 at least. Our binary distributions are shipped with a copy of python 2.5 or 2.6 (depending on the systems) which also includes several add-on modules. Python 2.6 currently works even if it produces some "deprecation warnings" here and there.
  • Our configuration tools, build-config, configure and maker, are needed to write the Makefiles. They are also written in Python language.

Compiling

As we could not manage with the standard building tools ("./configure; make; make install"), as we usually do, we have made our own building tools... They consist in three python programs: build-config, configure and maker.

build-config is the only tool that you need to know about to be able to compile: the two other tools are called by build-config, they must reside within the PATH directories search list but you don't call them directly.

The use of the compilation tools is documented in a dedicated chapter of this documentation. Try the quick start instructions first if you like.

CMake will be supported soon. We are currenlty in the process of migrating to CMake. When we are done, then our build-config will be dropped.