Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
4f01312c
Commit
4f01312c
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test fixWinding argument for Mesh and GiftiMesh
parent
397cc6eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_gifti.py
+20
-0
20 additions, 0 deletions
tests/test_gifti.py
tests/test_mesh.py
+2
-0
2 additions, 0 deletions
tests/test_mesh.py
with
22 additions
and
0 deletions
tests/test_gifti.py
+
20
−
0
View file @
4f01312c
...
...
@@ -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
))
This diff is collapsed.
Click to expand it.
tests/test_mesh.py
+
2
−
0
View file @
4f01312c
...
...
@@ -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
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment