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
e66d14db
Commit
e66d14db
authored
4 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Check gifti/mesh handling one triangle
parent
72c14d23
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_gifti.py
+18
-0
18 additions, 0 deletions
tests/test_gifti.py
tests/test_mesh.py
+7
-0
7 additions, 0 deletions
tests/test_mesh.py
with
25 additions
and
0 deletions
tests/test_gifti.py
+
18
−
0
View file @
e66d14db
...
@@ -381,3 +381,21 @@ def test_GiftiMesh_needsFixing():
...
@@ -381,3 +381,21 @@ def test_GiftiMesh_needsFixing():
surf
=
gifti
.
GiftiMesh
(
fname
,
fixWinding
=
True
)
surf
=
gifti
.
GiftiMesh
(
fname
,
fixWinding
=
True
)
assert
np
.
all
(
np
.
isclose
(
surf
.
indices
,
idxs_fixed
))
assert
np
.
all
(
np
.
isclose
(
surf
.
indices
,
idxs_fixed
))
def
test_loadGiftiMesh_onetriangle
():
verts
=
np
.
array
([[
0
,
0
,
0
],
[
1
,
1
,
1
],
[
0
,
1
,
0
]])
idxs
=
np
.
array
([[
0
,
1
,
2
]])
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
)
gimg
,
tris
,
verts
,
_
=
gifti
.
loadGiftiMesh
(
'
test.gii
'
)
verts
=
verts
[
0
]
assert
verts
.
shape
==
(
3
,
3
)
assert
tris
.
shape
==
(
1
,
3
)
This diff is collapsed.
Click to expand it.
tests/test_mesh.py
+
7
−
0
View file @
e66d14db
...
@@ -234,6 +234,13 @@ def test_normals():
...
@@ -234,6 +234,13 @@ def test_normals():
-
fnormals
,
fslmesh
.
calcFaceNormals
(
verts
,
triangles_cw
)))
-
fnormals
,
fslmesh
.
calcFaceNormals
(
verts
,
triangles_cw
)))
assert
np
.
all
(
np
.
isclose
(
assert
np
.
all
(
np
.
isclose
(
fnormals
,
fslmesh
.
calcFaceNormals
(
verts
,
triangles_ccw
)))
fnormals
,
fslmesh
.
calcFaceNormals
(
verts
,
triangles_ccw
)))
# Make sure result is (1, 3) for input of (1, 3)
onetri
=
np
.
atleast_2d
(
triangles_ccw
[
0
,
:])
result
=
fslmesh
.
calcFaceNormals
(
verts
,
onetri
)
assert
result
.
shape
==
(
1
,
3
)
assert
np
.
all
(
np
.
isclose
(
fnormals
[
0
,
:],
result
))
assert
np
.
all
(
np
.
isclose
(
assert
np
.
all
(
np
.
isclose
(
-
vnormals
,
fslmesh
.
calcVertexNormals
(
verts
,
triangles_cw
,
-
fnormals
)))
-
vnormals
,
fslmesh
.
calcVertexNormals
(
verts
,
triangles_cw
,
-
fnormals
)))
assert
np
.
all
(
np
.
isclose
(
assert
np
.
all
(
np
.
isclose
(
...
...
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