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

# 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

  1

    A. Martelli, D. Hudgeon, “Collecting a Bunch of Named Items”, Python Cookbook, 2nd Ed, Chapter 4.18, 2005.

  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.

  version
    Type

      version of this Interface result object (a readonly property)

  interface

    A copy of the Interface class that was run to generate this result.

    Type

      class type

  inputs
    Type

      a traits free representation of the inputs

  outputs

    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.

    Type

      Bunch

  runtime

    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`.

    Type

      Bunch

  property version

class 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