Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pedirs = [m.get("PhaseEncodingDirection", "unknown") for m in metadata]
if len(set(pedirs) - set(("unknown",))) > 1:
if "unknown" in pedirs or len(set(pe[0] for pe in set(pedirs))) > 1:
raise NotImplementedError
# Get EPI polarities and their metadata
sdc_estimate_wf = init_pepolar_estimate_wf(debug=debug)
sdc_estimate_wf.inputs.inputnode.metadata = metadata
wf.connect([
(inputnode, sdc_estimate_wf, [("dwi_reference", "inputnode.in_data")]),
])
if generate_report:
from sdcflows.interfaces.reportlets import FieldmapReportlet
pepolar_report = pe.Node(FieldmapReportlet(reference_label="SDC'd B0"),
name="pepolar_report")
ds_report_pepolar = pe.Node(DerivativesDataSink(
base_directory=str(config.execution.output_dir), datatype="figures",
suffix="fieldmap", desc="pepolar", dismiss_entities=("acquisition", "dir")),
name="ds_report_pepolar")
ds_report_pepolar.inputs.source_file = epi_targets[0]
wf.connect([
(sdc_estimate_wf, pepolar_report, [
("outputnode.fieldmap", "fieldmap"),
("outputnode.corrected", "reference"),
("outputnode.corrected_mask", "mask")]),
(pepolar_report, ds_report_pepolar, [("out_report", "in_file")]),
])
return wf