TMS Motor Mapping Visualization - GSoC 24 @Invesalius

August 22, 2024

This project introduces a new Motor Mapping Visualization feature to Invesalius, offering enhanced capabilities for visualizing and interacting with Motor Evoked Potential (MEP) data

Features:

  1. Heatmap visualization on brain surface based on Motor evoked potentials
  2. Interactive MEP value adjustment and session persistence
  3. 4 Customizable colormap ranges
  4. Brain surface selection
  5. Modifiable gaussian parameters for surface and points interpolation
  6. 10 Different colormaps to choose from

Quick Runthrough

The following animation demonstrates the interactive workflow, allowing for real-time exploration of MEP data and visualization customization.

Demo GIF
Animation
Showing the visualization in action

Detailed Feature Screenshots

Motor Mapping Color Map Presets
motor map colormap presets
How the brain visualization looks like using the HotMetal theme Many heatmap themes to choose from


MEP Values and Toggle Button Preferences
mep values and toggle button preferences
MEP Values are now being saved and displayed New section in preferences to manage the visualization parameters

Challenges and Takeaways

  • I have invested a good amount of time during the project start for developing understanding on the architecture of the VTK pipeline and the overall visualization logic in Invesalius. Most of that was done on my own, with a little push from my mentors to fill in the knowledge gaps I had. This really gave me a taste of open source and the need to be self reliant first and foremost before using any of the contributors' time.
  • Before GSoC, I had basic knowledge on developing medical visualization software and the complexity it can reach. Through this project, I was able to use VTK and python effectively to build complex and modular logic for brain visualization.
  • Being someone who uses python for everything, I love creating new programs/tools using Python. This project helped me learn a lot about working with pub-sub or event driven architecture in python and also taught me how to work with wxPython GUI framework which is used in many old python applications.
  • My code quality has also improved, thanks to detailed reviews from mentors over the course of this project.

Acknowledgements

I’d like to thank all my mentors for helping me throughout this project. A special shoutout to Renan Matusda and Victor Souza, for their comprehensive code reviews and guidance. It was an honor working with them.

Contributing to Invesalius has been amazing, and I am looking forward to contributing more in the future! I am glad to have worked with such amazing people. I am extremely thankful to Google Summer of Code for providing me with this opportunity to improve my programming skills and learn a lot about open-source development along the way.

Pull Requests

https://github.com/invesalius/invesalius3/pull/825

Future Work

  • In future iterations, I plan to add a sliding gradient editor for more intuitive color customization and enhance the colorbar for improved range interpretation.
  • The brain projection is not directly projected to the surface and is dependent on the height from the scalp as the point is generated at the coil’s center position and not directly on the brain surface, increasing the visualization radius from preferences helps. But it is not ideal.
  • Marker file import and export functionality in addition to the ability to export a colored mesh object to be done.

Project link: https://github.com/invesalius/invesalius3