From Slicer Wiki
Revision as of 03:41, 5 September 2013 by UpdateBot (talk | contribs) (Nightly -> 4.3)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Documentation < 4.3 < ScriptRepository

For the latest Slicer documentation, visit the 4.10 page.

Community-contributed modules

Usage: save the .py file to a directory, add the directory to the additional module paths in the Slicer application settings.


  • Fill a region of interest in a labelmap volume with a constant value. This can be used after an automatic segmentation for removing certain regions of a volume.



Community-contributed examples

Usage: Copy-paste the shown code lines or linked .py file contents into Python console in Slicer.


  • Get a MRML node in the scene based on the node name and call methods of that object. For the MRHead sample data:
  • Capture the full Slicer screen and save it into a file
 img = qt.QPixmap.grabWidget(slicer.util.mainWindow()).toImage()'c:/tmp/test.png')

Launching Slicer

  • How to open an .mrb file with Slicer at the command line?
 Slicer.exe --python-code "slicer.util.loadScene( 'f:/2013-08-23-Scene.mrb' )"
  • How to run a script in the Slicer environment in batch mode (without showing any graphical user interface)?
 Slicer.exe --python-code "doSomething; doSomethingElse; etc." --testing --no-splash --no-main-window