nipype.interfaces.base.support module

Miscellaneous tools to support Interface functionality

class nipype.interfaces.base.support.Bunch(*args, **kwargs)

Bases: object

Dictionary-like class that provides attribute-style access to its items.

A Bunch is a simple container that stores its items as class attributes [1]. Internally all items are stored in a dictionary and the class exposes several of the dictionary methods.

Examples

>>> from nipype.interfaces.base import Bunch
>>> inputs = Bunch(infile='subj.nii', fwhm=6.0, register_to_mean=True)
>>> inputs
Bunch(fwhm=6.0, infile='subj.nii', register_to_mean=True)
>>> inputs.register_to_mean = False
>>> inputs
Bunch(fwhm=6.0, infile='subj.nii', register_to_mean=False)

References

dictcopy()

returns a deep copy of existing Bunch as a dictionary

get(*args)

Support dictionary get() functionality

items()

iterates over bunch attributes as key, value pairs

iteritems()

iterates over bunch attributes as key, value pairs

set(**kwargs)

Support dictionary get() functionality

update(*args, **kwargs)

update existing attribute, or create new attribute

Note: update is very much like HasTraits.set

class nipype.interfaces.base.support.InterfaceResult(interface, runtime, inputs=None, outputs=None, provenance=None)

Bases: object

Object that contains the results of running a particular Interface.

Attributes:
  • version (version of this Interface result object (a readonly property))

  • interface (class type) – A copy of the Interface class that was run to generate this result.

  • inputs (a traits free representation of the inputs)

  • outputs (Bunch) – An Interface specific Bunch that contains all possible files that are generated by the interface. The outputs are used as the inputs to another node when interfaces are used in the pipeline.

  • runtime (Bunch) – Contains attributes that describe the runtime environment when the Interface was run. Contains the attributes:

    • cmdline : The command line string that was executed

    • cwd : The directory the cmdline was executed in.

    • stdout : The output of running the cmdline.

    • stderr : Any error messages output from running cmdline.

    • returncode : The code returned from running the cmdline.

property version
exception nipype.interfaces.base.support.NipypeInterfaceError(value)

Bases: Exception

Custom error for interfaces

class nipype.interfaces.base.support.RuntimeContext(resource_monitor=False, ignore_exception=False)

Bases: contextlib.AbstractContextManager

A context manager to run NiPype interfaces.

property runtime
nipype.interfaces.base.support.format_help(cls)

Prints help text of a Nipype interface

>>> from nipype.interfaces.afni import GCOR
>>> GCOR.help()  
Wraps the executable command ``@compute_gcor``.

Computes the average correlation between every voxel
and ever other voxel, over any give mask.


For complete details, ...
nipype.interfaces.base.support.get_trait_desc(inputs, name, spec)

Parses a HasTraits object into a nipype documentation string