Skip to content

Commit

Permalink
⚰️ Remove _Pool.node_data method
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy committed Jul 17, 2024
1 parent d30496c commit a9a3c48
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CPAC/distortion_correction/distortion_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def distcor_blip_fsl_topup(wf, cfg, strat_pool, pipe_num, opt=None):
wf.connect(run_topup, "out_jacs", vnum_base, "jac_matrix_list")
wf.connect(run_topup, "out_warps", vnum_base, "warp_field_list")

mean_bold = strat_pool.node_data("sbref")
mean_bold = strat_pool.get_data("sbref")

flirt = pe.Node(interface=fsl.FLIRT(), name="flirt")
flirt.inputs.dof = 6
Expand Down
2 changes: 1 addition & 1 deletion CPAC/func_preproc/func_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ def motion_estimate_filter(wf, cfg, strat_pool, pipe_num, opt=None):
notch.inputs.lowpass_cutoff = opt.get("lowpass_cutoff")
notch.inputs.filter_order = opt.get("filter_order")

movement_parameters = strat_pool.node_data("desc-movementParameters_motion")
movement_parameters = strat_pool.get_data("desc-movementParameters_motion")
wf.connect(
movement_parameters.node, movement_parameters.out, notch, "motion_params"
)
Expand Down
6 changes: 1 addition & 5 deletions CPAC/pipeline/engine/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,11 +1140,7 @@ def post_process(self, wf, label, connection, json_info, pipe_idx, pipe_x, outs)
fork=True,
)

return (wf, post_labels)

def node_data(self, resource: str | tuple[str], **kwargs) -> ResourceData:
"""Create ResourceData objects."""
return ResourceData(*self.get_data(resource, **kwargs)) # type: ignore[attr-defined]
return wf, post_labels


class ResourcePool(_Pool):
Expand Down
12 changes: 6 additions & 6 deletions CPAC/qc/xcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _connect_motion(wf, nodes, strat_pool, qc_file, pipe_num):
"""
# pylint: disable=invalid-name, too-many-arguments
try:
nodes = {**nodes, "censor-indices": strat_pool.node_data("censor-indices")}
nodes = {**nodes, "censor-indices": strat_pool.get_data("censor-indices")}
wf.connect(
nodes["censor-indices"].node,
nodes["censor-indices"].out,
Expand Down Expand Up @@ -501,7 +501,7 @@ def qc_xcp(wf, cfg, strat_pool, pipe_num, opt=None):
)
qc_file.inputs.desc = "preproc"
qc_file.inputs.regressors = (
strat_pool.node_data("regressors")
strat_pool.get_data("regressors")
.node.name.split("regressors_")[-1][::-1]
.split("_", 1)[-1][::-1]
)
Expand All @@ -511,7 +511,7 @@ def qc_xcp(wf, cfg, strat_pool, pipe_num, opt=None):
op_string="-bin ",
)
nodes = {
key: strat_pool.node_data(key)
key: strat_pool.get_data(key)
for key in [
"bold",
"desc-preproc_bold",
Expand All @@ -526,13 +526,13 @@ def qc_xcp(wf, cfg, strat_pool, pipe_num, opt=None):
]
if strat_pool.check_rpool(key)
}
nodes["bold2template_mask"] = strat_pool.node_data(
nodes["bold2template_mask"] = strat_pool.get_data(
["space-template_desc-bold_mask", "space-EPItemplate_desc-bold_mask"]
)
nodes["template_mask"] = strat_pool.node_data(
nodes["template_mask"] = strat_pool.get_data(
["T1w-brain-template-mask", "EPI-template-mask"]
)
nodes["template"] = strat_pool.node_data(
nodes["template"] = strat_pool.get_data(
["T1w-brain-template-funcreg", "EPI-brain-template-funcreg"]
)
resample_bold_mask_to_template = pe.Node(
Expand Down
6 changes: 3 additions & 3 deletions CPAC/registration/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2616,7 +2616,7 @@ def register_ANTs_anat_to_template(wf, cfg, strat_pool, pipe_num, opt=None):
node, out = connect
wf.connect(node, out, ants_rc, "inputspec.input_brain")

t1w_brain_template = strat_pool.node_data("T1w-brain-template")
t1w_brain_template = strat_pool.get_data("T1w-brain-template")
wf.connect(
t1w_brain_template.node,
t1w_brain_template.out,
Expand All @@ -2635,10 +2635,10 @@ def register_ANTs_anat_to_template(wf, cfg, strat_pool, pipe_num, opt=None):
)
wf.connect(node, out, ants_rc, "inputspec.input_head")

t1w_template = strat_pool.node_data("T1w-template")
t1w_template = strat_pool.get_data("T1w-template")
wf.connect(t1w_template.node, t1w_template.out, ants_rc, "inputspec.reference_head")

brain_mask = strat_pool.node_data(
brain_mask = strat_pool.get_data(
[
"space-T1w_desc-brain_mask",
"space-longitudinal_desc-brain_mask",
Expand Down

0 comments on commit a9a3c48

Please sign in to comment.