Inheritance diagram for nipype.pipeline.engine:
Defines functionality for pipelined execution of interfaces
The Pipeline class provides core functionality for batch processing.
Change directory to provide relative paths for doctests >>> import os >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) >>> datadir = os.path.realpath(os.path.join(filepath, ‘../testing/data’)) >>> os.chdir(datadir)
Bases: nipype.pipeline.engine.Node
Wraps interface objects that join inputs into a list.
Examples
>>> import nipype.pipeline.engine as pe
>>> from nipype import Node, JoinNode, Workflow
>>> from nipype.interfaces.utility import IdentityInterface
>>> from nipype.interfaces import (ants, dcm2nii, fsl)
>>> wf = Workflow(name='preprocess')
>>> inputspec = Node(IdentityInterface(fields=['image']),
... name='inputspec')
>>> inputspec.iterables = [('image',
... ['img1.nii', 'img2.nii', 'img3.nii'])]
>>> img2flt = Node(fsl.ImageMaths(out_data_type='float'),
... name='img2flt')
>>> wf.connect(inputspec, 'image', img2flt, 'in_file')
>>> average = JoinNode(ants.AverageImages(), joinsource='inputspec',
... joinfield='images', name='average')
>>> wf.connect(img2flt, 'out_file', average, 'images')
>>> realign = Node(fsl.FLIRT(), name='realign')
>>> wf.connect(img2flt, 'out_file', realign, 'in_file')
>>> wf.connect(average, 'output_average_image', realign, 'reference')
>>> strip = Node(fsl.BET(), name='strip')
>>> wf.connect(realign, 'out_file', strip, 'in_file')
Methods
clone(name) | Clone a workflowbase object |
get_output(parameter) | Retrieve a particular output of the node |
hash_exists([updatehash]) | |
help() | Print interface help |
load(filename) | |
output_dir() | Return the location of the output directory for the node |
run([updatehash]) | Execute the node in its directory. |
save([filename]) | |
set_input(parameter, val) | Set interface input value |
update(**opts) | |
write_report([report_type, cwd]) |
Parameters : | interface : interface object
name : alphanumeric string
joinsource : node name
joinfield : string or list of strings
unique : flag indicating whether to ignore duplicate input values See Node docstring for additional keyword arguments. : |
---|
Clone a workflowbase object
Parameters : | name : string (mandatory)
|
---|
Retrieve a particular output of the node
Print interface help
The JoinNode inputs include the join field overrides.
Return the underlying interface object
the fields to join
the join predecessor iterable node
Return the location of the output directory for the node
Return the output fields of the underlying interface
Execute the node in its directory.
Parameters : | updatehash: boolean :
|
---|
Set interface input value
Bases: nipype.pipeline.engine.Node
Wraps interface objects that need to be iterated on a list of inputs.
Examples
>>> from nipype import MapNode, fsl
>>> realign = MapNode(fsl.MCFLIRT(), 'in_file', 'realign')
>>> realign.inputs.in_file = ['functional.nii',
... 'functional2.nii',
... 'functional3.nii']
>>> realign.run()
Methods
clone(name) | Clone a workflowbase object |
get_output(parameter) | Retrieve a particular output of the node |
get_subnodes() | |
hash_exists([updatehash]) | |
help() | Print interface help |
load(filename) | |
num_subnodes() | |
output_dir() | Return the location of the output directory for the node |
run([updatehash]) | Execute the node in its directory. |
save([filename]) | |
set_input(parameter, val) | Set interface input value or nodewrapper attribute |
update(**opts) | |
write_report([report_type, cwd]) |
Parameters : | interface : interface object
iterfield : string or list of strings
name : alphanumeric string
See Node docstring for additional keyword arguments. : |
---|
Clone a workflowbase object
Parameters : | name : string (mandatory)
|
---|
Retrieve a particular output of the node
Print interface help
Return the underlying interface object
Return the location of the output directory for the node
Execute the node in its directory.
Parameters : | updatehash: boolean :
|
---|
Set interface input value or nodewrapper attribute
Priority goes to interface.
Bases: nipype.pipeline.engine.WorkflowBase
Wraps interface objects for use in pipeline
A Node creates a sandbox-like directory for executing the underlying interface. It will copy or link inputs into this directory to ensure that input data are not overwritten. A hash of the input state is used to determine if the Node inputs have changed and whether the node needs to be re-executed.
Examples
>>> from nipype import Node, spm
>>> realign = Node(spm.Realign(), 'realign')
>>> realign.inputs.in_files = 'functional.nii'
>>> realign.inputs.register_to_mean = True
>>> realign.run()
Methods
clone(name) | Clone a workflowbase object |
get_output(parameter) | Retrieve a particular output of the node |
hash_exists([updatehash]) | |
help() | Print interface help |
load(filename) | |
output_dir() | Return the location of the output directory for the node |
run([updatehash]) | Execute the node in its directory. |
save([filename]) | |
set_input(parameter, val) | Set interface input value |
update(**opts) | |
write_report([report_type, cwd]) |
Parameters : | interface : interface object
name : alphanumeric string
iterables : generator
itersource: tuple :
synchronize: boolean :
overwrite : Boolean
needed_outputs : list of output_names
run_without_submitting : boolean
|
---|
Clone a workflowbase object
Parameters : | name : string (mandatory)
|
---|
Retrieve a particular output of the node
Print interface help
Return the inputs of the underlying interface
Return the underlying interface object
Return the location of the output directory for the node
Return the output fields of the underlying interface
Execute the node in its directory.
Parameters : | updatehash: boolean :
|
---|
Set interface input value
Bases: nipype.pipeline.engine.WorkflowBase
Controls the setup and execution of a pipeline of processes.
Methods
add_nodes(nodes) | Add nodes to a workflow |
clone(name) | Clone a workflow .. |
connect(*args, **kwargs) | Connect nodes in the pipeline. |
disconnect(*args) | Disconnect two nodes |
export([filename, prefix, format, ...]) | Export object into a different format |
get_node(name) | Return an internal node by name |
list_node_names() | List names of all nodes in a workflow |
load(filename) | |
remove_nodes(nodes) | Remove nodes from a workflow |
run([plugin, plugin_args, updatehash]) | Execute the workflow |
save([filename]) | |
write_graph([dotfilename, graph2use, ...]) | Generates a graphviz dot file and a png file |
write_hierarchical_dotfile([dotfilename, ...]) |
Create a workflow object.
Parameters : | name : alphanumeric string
base_dir : string, optional
|
---|
Add nodes to a workflow
Parameters : | nodes : list
|
---|
Clone a workflow
Note
Will reset attributes used for executing workflow. See _init_runtime_fields.
Parameters : | name: alphanumeric name :
|
---|
Connect nodes in the pipeline.
This routine also checks if inputs and outputs are actually provided by the nodes that are being connected.
Creates edges in the directed graph using the nodes and edges specified in the connection_list. Uses the NetworkX method DiGraph.add_edges_from.
Parameters : | args : list or a set of four positional arguments
|
---|
Disconnect two nodes
See the docstring for connect for format.
Export object into a different format
Parameters : | filename: string :
prefix: string :
format: string :
include_config: boolean :
|
---|
Return an internal node by name
List names of all nodes in a workflow
Remove nodes from a workflow
Parameters : | nodes : list
|
---|
Execute the workflow
Parameters : | plugin: plugin name or object :
plugin_args : dictionary containing arguments to be sent to plugin
|
---|
Generates a graphviz dot file and a png file
Parameters : | graph2use: ‘orig’, ‘hierarchical’ (default), ‘flat’, ‘exec’ :
format: ‘png’, ‘svg’ : simple_form: boolean (default: True) :
|
---|
Bases: object
Defines common attributes and functions for workflows and nodes.
Methods
clone(name) | Clone a workflowbase object |
load(filename) | |
save([filename]) |
Initialize base parameters of a workflow or node
Parameters : | name : string (mandatory)
base_dir : string
|
---|
Clone a workflowbase object
Parameters : | name : string (mandatory)
|
---|