Documentation/Nightly/ScriptRepository

From Slicer Wiki
Revision as of 23:02, 2 August 2013 by Lasso (talk | contribs) (→‎Capture)
Jump to: navigation, search
Home < Documentation < Nightly < ScriptRepository


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



Community-contributed modules

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

Segmentation

  • FillRoi.py: Use this module to fill a ROI with a constant value. It can be used after an automatic segmentation for removing certain regions of a scalar or labelmap volume.

Community-contributed examples

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

Capture

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