Difference between revisions of "Documentation/Nightly/Extensions/DebuggingTools"

From Slicer Wiki
Jump to: navigation, search
m (moved Documentation/Nightly/Extensions/PyDevRemoteDebug to Documentation/Nightly/Extensions/DebuggingTools: Adding more debugging tools to PyDevRemoteDebug extension and so renaming the extension is due)
Line 4: Line 4:
 
<!-- ---------------------------- -->
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Introduction and Acknowledgements}}
 
{{documentation/{{documentation/version}}/module-section|Introduction and Acknowledgements}}
Author: Andras Lasso (PerkLab, Queen's University)<br>
+
Author: Andras Lasso (PerkLab, Queen's University), Mikael Brudfors (Laboratorio de Imagen Medica, Hospital Gregorio Maranon - http://image.hggm.es/)<br>
 
Contact: Andras Lasso, <email>lasso@queensu.ca</email><br>
 
Contact: Andras Lasso, <email>lasso@queensu.ca</email><br>
 
Project website: http://www.slicerrt.org<br>
 
Project website: http://www.slicerrt.org<br>
Line 17: Line 17:
 
<!-- ---------------------------- -->
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/extension-section|Extension Description}}
 
{{documentation/{{documentation/version}}/extension-section|Extension Description}}
{|
+
Collection of debugging tools:
[[Image:PyDevRemoteDebugExtension.png|left]]
+
* Python Debugger is an extension of 3D Slicer to allow debugging of Python scripts in the Eclipse integrated development environment using PyDev. Visual debugging (setting breakpoints, execute code step-by-step, view variables, stack, etc.) of Python scripted module is possible by using [http://pydev.org/ PyDev].
|
+
* Node modified statistics: Module for collecting statistics on timing of node Modified events. It is useful for estimating refresh rate when a live data stream or temporal data sequence is visualized.
Python Debugger is an extension of 3D Slicer to allow debugging of Python scripts in the Eclipse integrated development environment using PyDev.
 
 
 
Visual debugging (setting breakpoints, execute code step-by-step, view variables, stack, etc.) of Python scripted module is possible by using [http://pydev.org/ PyDev].
 
 
 
|
 
|}
 
  
 
<!-- ---------------------------- -->
 
<!-- ---------------------------- -->
Line 31: Line 25:
  
 
* Python debugger (in the module list: Developer Tools)
 
* Python debugger (in the module list: Developer Tools)
 +
* Node modified statistics (in the module list: Developer Tools)
  
 
<!-- ---------------------------- -->
 
<!-- ---------------------------- -->
Line 42: Line 37:
 
{{documentation/{{documentation/version}}/extension-section|Tutorials}}
 
{{documentation/{{documentation/version}}/extension-section|Tutorials}}
  
===Setup===
+
===Setup visual Python debugging===
 
* Install PyDev: the simplest is to use the standalone [http://brainwy.github.io/liclipse/ LiClipse] package
 
* Install PyDev: the simplest is to use the standalone [http://brainwy.github.io/liclipse/ LiClipse] package
 
* Run PyDev and enable the remote debugger tool (if you have trouble following these steps then you can find detailed instructions [http://pydev.org/manual_adv_remote_debugger.html here]):
 
* Run PyDev and enable the remote debugger tool (if you have trouble following these steps then you can find detailed instructions [http://pydev.org/manual_adv_remote_debugger.html here]):
Line 52: Line 47:
 
** In the ''Settings'' section set the directory that contains the ''pydevd.py'' file. Usually it is in the Eclipse plugins directory /...pydev.../pysrc.
 
** In the ''Settings'' section set the directory that contains the ''pydevd.py'' file. Usually it is in the Eclipse plugins directory /...pydev.../pysrc.
  
===Start debugging===
+
===Start visual Python debugging===
 
* In PyDev
 
* In PyDev
 
** Start the server: on the toolbar click the button "PyDev: start the pydev server"
 
** Start the server: on the toolbar click the button "PyDev: start the pydev server"

Revision as of 03:57, 16 September 2015

Home < Documentation < Nightly < Extensions < DebuggingTools


For the latest Slicer documentation, visit the read-the-docs.


Introduction and Acknowledgements

Author: Andras Lasso (PerkLab, Queen's University), Mikael Brudfors (Laboratorio de Imagen Medica, Hospital Gregorio Maranon - http://image.hggm.es/)
Contact: Andras Lasso, <email>lasso@queensu.ca</email>
Project website: http://www.slicerrt.org
License: Slicer license

SparKit  
NA-MIC  
OCAIRO  

Extension Description

Collection of debugging tools:

  • Python Debugger is an extension of 3D Slicer to allow debugging of Python scripts in the Eclipse integrated development environment using PyDev. Visual debugging (setting breakpoints, execute code step-by-step, view variables, stack, etc.) of Python scripted module is possible by using PyDev.
  • Node modified statistics: Module for collecting statistics on timing of node Modified events. It is useful for estimating refresh rate when a live data stream or temporal data sequence is visualized.

Modules

  • Python debugger (in the module list: Developer Tools)
  • Node modified statistics (in the module list: Developer Tools)

Use Cases

Tutorials

Setup visual Python debugging

  • Install PyDev: the simplest is to use the standalone LiClipse package
  • Run PyDev and enable the remote debugger tool (if you have trouble following these steps then you can find detailed instructions here):
    • Enable PyDev server: in the menu Window > Customize perspective > Command groups availability > PyDev debug
    • Open the debug window: in the menu Window > Open Perspective > Other > Debug => Without this step the Resume button will be disabled and debugging cannot be started!
  • In Slicer:
  • Install the Python debugger extension
    • Open the Python debugger module (in Developer Tools category)
    • In the Settings section set the directory that contains the pydevd.py file. Usually it is in the Eclipse plugins directory /...pydev.../pysrc.

Start visual Python debugging

  • In PyDev
    • Start the server: on the toolbar click the button "PyDev: start the pydev server"

PyDevStartRemoteDebug.png

  • In Slicer:
    • Open the Python debugger module (in Developer Tools category)
    • Click on Connect
    • If the debugger is successfully attached, then it will pause Slicer, so Slicer becomes unresponsive (until its execution is resumed in PyDev)
  • In PyDev.
    • Slicer execution is now paused. Resume Slicer execution by pressing the "Resume" button on the toolbar.
    • Load your .py file into PyDev and add breakpoints (Ctrl+Shift+B) where you want your execution to stop for debugging.
    • Important: you can open a terminal, where you can enter Python commands while the execution is paused (you have access to all Slicer variable, it has auto-complete, etc.) by clicking on "Open Console" (small button at the top of the console view) then chose "PyDev Console" and then "PyDev Debug Console" (after this the title of the console should be "PyDev Debug Console" instead of the default "Debug Server").


Information for Developers