本文整理汇总了Python中nipype.pipeline.engine.Node.synchronize方法的典型用法代码示例。如果您正苦于以下问题:Python Node.synchronize方法的具体用法?Python Node.synchronize怎么用?Python Node.synchronize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nipype.pipeline.engine.Node
的用法示例。
在下文中一共展示了Node.synchronize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_conversion
# 需要导入模块: from nipype.pipeline.engine import Node [as 别名]
# 或者: from nipype.pipeline.engine.Node import synchronize [as 别名]
def create_conversion(
name, subject, scans, working_dir, out_dir, folder, xnat_server, xnat_user, xnat_pass, project_id, exp_id
):
convert = Workflow(name=name)
convert.base_dir = working_dir
convert.config["execution"]["crashdump_dir"] = convert.base_dir + "/crash_files"
# infosource to iterate over scans
scan_infosource = Node(util.IdentityInterface(fields=["scan_key", "scan_val"]), name="scan_infosource")
scan_infosource.iterables = [("scan_key", scans.keys()), ("scan_val", scans.values())]
scan_infosource.synchronize = True
# xnat source
xnatsource = Node(
nio.XNATSource(
infields=["project_id", "subject_id", "exp_id", "scan_id"],
outfields=["dicom"],
server=xnat_server,
user=xnat_user,
pwd=xnat_pass,
cache_dir=working_dir,
),
name="xnatsource",
)
xnatsource.inputs.query_template = (
"/projects/%s/subjects/%s/experiments/%s/scans/%d/resources/DICOM/files"
) # files')
xnatsource.inputs.query_template_args["dicom"] = [["project_id", "subject_id", "exp_id", "scan_id"]]
xnatsource.inputs.project_id = project_id
xnatsource.inputs.subject_id = subject
xnatsource.inputs.exp_id = exp_id
convert.connect([(scan_infosource, xnatsource, [("scan_val", "scan_id")])])
# workflow to convert dicoms
dcmconvert = create_dcmconvert_pipeline()
convert.connect(
[
(scan_infosource, dcmconvert, [("scan_key", "inputnode.filename")]),
(xnatsource, dcmconvert, [("dicom", "inputnode.dicoms")]),
]
)
# xnat sink
sink = Node(nio.DataSink(base_directory=out_dir, parameterization=False), name="sink")
convert.connect([(dcmconvert, sink, [("outputnode.nifti", folder)])])
convert.run()