-
Notifications
You must be signed in to change notification settings - Fork 73
SCIRun Python API 0.2
Dan White edited this page Jan 28, 2016
·
29 revisions
TODO TODO TODO
The API contains global functions for network editing, and exposes objects that wrap the corresponding SCIRun Dataflow C++ objects.
-
addModule("ModuleName")
- Adds a new instance of a module to the network. Returns a
PyModule
object.
- Adds a new instance of a module to the network. Returns a
-
removeModule(ModuleId)
- Removes a module by id. Obtain the id from the
PyModule
object you want to remove.
- Removes a module by id. Obtain the id from the
-
modules()
- Returns a list of the current modules in the network. (return type
PyModule[]
)
- Returns a list of the current modules in the network. (return type
-
executeAll()
- Executes the entire network.
-
saveNetwork("filename")
- Coming in milestone G.
-
loadNetwork("filename")
- Coming in milestone G.
-
quit()
- Coming in milestone G.
-
PyModule
properties and methods- property
id
- Returns string id of the module
- property
stateVars
- Returns names of settable fields of module's UI
- property
input
- Returns input
PyPorts
object
- Returns input
- property
output
- Returns output
PyPorts
object
- Returns output
- method
showUI()
- Shows the UI of the module.
- method
hideUI()
- Hides the UI of the module.
- method
__getattr__
/__setattr__
- This overridden pair of methods allow the user to set arbitrary state variables of the module, i.e., the values in the UI, via their official state names. (FUTURE FEATURE: a hotkey to view the official state names of every part of the UI).
- property
-
PyPorts
- Access a port from this list-like object either by index:
mod.output[0]
, or by name:mod.output.Field
. Returns aPyPort
object. - The len() function is also supported to query number of ports:
len(mod.output)
- Access a port from this list-like object either by index:
-
PyPort
- properties
name
,type
,isInput
- Return basic properties of the port
- operator
>>
- The way to connect modules. Use as an infix operator between output port and input port, for instance:
- By index:
mod1.output[0] >> mod2.input[1]
- By name:
mod1.output.OutputField >> mod2.input.InputField
- Combo approach:
mod1.output[0] >> mod2.input.InputField
- By index:
- The way to connect modules. Use as an infix operator between output port and input port, for instance:
- method
connect
- Alternative to
operator>>
:mod1.output[0].connect(mod2.input[0])
- Alternative to
- properties