Skip to content

Software

The SPECULAR project contributes to open-source software for medical simulation. All developed code is freely available for research and educational use.


SOFA Framework

SPECULAR is built on top of SOFA (Simulation Open Framework Architecture), an open-source framework for real-time simulation.

  • SOFA Main Repository

C++ framework for multi-physics simulation

GitHub

  • Documentation

User guides, API reference, and tutorials

sofa-framework.org

  • Download

Pre-compiled binaries and source code

Downloads


SPECULAR Plugins

ModelOrderReduction Plugin

Enhanced with hybrid simulation capabilities developed in SPECULAR.

Features: - Proper Generalized Decomposition (PGD) - Empirical Cubature Hyper-Reduction (ECSW) - Hybrid reduced/full model coupling - Real-time performance

Download Documentation

SoftRobots Plugin

Extended with needle-specific constraints and haptic coupling.

Features: - Constraint-based contact mechanics - Haptic device integration - Force feedback rendering - Actuator models

Download Documentation

SPECULAR Scenes

Sample simulation scenarios for needle insertion training.

Contents: - Liver phantom models - Needle instrument definitions - Training scenarios - Validation benchmarks

Download ZIP


Getting Started

Installation

Prerequisites

  • OS: Windows 10/11, Linux (Ubuntu 20.04+), macOS 10.15+
  • Compiler: Visual Studio 2019+, GCC 9+, Clang 10+
  • CMake 3.16+
  • Python 3.7+

Quick Install

# Clone SOFA
git clone https://github.com/sofa-framework/sofa.git
cd sofa

# Configure and build
mkdir build && cd build
cmake ..
make -j$(nproc)

With Plugins

# Clone plugins
git clone https://github.com/sofa-framework/ModelOrderReduction.git
git clone https://github.com/sofa-framework/SoftRobots.git

# Configure with plugins
cmake -DPLUGIN_MODELORDERREDUCTION=ON \
      -DPLUGIN_SOFTROBOTS=ON \
      ..

Running SPECULAR Scenes

# Launch SOFA with SPECULAR scene
cd build/bin
./runSofa /path/to/specular/needle_insertion.pyscn

Tutorials

Tutorial 1: Basic Needle Insertion

Learn to set up a simple needle insertion simulation.

Watch Video Download Files

Tutorial 2: Haptic Integration

Connect a haptic device to your simulation.

Watch Video Download Files

Tutorial 3: Custom Scenarios

Create your own training scenarios.

Watch Video Download Files


API Reference

Python Bindings

SOFA provides Python bindings for rapid prototyping:

import Sofa

# Create scene
def createScene(root):
    root.gravity = [0, -9.81, 0]
    root.dt = 0.01

    # Add liver model
    liver = root.addChild('liver')
    liver.addObject('MechanicalObject',
                     template='Vec3d',
                     position='@meshLoader.position')
    liver.addObject('TetrahedronFEMForceField',
                    youngModulus=5000,
                    poissonRatio=0.45)

    return root

C++ API

For performance-critical components, use the C++ API:

#include <sofa/core/ObjectFactory.h>
#include <SofaBaseMechanics/MechanicalObject.h>

// Create mechanical object
MechanicalObject3::SPtr mechObj =
    sofa::core::objectmodel::New<MechanicalObject3>();

Validation

Benchmarks

Performance benchmarks are provided for validation:

Test Case Mesh Size Real-time Factor
Liver deformation 5K tetrahedra 50x
Needle insertion 10K tetrahedra 10x
Haptic coupling 10K tetrahedra 1kHz stable

Unit Tests

# Run SPECULAR tests
cd build/bin
./SofaTest --gtest_filter=SPECULAR*

Contributing

We welcome contributions! Please see:

Reporting Bugs

For SPECULAR-specific issues:

  1. Check existing issues
  2. Create new issue with label SPECULAR
  3. Include minimal reproducible example

Citation

If you use SPECULAR software in your research:

@software{specular2021,
  title={SPECULAR: Simulation of Percutaneous Procedures},
  author={SPECULAR Consortium},
  year={2021},
  url={https://specular-project.github.io}
}

@software{sofa2021,
  title={SOFA: Simulation Open Framework Architecture},
  author={Faure, Fran{\c{c}}ois and others},
  year={2021},
  url={https://www.sofa-framework.org}
}

Support

Community

SPECULAR-Specific Support

For questions specific to SPECULAR:


License

SOFA and SPECULAR plugins are released under the LGPL v2.1 license.

Copyright (C) 2021-2025 SPECULAR Consortium

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation.