From bd62183ecb489d58aefdea4047dafa72f31fb026 Mon Sep 17 00:00:00 2001 From: Gabriel Girard Date: Thu, 19 Dec 2024 15:50:41 -0500 Subject: [PATCH] TST - Scripts inputs --- scripts/tests/test_volume_stats_in_ROI.py | 26 +++++++++++++++++++- scripts/tests/test_volume_stats_in_labels.py | 19 ++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/scripts/tests/test_volume_stats_in_ROI.py b/scripts/tests/test_volume_stats_in_ROI.py index 71eb2bc8da..c035938585 100644 --- a/scripts/tests/test_volume_stats_in_ROI.py +++ b/scripts/tests/test_volume_stats_in_ROI.py @@ -20,9 +20,33 @@ def test_help_option(script_runner): def test_execution_tractometry(script_runner, monkeypatch): monkeypatch.chdir(os.path.expanduser(tmp_dir.name)) in_roi = os.path.join(SCILPY_HOME, 'tractometry', - 'IFGWM.nii.gz') + 'IFGWM.nii.gz') in_ref = os.path.join(SCILPY_HOME, 'tractometry', 'mni_masked.nii.gz') + + # Test with a single ROI input ret = script_runner.run('scil_volume_stats_in_ROI.py', in_roi, '--metrics', in_ref) assert ret.success + + # Test with multiple ROIs input + ret = script_runner.run('scil_volume_stats_in_ROI.py', + in_roi, in_roi, in_roi, '--metrics', in_ref) + assert ret.success + + # Test with multiple metric input + ret = script_runner.run('scil_volume_stats_in_ROI.py', + in_roi, '--metrics', in_ref, in_ref, in_ref) + assert ret.success + + # Test with multiple metric and ROIs input + ret = script_runner.run('scil_volume_stats_in_ROI.py', + in_roi, in_roi, '--metrics', in_ref, in_ref) + assert ret.success + + # Test with a metric folder + metrics_dir = os.path.join(SCILPY_HOME, 'plot') + in_roi = os.path.join(SCILPY_HOME, 'plot', 'mask_wm.nii.gz') + ret = script_runner.run('scil_volume_stats_in_ROI.py', + in_roi, '--metrics_dir', metrics_dir) + assert ret.success diff --git a/scripts/tests/test_volume_stats_in_labels.py b/scripts/tests/test_volume_stats_in_labels.py index df1ea8064a..4a44713841 100644 --- a/scripts/tests/test_volume_stats_in_labels.py +++ b/scripts/tests/test_volume_stats_in_labels.py @@ -17,9 +17,24 @@ def test_help_option(script_runner): def test_execution(script_runner, monkeypatch): monkeypatch.chdir(os.path.expanduser(tmp_dir.name)) - in_map = os.path.join(SCILPY_HOME, 'plot', 'fa.nii.gz') + in_metric = os.path.join(SCILPY_HOME, 'plot', 'fa.nii.gz') in_atlas = os.path.join(SCILPY_HOME, 'plot', 'atlas_brainnetome.nii.gz') atlas_lut = os.path.join(SCILPY_HOME, 'plot', 'atlas_brainnetome.json') + + # Test with a single metric + ret = script_runner.run('scil_volume_stats_in_labels.py', + in_atlas, atlas_lut, "--metrics", in_metric) + assert ret.success + + # Test with multiple metrics + ret = script_runner.run('scil_volume_stats_in_labels.py', + in_atlas, atlas_lut, "--metrics", + in_metric, in_metric, in_metric) + assert ret.success + + # Test with a metric folder + metrics_dir = os.path.join(SCILPY_HOME, 'plot') ret = script_runner.run('scil_volume_stats_in_labels.py', - in_atlas, atlas_lut, "--metrics", in_map) + in_atlas, atlas_lut, "--metrics_dir", + metrics_dir) assert ret.success