Overview
Justina’s surgical simulation module provides a 3D interactive environment where surgeons can practice robotic surgical procedures. The platform uses Babylon.js for real-time 3D rendering and WebSocket for live telemetry streaming.Prerequisites
Before starting a simulation:Authentication
You must be logged in with a ROLE_SURGEON account. See the Authentication Guide for details.
Starting a Simulation
From the Dashboard
Select New Simulation Module
Click on the “Nueva Simulación” (New Simulation) card. This module features a Play icon and is colored blue.
Understanding the 3D Interface
Scene Components
The simulation environment includes:Surgical Instrument
A 3D scalpel model that follows your mouse cursor. Positioned in 3D space with real-time coordinate tracking.
Kidney Model
A 3D kidney with anatomical structures including arteries (highlighted in red) that must be avoided.
Tumor Fragments
25 distributed tumor fragments (pink spheres) that need to be removed during the procedure.
Camera Controls
An arc-rotate camera simulating a laparoscopic view. Use mouse to pan, rotate, and zoom.
Coordinate Display Panel
In the top-right corner, you’ll see a panel displaying:Performing a Simulation
Step-by-Step Procedure
Click 'INICIAR CIRUGÍA'
Click the green “INICIAR CIRUGÍA” button at the bottom center of the screen.This triggers:
- WebSocket connection establishment
- START event sent to backend
- Creation of new
SurgerySessionwith unique ID
Position the Instrument
Move your mouse to control the scalpel position. Use scroll wheel to adjust depth (Z-axis distance).
Activate the Instrument
Click and hold the left mouse button to activate the surgical instrument. While active, collision detection is enabled.
Remove Tumor Fragments
Touch the pink tumor spheres with the activated scalpel to remove them. Each removal triggers a
TUMOR_TOUCH event.Real-Time Telemetry Streaming
WebSocket Connection
When you start a simulation, the frontend establishes a WebSocket connection:Telemetry Data Format
Each movement and event is sent as JSON:Surgery Events
The platform tracks these surgical events:| Event | Description | Impact |
|---|---|---|
START | Surgery session begins | Initializes tracking |
MOVE | Instrument movement (implicit) | Recorded in trajectory |
TUMOR_TOUCH | Tumor fragment removed | Positive score |
HEMORRHAGE | Artery accidentally cut | Negative score |
FINISH | Surgery session ends | Triggers AI analysis |
Backend Processing
The backend receives telemetry via WebSocket handler:Camera Controls
The simulation uses an Arc Rotate Camera for intuitive 3D navigation:Rotate View
Left-click and drag to rotate around the surgical site
Pan View
Right-click and drag (or Ctrl+Left-click) to pan the camera
Zoom In/Out
Mouse wheel to zoom in and out (limited between 6 and 20 units)
Depth Control
Scroll while moving to adjust instrument depth along viewing axis
Simulation Performance Tips
For optimal performance:
- Close unnecessary browser tabs
- Use hardware acceleration in browser settings
- Ensure your GPU drivers are up to date
- Disable browser extensions that may interfere with WebGL
Troubleshooting
Scalpel Not Moving
- Verify the simulation has started (green button clicked)
- Check that your mouse is over the canvas
- Refresh the page and restart
WebSocket Connection Failed
- Confirm you’re logged in with valid credentials
- Check the browser console for token errors
- Verify backend WebSocket endpoint is accessible
- Ensure firewall allows WebSocket connections
Frame Rate Drops
- Reduce browser window size
- Close other applications using GPU
- Lower graphics quality (if available)
- Try a different browser
Next Steps
View Results
Learn how to view your simulation results and AI feedback
Dashboard
Return to dashboard to access other modules