Developer at Google Summer of Code ’18 with Inria Foundation (SOFA and Pulse)

Manan Jain
Aug 14, 2018 · 5 min read

I submitted my proposal for the coupling of two open-source projects SOFA and Pulse Physiology, where the aim was to develop a SOFA plugin interfaced with the Pulse API. After getting selected, I was very excited to work with my mentors Hugo Talbot & Guillaume Paran (from SOFA) and Jeff Webb & Aaron Bray (from Pulse Physiology) this summer.


Project Description

What the project was?

SOFA is a physics-based simulation platform. Pulse Physiology Engine is an engine which provides accurate and consistent human physiological data. The project, therefore, was to combine these two powerful open source projects and develop a suitable interface to exploit their potential.

Why this project?

The main motivating factor was the impact this application would have on the medicinal world. With this envision, it would be highly beneficial for researchers and medical students to have such a highly realistic modeling software of the human body. A well-implemented plugin would have widespread use cases and practical application.


Proposal

The proposal which I submitted contained my understanding of the project and how I would proceed with this coupling process. I went through the discussions at the SOFA forum regarding creation and handling of plugins. Also I referred to the documentation provided by Pulse physiology engine.

Converting all these observations and experience, I made a proposal focusing on —

  1. Integrating the Pulse API library into the SOFA code base which was to be done using the concept of Superbuilds (which Pulse uses)
  2. Generating simulated data through recursion and rendering it to the GUI

This was based using the variables declared in the Common Data Model of Pulse engine and calling them using the functions defined

3. Parsing the simulated data at every time step to SOFA for physical modeling of the target organ/physiological part


Procedure

Initial discourse and laying out the objectives

Both SOFA framework and the Pulse API are based on C++ and are in a way very close to each other (use CMake and have a core library with optional plugins).

So, my mentors discussed and recommended that this plugin be built inside the SOFA library, alongside other pre-existing plugins. This would allow me to use the SOFA-GUI (based on QGL Viewer and OpenGL) to model according to the data received from Pulse

First objectives and issues

In order to carry out this task, I went through the SOFA documentation regarding plugin integration and how it interacts with their endpoints. The most relevant ones being LeapMotion and CImgPlugin which had already been built inside SOFA.

Pulse API, on the other hand, interacted with other librariers/applications using Superbuilds. It required 2-step building of libraries inside the target application. Since I wasn’t aware of how Superbuilds exactly worked, I got quite confused while trying out various ways to make it work.

I referred to various discussions on the SOFA forum to find a solution. Also, I started looking into other projects (such as Pulse Explorer) where the Pulse Engine had been integrated.

After a few failed attempts and a couple of discussions, it was decided that we build Pulse outside SOFA library and include both of them.

Building the plugin and further discourse

With the assistance of my mentor, a plugin was ready where both the libraries had been included. The next objective was to use the variables and functions of Pulse and call them according to various physiological conditions.

My next objective was defined as to parse simple Pulse variables to SOFA and to render them using runSofa (Sofa GUI). This was to be done by including the target library (.so files). This would be a first step towards a coupled output.

I thought it best to directly work on getting the simulated data (varying with the defined time-step) and not just defined variables.

While working on this, I studied and tried to understand the working of the Pulse Explorer where the Pulse API was already being used. Upon building similar conditions in the plugin, the simulation didn’t simply work out. Eventually, with Aaron’s help I found out that the built plugin lacked certain libraries. Upon their inclusion the building of the plugin was complete.

Generating results from the built plugin

The next task was to create an engine for Pulse to —

Get feed data > Run simulation for a time step > Pass the values to SOFA

Taking reference from what had been done in PulseExplorer and the documentation provided by the Pulse Engine, I created an engine inside the plugin. The feed data (build/states) can either be chosen from the available ones or new states can be created.

The simulation of the data primarily depends on the condition in which a human/animal is. Seeking further reference from Pulse, I created conditions inside the plugin which could be simulated.

The simulated data, as of now, is being written to log files.


Targets to be achieved

  1. More conditions are to be added over which simulation will occur. Most of these conditions have to be specific to the organs which is being modeled by SOFA.
  2. The GUI aspect of the project is still to be worked on. This part basically entails synchronizing the time step of both the libraries and rendering the physical model along with the parameters received.

3. Proper commenting of code and modularizing of the functions added.


Link to the work done

  1. Submitted proposal
  2. Github repository of the project

As work on this project is still going on, the final software will take some time to be released. However, you can clone the repository and set it up to check out some interesting simulations functional now.

I would like to thank the Sofa community and Pulse community specially my mentors who were very supportive of my work and were constantly involved in helping me solve whatever problem I was facing.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade