Difference between revisions of "Documentation/Nightly/ScriptRepository"

From Slicer Wiki
Jump to: navigation, search
Line 4: Line 4:
  
 
=Community-contributed modules=
 
=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==
 
==Segmentation==
Line 10: Line 12:
 
=Community-contributed examples=
 
=Community-contributed examples=
  
Copy-paste the .py file contents into Python console.
+
Usage: Copy-paste the shown code lines or linked .py file contents into Python console in Slicer.
  
 
==Capture==
 
==Capture==
 +
* Get the object corresponding to a MRML node in the scene, e.g., for the MRHead sample data
 +
  vol=slicer.util.getNode('MR*')
 +
  vol.GetImageData().GetDimensions()
 
* ScreenCapture: Capture the full Slicer screen into a file
 
* ScreenCapture: Capture the full Slicer screen into a file
 
   img = qt.QPixmap.grabWidget(slicer.util.mainWindow()).toImage()
 
   img = qt.QPixmap.grabWidget(slicer.util.mainWindow()).toImage()
 
   img.save('c:/tmp/test.png')
 
   img.save('c:/tmp/test.png')
 
* [https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/sandbox/CaptureRotationVideo/CaptureRotationVideo.py CaptureRotationVideo.py]: Capture a video of the scene rotating in the 3D view
 
* [https://subversion.assembla.com/svn/slicerrt/trunk/SlicerRt/sandbox/CaptureRotationVideo/CaptureRotationVideo.py CaptureRotationVideo.py]: Capture a video of the scene rotating in the 3D view

Revision as of 23:00, 2 August 2013

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 the object corresponding to a MRML node in the scene, e.g., for the MRHead sample data
 vol=slicer.util.getNode('MR*')
 vol.GetImageData().GetDimensions()
  • ScreenCapture: Capture the full Slicer screen into a file
 img = qt.QPixmap.grabWidget(slicer.util.mainWindow()).toImage()
 img.save('c:/tmp/test.png')