From 93292a01bbb6f696b5ec0d39db787bf620997633 Mon Sep 17 00:00:00 2001 From: Gensollen Date: Wed, 13 Nov 2024 15:18:15 +0100 Subject: [PATCH] [FIX] Fix usage of group labels in non-regression tests (#1371) --- .../pipelines/anat/test_t1_volume.py | 8 +++---- .../pipelines/pet/test_pet_volume.py | 2 +- .../pipelines/test_run_pipelines_ml.py | 4 ++-- .../pipelines/test_run_pipelines_stats.py | 22 ++++++------------- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/test/nonregression/pipelines/anat/test_t1_volume.py b/test/nonregression/pipelines/anat/test_t1_volume.py index 6d714dd49..c7e41d08e 100644 --- a/test/nonregression/pipelines/anat/test_t1_volume.py +++ b/test/nonregression/pipelines/anat/test_t1_volume.py @@ -86,7 +86,7 @@ def run_t1_volume_create_dartel( caps_directory=fspath(output_dir / "caps"), tsv_file=fspath(input_dir / "subjects.tsv"), base_dir=fspath(working_dir), - parameters={"group_label": "UnitTest"}, + group_label="UnitTest", ) pipeline.build() pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 4}, bypass_check=True) @@ -162,7 +162,7 @@ def run_t1_volume_dartel_to_mni( caps_directory=fspath(output_dir / "caps"), tsv_file=fspath(input_dir / "subjects.tsv"), base_dir=fspath(working_dir), - parameters={"group_label": "UnitTest"}, + group_label="UnitTest", ) pipeline.build() pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 4}, bypass_check=True) @@ -222,7 +222,7 @@ def run_t1_volume_register_dartel( caps_directory=fspath(output_dir / "caps"), tsv_file=fspath(input_dir / "subjects.tsv"), base_dir=fspath(working_dir), - parameters={"group_label": "UnitTest"}, + group_label="UnitTest", ) pipeline.build() pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 4}, bypass_check=True) @@ -282,7 +282,7 @@ def run_t1_volume_parcellation( caps_directory=fspath(output_dir / "caps"), tsv_file=fspath(input_dir / "subjects.tsv"), base_dir=fspath(working_dir), - parameters={"group_label": "UnitTest"}, + group_label="UnitTest", ) pipeline.build() pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 4}, bypass_check=True) diff --git a/test/nonregression/pipelines/pet/test_pet_volume.py b/test/nonregression/pipelines/pet/test_pet_volume.py index ee86e861f..e68e67f0a 100644 --- a/test/nonregression/pipelines/pet/test_pet_volume.py +++ b/test/nonregression/pipelines/pet/test_pet_volume.py @@ -24,7 +24,6 @@ def run_pet_volume( region = SUVRReferenceRegion.PONS parameters = { - "group_label": "UnitTest", "acq_label": tracer, "suvr_reference_region": region, "skip_question": True, @@ -34,6 +33,7 @@ def run_pet_volume( caps_directory=fspath(output_dir / "caps"), tsv_file=fspath(input_dir / "subjects.tsv"), base_dir=fspath(working_dir), + group_label="UnitTest", parameters=parameters, ) pipeline.build() diff --git a/test/nonregression/pipelines/test_run_pipelines_ml.py b/test/nonregression/pipelines/test_run_pipelines_ml.py index 58af7d542..0a09627b6 100644 --- a/test/nonregression/pipelines/test_run_pipelines_ml.py +++ b/test/nonregression/pipelines/test_run_pipelines_ml.py @@ -150,12 +150,12 @@ def run_spatial_svm( # Copy necessary data from in to out shutil.copytree(input_dir / "caps", caps_dir, copy_function=shutil.copy) - parameters = {"group_label": "ADNIbl", "orig_input_data_ml": "t1-volume"} pipeline = SpatialSVM( caps_directory=fspath(caps_dir), tsv_file=fspath(tsv), base_dir=fspath(working_dir), - parameters=parameters, + group_label="ADNIbl", + parameters={"orig_input_data_ml": "t1-volume"}, ) pipeline.build() pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 4}, bypass_check=True) diff --git a/test/nonregression/pipelines/test_run_pipelines_stats.py b/test/nonregression/pipelines/test_run_pipelines_stats.py index c64907f9b..3f3a52e61 100644 --- a/test/nonregression/pipelines/test_run_pipelines_stats.py +++ b/test/nonregression/pipelines/test_run_pipelines_stats.py @@ -85,7 +85,6 @@ def run_statistics_surface( shutil.copytree(input_dir / "caps", caps_dir, copy_function=shutil.copy) parameters = { - "group_label": "UnitTest", "orig_input_data": "t1-freesurfer", "glm_type": "group_comparison", "contrast": "group", @@ -95,6 +94,7 @@ def run_statistics_surface( caps_directory=caps_dir, tsv_file=tsv, base_dir=working_dir, + group_label="UnitTest", parameters=parameters, ) pipeline.build() @@ -154,10 +154,8 @@ def run_statistics_volume_pet( # Copy necessary data from in to out shutil.copytree(input_dir / "caps", caps_dir, copy_function=shutil.copy) - # Instantiate pipeline and run() parameters = { # Clinica compulsory parameters - "group_label": "UnitTest", "orig_input_data_volume": "pet-volume", "contrast": "group", # Optional arguments for inputs from pet-volume pipeline @@ -165,14 +163,13 @@ def run_statistics_volume_pet( "use_pvc_data": False, "suvr_reference_region": SUVRReferenceRegion.PONS, } - pipeline = StatisticsVolume( caps_directory=fspath(caps_dir), tsv_file=fspath(tsv), base_dir=fspath(working_dir), + group_label="UnitTest", parameters=parameters, ) - pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 2}, bypass_check=True) output_t_stat = ( @@ -217,21 +214,16 @@ def run_statistics_volume_t1( # Copy necessary data from in to out shutil.copytree(input_dir / "caps", caps_dir, copy_function=shutil.copy) - # Instantiate pipeline and run() - parameters = { - # Clinica compulsory parameters - "group_label": "UnitTest", - "orig_input_data_volume": "t1-volume", - "contrast": "group", - } - pipeline = StatisticsVolume( caps_directory=fspath(caps_dir), tsv_file=fspath(tsv), base_dir=fspath(working_dir), - parameters=parameters, + group_label="UnitTest", + parameters={ + "orig_input_data_volume": "t1-volume", + "contrast": "group", + }, ) - pipeline.run(plugin="MultiProc", plugin_args={"n_procs": 2}, bypass_check=True) output_t_stat = (