From 96f5871d5f50e74f89601480b46df022587d70d7 Mon Sep 17 00:00:00 2001 From: "birajstha:construction_worker::penguin" Date: Wed, 2 Oct 2024 20:32:00 -0400 Subject: [PATCH] fixed positions of args in lesion_preproc and added default RPI --- CPAC/anat_preproc/lesion_preproc.py | 6 ++++-- CPAC/registration/registration.py | 2 +- CPAC/registration/tests/test_registration.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CPAC/anat_preproc/lesion_preproc.py b/CPAC/anat_preproc/lesion_preproc.py index c10f057954..21628c97f0 100644 --- a/CPAC/anat_preproc/lesion_preproc.py +++ b/CPAC/anat_preproc/lesion_preproc.py @@ -58,7 +58,7 @@ def inverse_lesion(lesion_path): return lesion_out -def create_lesion_preproc(wf_name="lesion_preproc", orientation="RPI"): +def create_lesion_preproc(cfg=None, wf_name="lesion_preproc"): """Process lesions masks. Lesion mask file is deobliqued and reoriented in the same way as the T1 in @@ -133,7 +133,9 @@ def create_lesion_preproc(wf_name="lesion_preproc", orientation="RPI"): mem_x=(0.0115, "in_file", "t"), ) - lesion_reorient.inputs.orientation = orientation + lesion_reorient.inputs.orientation = ( + cfg.pipeline_setup["desired_orientation"] if cfg else "RPI" + ) lesion_reorient.inputs.outputtype = "NIFTI_GZ" preproc.connect(lesion_deoblique, "out_file", lesion_reorient, "in_file") diff --git a/CPAC/registration/registration.py b/CPAC/registration/registration.py index 2214585d9c..1c6b6fa71a 100644 --- a/CPAC/registration/registration.py +++ b/CPAC/registration/registration.py @@ -1736,7 +1736,7 @@ def ANTs_registration_connector( "ANTs" ]["use_lesion_mask"]: # Create lesion preproc node to apply afni Refit and Resample - lesion_preproc = create_lesion_preproc(wf_name=f"lesion_preproc{symm}", cfg.pipeline_setup["desired_orientation"]) + lesion_preproc = create_lesion_preproc(cfg, wf_name=f"lesion_preproc{symm}") wf.connect(inputNode, "lesion_mask", lesion_preproc, "inputspec.lesion") wf.connect( lesion_preproc, diff --git a/CPAC/registration/tests/test_registration.py b/CPAC/registration/tests/test_registration.py index 58741da445..d8e8228497 100755 --- a/CPAC/registration/tests/test_registration.py +++ b/CPAC/registration/tests/test_registration.py @@ -130,7 +130,7 @@ def test_registration_lesion(): anat_preproc.inputs.inputspec.anat = anat_file - lesion_preproc = create_lesion_preproc(wf_name="lesion_preproc") + lesion_preproc = create_lesion_preproc(cfg, wf_name="lesion_preproc") lesion_preproc.inputs.inputspec.lesion = lesion_file