Skip to content
Snippets Groups Projects
Commit 4f01312c authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

TEST: Test fixWinding argument for Mesh and GiftiMesh

parent 397cc6eb
No related branches found
No related tags found
No related merge requests found
......@@ -299,3 +299,23 @@ def test_GiftiMesh_multiple_vertices():
surf.vertices = expvsets[1]
assert np.all(surf.vertices == TEST_VERTS * 5)
def test_GiftiMesh_needsFixing():
from . import test_mesh
verts = test_mesh.CUBE_VERTICES
idxs = test_mesh.CUBE_TRIANGLES_CW
idxs_fixed = test_mesh.CUBE_TRIANGLES_CCW
verts = nib.gifti.GiftiDataArray(verts, intent='NIFTI_INTENT_POINTSET')
idxs = nib.gifti.GiftiDataArray(idxs, intent='NIFTI_INTENT_TRIANGLE')
gimg = nib.gifti.GiftiImage(darrays=[verts, idxs])
with tempdir():
fname = op.abspath('test.gii')
gimg.to_filename(fname)
surf = gifti.GiftiMesh(fname, fixWinding=True)
assert np.all(np.isclose(surf.indices, idxs_fixed))
......@@ -248,9 +248,11 @@ def test_needsFixing():
fnormals = np.array(CUBE_CCW_VERTEX_NORMALS)
blo = verts.min(axis=0)
bhi = verts.max(axis=0)
mesh = fslmesh.Mesh(tris_cw, vertices=verts, fixWinding=True)
assert not fslmesh.needsFixing(verts, tris_ccw, fnormals, blo, bhi)
assert fslmesh.needsFixing(verts, tris_cw, -fnormals, blo, bhi)
assert np.all(np.isclose(mesh.indices, tris_ccw))
def test_trimesh_no_trimesh():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment