Skip to content

Commit afa3af3

Browse files
authored
Merge pull request #94 from rmarkello/ptov_float
[REF] Allow integer inputs in `freesurfer.parcels_to_vertices()`
2 parents a2ea2cf + 3ffb803 commit afa3af3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

netneurotools/freesurfer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def parcels_to_vertices(data, *, lhannot, rhannot, drop=None):
271271
drop = FSIGNORE
272272
drop = _decode_list(drop)
273273

274-
data = np.vstack(data)
274+
data = np.vstack(data).astype(float)
275275

276276
# check this so we're not unduly surprised by anything...
277277
n_vert = expected = 0

netneurotools/tests/test_freesurfer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ def test_project_reduce_vertices(cammoun_surf, scale, parcels):
6767
reduced = freesurfer.vertices_to_parcels(projected, rhannot=rh, lhannot=lh)
6868
assert np.allclose(data, reduced)
6969

70+
# what about int arrays as input?
71+
data = np.random.choice(10, size=parcels)
72+
projected = freesurfer.parcels_to_vertices(data, rhannot=rh, lhannot=lh)
73+
reduced = freesurfer.vertices_to_parcels(projected, rhannot=rh, lhannot=lh)
74+
assert np.allclose(reduced, data)
75+
7076
# number of parcels != annotation spec
7177
with pytest.raises(ValueError):
7278
freesurfer.parcels_to_vertices(np.random.rand(parcels + 1),

0 commit comments

Comments
 (0)