nipype.interfaces.base.specs module

Base I/O specifications for Nipype interfaces

Define the API for the I/O of interfaces

class nipype.interfaces.base.specs.BaseTraitedSpec(**kwargs)

Bases: traits.has_traits.HasTraits

Provide a few methods necessary to support nipype interface api

The inputs attribute of interfaces call certain methods that are not available in traits.HasTraits. These are provided here.

new metadata:

  • usedefault : set this to True if the default value of the trait should be used. Unless this is set, the attributes are set to traits.Undefined

new attribute:

  • get_hashval : returns a tuple containing the state of the trait as a dict and hashvalue corresponding to dict.

XXX Reconsider this in the long run, but it seems like the best solution to move forward on the refactoring.

get(**kwargs)

Returns traited class as a dict

Augments the trait get function to return a dictionary without notification handles

get_hashval(hash_method=None)

Return a dictionary of our items with hashes for each file.

Searches through dictionary items and if an item is a file, it calculates the md5 hash of the file contents and stores the file name and hash value as the new key value.

However, the overall bunch hash is calculated only on the hash value of a file. The path and name of the file are not used in the overall hash calculation.

Returns

  • list_withhash (dict) – Copy of our dictionary with the new file hashes included with each file.

  • hashvalue (str) – The md5 hash value of the traited spec

get_traitsfree(**kwargs)

Returns traited class as a dict

Augments the trait get function to return a dictionary without any traits. The dictionary does not contain any attributes that were Undefined

has_metadata(name, metadata, value=None, recursive=True)

Return has_metadata for the requested trait name in this interface

items()

Name, trait generator for user modifiable traits

package_version = <Version('1.7.1.dev0')>
trait_get(**kwargs)

Returns traited class as a dict

Augments the trait get function to return a dictionary without notification handles

class nipype.interfaces.base.specs.DynamicTraitedSpec(**kwargs)

Bases: nipype.interfaces.base.specs.BaseTraitedSpec

A subclass to handle dynamic traits

This class is a workaround for add_traits and clone_traits not functioning well together.

nipype.interfaces.base.specs.get_filecopy_info(cls)

Provides information about file inputs to copy or link to cwd. Necessary for pipeline operation