forked from netneurolab/neuromaps
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_surface_sphere_project_unproject.py
More file actions
53 lines (45 loc) · 2.17 KB
/
test_surface_sphere_project_unproject.py
File metadata and controls
53 lines (45 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pytest
import os
from pathlib import Path
from styxdefs import set_global_runner
from styxsingularity import SingularityRunner
from niwrap import workbench as wb
import nibabel as nib
from neuromaps.neuromaps_nhp_utils.surface_sphere_project_unproject import surface_sphere_project_unproject
my_runner = SingularityRunner(
images={"brainlife/connectome_workbench:1.5.0-freesurfer-update": "/home/bshrestha/projects/Tfunck/neuromaps.sif"}
)
data_dir = Path("/home/bshrestha/projects/Tfunck/neuromaps-nhp/.temp-niwrap-data").resolve()
my_runner.data_dir = data_dir
set_global_runner(my_runner)
@pytest.mark.parametrize(
"sphere_in,sphere_project_to,sphere_unproject_from,sphere_out",
[
(
str(Path("/home/bshrestha/projects/Tfunck/neuromaps-nhp-prep/share/Outputs/Yerkes19-S1200/src-S1200_to-Yerkes19_den-32k_hemi-L_sphere.surf.gii")),
str(Path("/home/bshrestha/projects/Tfunck/neuromaps-nhp-prep/share/Inputs/Yerkes19/src-Yerkes19_den-32k_hemi-L_sphere.surf.gii")),
str(Path("/home/bshrestha/projects/Tfunck/neuromaps-nhp-prep/share/Outputs/D99-Yerkes19/src-Yerkes19_to-D99_den-32k_hemi-L_sphere.surf.gii")),
str(data_dir / "out_sphere.surf.gii"),
),
# Add more tuples here for additional test cases
]
)
def test_surface_sphere_project_unproject(sphere_in, sphere_project_to, sphere_unproject_from, sphere_out):
"""
Test surface_sphere_project_unproject wrapper function.
== Example ==
------------------------
S1200 to Yerkes19 to D99
------------------------
sphere_in = S1200_aligned_t-_Yerkes19 (Input)
project_to_sphere = Yerkes19 (Intermediate)
unproject_from_sphere = Yerkes19_to_D99 (Target)
out_sphere = str(Path(f"{data_dir}/out_sphere.surf.gii").resolve())
------------------------
"""
result = surface_sphere_project_unproject(
sphere_in, sphere_project_to, sphere_unproject_from, sphere_out
)
assert os.path.exists(result)
# check if the output file has the same number of vertices as the input file
assert nib.load(result).darrays[0].data.shape == nib.load(sphere_in).darrays[0].data.shape