$wgGroupPermissions['user']['read'] = true; $wgGroupPermissions['*']['read'] = true; Sofa - Forge Wiki


From Forge Wiki

Jump to: navigation, search

If you directly want to use SOFA and compare simulation results within CamiTK you will first need to install SOFA on your computer and follow the following steps to include the SOFA support in the modeling extension.



Install SOFA

CamiTK 3.4.0 is supporting the Sofa version that was available at the time (git master branch of end of November).

Since April 2015, CamiTK is trying to support the current stable release of Sofa.

Please follow the instructions from the SOFA framework official page to download and build the git stable branch of SOFA. As of April 2015, the stable release is tagged v15.03.

It is your responsibility to correctly build the SOFA framework from source. Do not hesitate to contact the SOFA team or the SOFA user mailing-list in case of problem.

For instance to get the stable release tagged v15.03, you may:

git clone git://scm.gforge.inria.fr/sofa/sofa.git
git checkout v15.03

Then use the instruction from the Sofa website to build Sofa stable.

Configure CamiTK with SOFA

To configure the SOFA support in CamiTK, you will only need to include the modeling project (also called modeling CamiTK Extension Project, or CEP) and gives the path to the SOFA build directory before the CMake configuration step. The SOFA build directory is the path to where you have built the binaries of the SOFA framework, not the path to the SOFA source directory.

More precisely, during the camek configuration step, you need to:

  • check CEP_MODELING
  • launch the configure step
  • select SOFA_BUILD_DIR and set its value to your SOFA build directory (again this is the path to where you have compiled the SOFA binaries, not the path to the source directory).
  • launch the configure step again
  • launch the configure step again
  • launch the generate step in order to generate your Makefile or Visual Studio project.

CamiTK is now configured to work with SOFA.

Using CamiTK with SOFA

First of all, CamiTK calls the SOFA framework to compute biomechanical simulations on physical models. At each step of the computation, CamiTK retrieves the displacements from SOFA and updates the geometry. This has no to little interest if you only want to watch the deformation. But it is very interesting if you want to compute some metrics on the simulation or compare different types of simulations. This is possible thanks to MML [1] and [2]. MML is used as a generic framework to compare biomechanical simulations of different simulators. MML is able to compute some metrics (e.g., the distance to another simulation or to a ground truth) and shows this in the viewer (e.g., using a color table, see figure). Thus, while CamiTK "simply" calls the SOFA framework for biomechanical computations, MML can do much more to help you find the right model for your application.

You may open directly SOFA scene (.scn) files within CamiTK, but we encourage you to develop MML files (.mml). MML files are XML files that simply encapsulate the SOFA scene. They include the physical model and biomechanical simulation parameters, as well as a way to define simple loads (null or imposed displacements for instance). Check it out!

Using your Sofa Plugins with CamiTK

When you develop a plugin with Sofa, you need to firstly add the plugin to the Sofa framework before using it through CamiTK. To register external plugins, Sofa uses a .ini file where path of the plugins are saved. To add your plugin, please follow the steps recommended by the Sofa team. For example, to add a plugin, launch a Sofa GUI application (Modeler, runSofa), go to Edit, then Plugin Manager and add the path to your plugin library. After theses steps, you will be able to use your plugin with CamiTK. If your plugin have different behaviors between CamiTK and Sofa, beware that CamiTK does not necessarily use all methods of your plugin (i.e, draw methods).

Example Sofa Scene

CamiTK MML component provides a example file (TruthCube-Sofa.mml in the test data directory). Once loaded you need to launch the Simulation Dialog action of the Modeling family. This will show a dialog with four tabs. One interesting tab is the Monitors tab where you can decide what type of measurement to display. For instance the REN monitor, if activated by clicking on the Display button of the same line, will display colors corresponding to the Relative Energy Norm of the simulation compared to the segmented truthcube phantom (note that only the inside beads can have a nice REN error, select the PML inner surface informative component to get something nice).

More about MML

Numerous models have been developed to describe the mechanical behaviour of soft tissue in virtual reality medical environments. Very high credibility must be established before clinicians trust these simulations for diagnostic or treatment. Validating models to obtain the right compromise between accuracy and computational efficiency for the targeted medical application is a long, costly and time-consuming task. MML is a freely available open-source framework for helping scientists in the difficult problem of evaluating and comparing biomechanical models in a more systematic and automatic manner.

MML is now fully integrated in the CamiTK Open Source project as a component. It allows direct interoperability and comparison between simulation software (SOFA, Ansys, and ArtiSynth are available).

This framework includes three XML languages and their companion C++ libraries: MML, PML and LML.


  1. https://hal.archives-ouvertes.fr/hal-00642269/en/
  2. http://www-timc.imag.fr/Emmanuel.Promayon/DERAM_MMVR_2012_SLIDES.pdf
Powered By FusionForge