diff --git a/AFQ/tests/test_definitions.py b/AFQ/tests/test_definitions.py index de1f774b..65c66aed 100644 --- a/AFQ/tests/test_definitions.py +++ b/AFQ/tests/test_definitions.py @@ -9,6 +9,7 @@ from AFQ.definitions.image import * # interprets images from eval from AFQ.definitions.mapping import * # interprets mappings from eval from AFQ.tests.test_api import create_dummy_bids_path +from AFQ.definitions.utils import name_from_path def test_str_instantiates_mixin(): @@ -23,6 +24,15 @@ def test_str_instantiates_mixin(): thresh_image_from_str.upper_bound) +def test_name_from_path(): + path = "/data/sub-01/ses-01/dwi/sub-01_ses-01_desc-icvf_dwi.nii.gz" + assert name_from_path(path) == "icvf" + path = "/data/sub-01/ses-01/dwi/sub-01_ses-01_desc-od_dwi.nii.gz" + assert name_from_path(path) == "od" + path = "/data/sub-01/ses-01/anat/sub-01_ses-01_T1w.nii.gz" + assert name_from_path(path) == "T1w" + + def test_resample_image(): image_data = np.zeros((2, 2, 2), dtype=bool) image_data[0] = True