Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Initialize a barebones TOPUP implementation."""
from nipype.interfaces.afni import Automask
from nipype.interfaces.fsl.epi import TOPUP
from niworkflows.interfaces.nibabel import MergeSeries
from sdcflows.interfaces.fmap import get_trt
from ...interfaces.images import RescaleB0
wf = Workflow(name=name)
inputnode = pe.Node(niu.IdentityInterface(fields=["metadata", "in_data"]),
name="inputnode")
outputnode = pe.Node(niu.IdentityInterface(fields=["fieldmap", "corrected", "corrected_mask"]),
name="outputnode")
concat_blips = pe.Node(MergeSeries(), name="concat_blips")
readout_time = pe.MapNode(niu.Function(
input_names=["in_meta", "in_file"], function=get_trt), name="readout_time",
iterfield=["in_meta", "in_file"], run_without_submitting=True
)
topup = pe.Node(TOPUP(config=_pkg_fname(
"dmriprep", f"data/flirtsch/b02b0{'_quick' * debug}.cnf")), name="topup")
pre_mask = pe.Node(Automask(dilate=1, outputtype="NIFTI_GZ"),
name="pre_mask")
rescale_corrected = pe.Node(RescaleB0(), name="rescale_corrected")
post_mask = pe.Node(Automask(outputtype="NIFTI_GZ"),
name="post_mask")
wf.connect([
(inputnode, concat_blips, [("in_data", "in_files")]),
(inputnode, readout_time, [("in_data", "in_file"),
("metadata", "in_meta")]),
(inputnode, topup, [(("metadata", _get_pedir), "encoding_direction")]),