Talk pyMetris : a flexible endoscope tracker

Presented by Vincent Agnus in Scientific track 2010 on 2010/07/11 from 10:00 to 10:15 in room Dussane
Abstract

The purpose of this paper is to describe a medical software "pyMetris" that we have developed and show how the python framework has greatly helped for its creation.

Modern surgery becomes less and less invasive and new procedures arise, for example Natural Orifice Transluminal Endoscopic Surgery (NOTES). This surgical technique consists in inserting a tool trough natural orifices (mouth, anus, urethra...) then an internal incision is performed (stomach, vagina , colon... ). The benefit for the patient is to avoid external visible scars and a favour fast internal healing. However for surgeons the medical gestures are more difficult to carry out than in standard surgery, because surgeons are not able to see their medical tools directly. Moreover for NOTES the reference tool is a flexible endoscope. Thanks to a camera on the tip of the endoscope, surgeons can see internal organs of a patient, but they do not know the shape of the endoscope. When the endoscope is inside organs (stomach, colon), surgeons are completely "confused" because they cannot find any anatomical reference.

For this purpose we have proposed a Software pyMetris to help surgeons navigate inside the patient body like a 3D GPS: the endoscope is positioned according to patient organs. The software displays in real-time a 3D virtual representation of the segmented organs of the patient (segmentation is performed by [1]) and the shape representation of a flexible endoscope. The tracking of the endoscope is ensured by the Magnetic NDI Aurora System [2] with coils inserted in the operating shaft of the endoscope. The coils can retrieve their 3D position according to the Magnetic Field Generator. We use 6 coils spaced every 5cm along a cable and use a spline interpolation to reconstruct the shape of the endoscope. The communication between the computer and the NDI Tracker is performed via RS232 serial port.

This system has been tested on 4 live-pigs for several validations : Benefit of navigation for the surgeon, loop avoidance during coloscopy, best gastrotomy position for cholysectomy with NOTES surgery.

Python properties have been very useful for us. On the one hand the interpretative execution of code allowed us to easily, at runtime, change or extend the behavior and the layout of the application by using scripting. So we have been able to propose different implementations to surgeons. We have the opportunity to stop the interpreter, recode their feedbacks during meetings, then continue. This has been a great advantage due to the little and random availability of surgeons. On the other hand, thanks to the "All batteries included" with Python we have used several python packages mostly out-of the box (without any recompilation on Ubuntu) :

  • for the layout we have used wxPython for the graphical user interface, VTK to render 3D Scene and matplotlib to display a posteriori statistical position on the endoscope
  • for mathematics: numpy and sciPy ,VTK were used to solve some problems like plane and spline regression, matrix manipulations, and statistic tests about endoscope position
  • for input/output, we have used the serial python package to communicate with the NDI aurora System and cPickle to serialize the sequence of endoscope shape position.

Python bindings of C++ library as wxWidgets and VTK are quite similar so their use was direct.

To conclude python specificities, like interpreted code and provided scientific packages have significantly accelerated the design/development/test/deployment cycle compared to using a c++ approach.

[1]Fasquel et al. A Modular and Evolutive Component Oriented Software Architecture for Patient Modeling. Computer Methods and Programs in Biomedecine 2006.
[2]NDI Aurora : http://www.ndigital.com/medical/aurora.php