slicer Package

This module loads the Slicer library modules into its namespace.

cli Module

This module is a place holder for convenient functions allowing to interact with CLI.

slicer.cli.cancel(node)[source]
slicer.cli.createNode(cliModule, parameters=None)[source]

Creates a new vtkMRMLCommandLineModuleNode for a specific module, with optional parameters

slicer.cli.run(module, node=None, parameters=None, wait_for_completion=False, delete_temporary_files=True)[source]

Runs a CLI, optionally given a node with optional parameters, returning back the node (or the new one if created) node: existing parameter node (None by default) parameters: dictionary of parameters for cli (None by default) wait_for_completion: block if True (False by default) delete_temporary_files: remove temp files created during exectuion (True by default)

slicer.cli.setNodeParameters(node, parameters)[source]

Sets parameters for a vtkMRMLCommandLineModuleNode given a dictionary of (parameterName, parameterValue) pairs For vectors: provide a list, tuple or comma-separated string For enumerations, provide the single enumeration value For files and directories, provide a string For images, geometry, points and regions, provide a vtkMRMLNode

logic Module

This module loads all the classes from the vtkSlicerBaseLogic library into its namespace.

slicerqt Module

slicer.slicerqt.loadSlicerRCFile()[source]

If it exists, execute slicer resource script ‘~/.slicerrc.py’

testing Module

slicer.testing.exitFailure(message='')[source]
slicer.testing.exitSuccess()[source]
slicer.testing.runUnitTest(path, testname)[source]

util Module

slicer.util.array(pattern='', index=0)[source]

Return the array you are “most likely to want” from the indexth MRML node that matches the pattern. Meant to be used in the python console for quick debugging/testing. More specific API should be used in scripts to be sure you get exactly what you want.

slicer.util.exit(status=0)[source]
slicer.util.findChildren(widget=None, name='', text='', title='', className='')[source]

return a list of child widgets that match the passed name

slicer.util.getModule(moduleName)[source]
slicer.util.getModuleGui(module)[source]
slicer.util.getNewModuleGui(module)[source]
slicer.util.getNode(pattern='', index=0)[source]

Return the indexth node where name or id matches ‘pattern’. Providing an empty ‘pattern’ string will return all nodes.

slicer.util.getNodes(pattern='')[source]

Return a dictionary of nodes where the name or id matches the ‘pattern’. Providing an empty ‘pattern’ string will return all nodes.

slicer.util.importClassesFromDirectory(directory, dest_module_name, type_name, filematch='*')[source]
slicer.util.importModuleObjects(from_module_name, dest_module_name, type_name)[source]

Import object of type ‘type_name’ from module identified by ‘from_module_name’ into the module identified by ‘dest_module_name’.

slicer.util.importQtClassesFromDirectory(directory, dest_module_name, filematch='*')[source]
slicer.util.importVTKClassesFromDirectory(directory, dest_module_name, filematch='*')[source]
slicer.util.loadAnnotationFiducial(filename, returnNode=False)[source]
slicer.util.loadColorTable(filename, returnNode=False)[source]
slicer.util.loadFiberBundle(filename, returnNode=False)[source]
slicer.util.loadFiducialList(filename, returnNode=False)[source]
slicer.util.loadLabelVolume(filename, properties, returnNode=False)[source]
slicer.util.loadMarkupsFiducialList(filename, returnNode=False)[source]
slicer.util.loadModel(filename, returnNode=False)[source]
slicer.util.loadNodeFromFile(filename, filetype, properties={}, returnNode=False)[source]
slicer.util.loadScalarOverlay(filename, returnNode=False)[source]
slicer.util.loadScene(filename, properties={})[source]
slicer.util.loadTransform(filename, returnNode=False)[source]
slicer.util.loadVolume(filename, properties={}, returnNode=False)[source]
slicer.util.lookupTopLevelWidget(objectName, verbose=True)[source]

Loop over all top level widget associated with ‘slicer.app’ and return the one matching ‘objectName’

slicer.util.mainWindow(verbose=True)[source]
slicer.util.moduleNames()[source]
slicer.util.openAddColorTableDialog()[source]
slicer.util.openAddDataDialog()[source]
slicer.util.openAddFiberBundleDialog()[source]
slicer.util.openAddFiducialDialog()[source]
slicer.util.openAddModelDialog()[source]
slicer.util.openAddScalarOverlayDialog()[source]
slicer.util.openAddTransformDialog()[source]
slicer.util.openAddVolumeDialog()[source]
slicer.util.openSaveDataDialog()[source]
slicer.util.pythonShell(verbose=True)[source]
slicer.util.quit()[source]
slicer.util.reloadScriptedModule(moduleName)[source]

Generic reload method for any scripted module.

slicer.util.restart()[source]
slicer.util.saveNode(node, filename, properties={})[source]

Save ‘node’ data into ‘filename’.

It is the user responsability to provide the appropriate file extension.

User has also the possibility to overwrite the fileType internally retrieved using method ‘qSlicerCoreIOManager::fileWriterFileType(vtkObject*)’. This can be done by specifiying a ‘fileType’attribute to the optional ‘properties’ dictionary.

slicer.util.saveScene(filename, properties={})[source]

Save the current scene.

Based on the value of ‘filename’, the current scene is saved either as a MRML file, MRB file or directory.

If filename ends with ‘.mrml’, the scene is saved as a single file without associated data.

If filename ends with ‘.mrb’, the scene is saved as a MRML bundle (Zip archive with scene and data files).

In every other case, the scene is saved in the directory specified by ‘filename’. Both MRML scene file and data will be written to disk. If needed, directories and sub-directories will be created.

slicer.util.selectModule(module)[source]
slicer.util.showStatusMessage(message, duration=0)[source]

Table Of Contents

Previous topic

sitkUtils Module

Next topic

teem Module

This Page