本文整理汇总了Python中nipype.pipeline.engine.Node.run方法的典型用法代码示例。如果您正苦于以下问题:Python Node.run方法的具体用法?Python Node.run怎么用?Python Node.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nipype.pipeline.engine.Node
的用法示例。
在下文中一共展示了Node.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from nipype.pipeline.engine import Node [as 别名]
# 或者: from nipype.pipeline.engine.Node import run [as 别名]
def __call__(self, **kwargs):
kwargs = modify_paths(kwargs, relative=False)
interface = self.interface()
# Set the inputs early to get some argument checking
interface.inputs.set(**kwargs)
# Make a name for our node
inputs = interface.inputs.get_hashval()
hasher = hashlib.new('md5')
hasher.update(pickle.dumps(inputs))
dir_name = '%s-%s' % (interface.__class__.__module__.replace('.', '-'),
interface.__class__.__name__)
job_name = hasher.hexdigest()
node = Node(interface, name=job_name)
node.base_dir = os.path.join(self.base_dir, dir_name)
cwd = os.getcwd()
try:
out = node.run()
finally:
# node.run() changes to the node directory - if something goes wrong
# before it cds back you would end up in strange places
os.chdir(cwd)
if self.callback is not None:
self.callback(dir_name, job_name)
return out
示例2: _merge_nii
# 需要导入模块: from nipype.pipeline.engine import Node [as 别名]
# 或者: from nipype.pipeline.engine.Node import run [as 别名]
def _merge_nii(file_list, out_filename):
from nipype.pipeline.engine import Node, Workflow
import nipype.interfaces.fsl as fsl
merge = Node(fsl.Merge(dimension='t'), name='merge')
merge.base_dir = os.getcwd()
merge.inputs.in_files = file_list
merge.inputs.merged_file = out_filename
result = merge.run()
return result.outputs.merged_file
示例3: __call__
# 需要导入模块: from nipype.pipeline.engine import Node [as 别名]
# 或者: from nipype.pipeline.engine.Node import run [as 别名]
def __call__(self, **kwargs):
kwargs = modify_paths(kwargs, relative=False)
interface = self.interface()
# Set the inputs early to get some argument checking
interface.inputs.set(**kwargs)
# Make a name for our node
inputs = interface.inputs.get_hashval()
hasher = hashlib.new('md5')
hasher.update(pickle.dumps(inputs))
dir_name = '%s-%s' % (interface.__class__.__module__.replace('.', '-'),
interface.__class__.__name__)
job_name = hasher.hexdigest()
node = Node(interface, name=job_name)
node.base_dir = os.path.join(self.base_dir, dir_name)
out = node.run()
if self.callback is not None:
self.callback(dir_name, job_name)
return out