Inheritance diagram for nipype.caching.memory:
Using nipype with persistence and lazy recomputation but without explicit name-steps pipeline: getting back scope in command-line based programming.
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: object
Memory context to provide caching for interfaces
Parameters : | base_dir: string :
|
---|---|
Methods : | cache :
clear_previous_runs :
clear_previous_runs :
|
Returns a callable that caches the output of an interface
Parameters : | interface: nipype interface :
|
---|---|
Returns : | pipe_func: a PipeFunc callable object :
|
Examples
>>> from tempfile import mkdtemp
>>> mem = Memory(mkdtemp())
>>> from nipype.interfaces import fsl
Here we create a callable that can be used to apply an fsl.Merge interface to files
>>> fsl_merge = mem.cache(fsl.Merge)
Now we apply it to a list of files. We need to specify the list of input files and the dimension along which the files should be merged.
>>> results = fsl_merge(in_files=['a.nii', 'b.nii'],
... dimension='t')
We can retrieve the resulting file from the outputs: >>> results.outputs.merged_file # doctest: +SKIP ‘...’
Remove all the cache that where not used in the latest run of the memory object: i.e. since the corresponding Python object was created.
Parameters : | warn: boolean, optional :
|
---|
Remove all the cache that where not used since the given date
Parameters : | day, month, year: integers, optional :
warn: boolean, optional :
|
---|
Bases: object
Callable interface to nipype.interface objects
Use this to wrap nipype.interface object and call them specifying their input with keyword arguments:
fsl_merge = PipeFunc(fsl.Merge, base_dir='.')
out = fsl_merge(in_files=files, dimension='t')
Parameters : | interface: a nipype interface class :
base_dir: a string :
callback: a callable :
|
---|
Remove all the sub-directories of base_dir, but those listed
Parameters : | base_dir: string :
dirs_to_keep: set :
|
---|