From 5b6e3376b348fbe5e1dc77768648e5ea71b2c155 Mon Sep 17 00:00:00 2001 From: "Julio A. Peraza" <52050407+JulioAPeraza@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:57:08 -0700 Subject: [PATCH] Add t-statistic images as valid targets in ImageTransformer (#895) Add t-statistic image as valid target in ImageTransformer --- nimare/tests/test_transforms.py | 6 ++++++ nimare/transforms.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nimare/tests/test_transforms.py b/nimare/tests/test_transforms.py index fb75d1473..fbaa4ffe2 100644 --- a/nimare/tests/test_transforms.py +++ b/nimare/tests/test_transforms.py @@ -30,6 +30,12 @@ def test_ImageTransformer(testdata_ibma): new_p_files = new_dset.images["p"].tolist() assert all([isinstance(pf, str) for pf in new_p_files]) + t_files = dset.images["t"].tolist() + t_transformer = transforms.ImageTransformer(target="t") + new_dset = t_transformer.transform(dset) + new_t_files = new_dset.images["t"].tolist() + assert t_files[:-1] == new_t_files[:-1] + def test_transform_images(testdata_ibma): """Smoke test on transforms.transform_images.""" diff --git a/nimare/transforms.py b/nimare/transforms.py index 64aeb4fe2..8ff4efb77 100644 --- a/nimare/transforms.py +++ b/nimare/transforms.py @@ -110,7 +110,7 @@ def transform_images(images_df, target, masker, metadata_df=None, out_dir=None, """ new_images_df = images_df.copy() # Work on a copy of the images_df - valid_targets = {"z", "p", "beta", "varcope"} + valid_targets = {"t", "z", "p", "beta", "varcope"} if target not in valid_targets: raise ValueError( f"Target type {target} not supported. Must be one of: {', '.join(valid_targets)}"