Home · Quickstart · User Guide and Examples · Interfaces Index · Developers · About · Nipy

# nipype.pipeline.engine.workflows module

Defines functionality for pipelined execution of interfaces

The Workflow class provides core functionality for batch processing.

class nipype.pipeline.engine.workflows.Workflow(name, base_dir=None)

  Bases: `nipype.pipeline.engine.base.EngineBase`

  Controls the setup and execution of a pipeline of processes.

  add_nodes(nodes)

    Add nodes to a workflow

    Parameters

      nodes (list) – A list of EngineBase-based objects

  clone(name)

    Clone a workflow

    Note

    Will reset attributes used for executing workflow. See _init_runtime_fields.

    Parameters

      name (alphanumeric name) – unique name for the workflow

  connect(*args, **kwargs)

    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) –

      Four positional arguments of the form:

          connect(source, sourceoutput, dest, destinput)

      source : nodewrapper node sourceoutput : string (must be in source.outputs) dest : nodewrapper node destinput : string (must be in dest.inputs)

      A list of 3-tuples of the following form:

          [(source, target,
              [('sourceoutput/attribute', 'targetinput'),
              ...]),
          ...]

      Or:

          [(source, target, [(('sourceoutput1', func, arg2, ...),
                                      'targetinput'), ...]),
          ...]
          sourceoutput1 will always be the first argument to func
          and func will be evaluated and the results sent ot targetinput

          currently func needs to define all its needed imports within the
          function as we use the inspect module to get at the source code
          and execute it remotely

  disconnect(*args)

    Disconnect nodes See the docstring for connect for format.

  export(filename=None, prefix='output', format='python', include_config=False)

    Export object into a different format

    Parameters

      - filename (string) – file to save the code to; overrides prefix

      - prefix (string) – prefix to use for output file

      - format (string) – one of “python”

      - include_config (boolean) – whether to include node and workflow config values

  get_node(name)

    Return an internal node by name

  property inputs
  list_node_names()

    List names of all nodes in a workflow

  property outputs
  remove_nodes(nodes)

    Remove nodes from a workflow

    Parameters

      nodes (list) – A list of EngineBase-based objects

  run(plugin=None, plugin_args=None, updatehash=False)

    Execute the workflow

    Parameters

      - plugin (plugin name or object) – Plugin to use for execution. You can create your own plugins for execution.

      - plugin_args (dictionary containing arguments to be sent to plugin) – constructor. see individual plugin doc strings for details.

  write_graph(dotfilename='graph.dot', graph2use='hierarchical', format='png', simple_form=True)

    Generates a graphviz dot file and a png file

    Parameters

      - graph2use ('orig', 'hierarchical' (default), 'flat', 'exec', 'colored') – orig - creates a top level graph without expanding internal workflow nodes; flat - expands workflow nodes recursively; hierarchical - expands workflow nodes recursively with a notion on hierarchy; colored - expands workflow nodes recursively with a notion on hierarchy in color; exec - expands workflows to depict iterables

      - format ('png', 'svg') –

      - simple_form (boolean (default: True)) – Determines if the node name used in the graph should be of the form ‘nodename (package)’ when True or ‘nodename.Class.package’ when False.

  write_hierarchical_dotfile(dotfilename=None, colored=False, simple_form=True)