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
973b4481
Commit
973b4481
authored
4 years ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
TEST: added test for BrainStructure class
parent
4cd6c30b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_cifti.py
+25
-0
25 additions, 0 deletions
tests/test_cifti.py
with
25 additions
and
0 deletions
tests/test_cifti.py
+
25
−
0
View file @
973b4481
...
...
@@ -237,3 +237,28 @@ def test_extract_parcel():
for
idx
in
range
(
1
,
5
):
testing
.
assert_equal
(
surf_data_full
.
T
[
surf_mask
==
idx
,
idx2
],
data
.
arr
[
idx2
,
idx
+
3
])
def
test_brainstructure
():
for
primary
in
[
'
cortex
'
,
'
cerebellum
'
]:
for
secondary
in
[
None
,
'
white
'
,
'
pial
'
]:
for
gtype
in
[
None
,
'
volume
'
,
'
surface
'
]:
for
orientation
in
[
'
left
'
,
'
right
'
,
'
both
'
]:
bst
=
cifti
.
BrainStructure
(
primary
,
secondary
,
orientation
,
gtype
)
print
(
bst
.
cifti
)
assert
bst
.
cifti
==
'
CIFTI_STRUCTURE_%s%s
'
%
(
primary
.
upper
(),
''
if
orientation
==
'
both
'
else
'
_
'
+
orientation
.
upper
())
assert
bst
.
gifti
[
'
AnatomicalStructurePrimary
'
][:
len
(
primary
)]
==
primary
.
capitalize
()
assert
len
(
bst
.
gifti
)
==
(
1
if
secondary
is
None
else
2
)
if
secondary
is
not
None
:
assert
bst
.
gifti
[
'
AnatomicalStructureSecondary
'
]
==
secondary
.
capitalize
()
assert
bst
==
cifti
.
BrainStructure
(
primary
,
secondary
,
orientation
,
gtype
)
assert
bst
==
bst
assert
bst
!=
cifti
.
BrainStructure
(
'
Thalamus
'
,
secondary
,
orientation
,
gtype
)
if
secondary
is
None
:
assert
bst
==
cifti
.
BrainStructure
(
primary
,
'
midplane
'
,
orientation
,
gtype
)
else
:
assert
bst
!=
cifti
.
BrainStructure
(
primary
,
'
midplane
'
,
orientation
,
gtype
)
if
(
gtype
==
'
volume
'
and
primary
==
'
cortex
'
)
or
(
gtype
==
'
surface
'
and
primary
!=
'
cortex
'
):
assert
cifti
.
BrainStructure
.
from_string
(
bst
.
cifti
)
!=
bst
else
:
assert
cifti
.
BrainStructure
.
from_string
(
bst
.
cifti
)
==
bst
assert
cifti
.
BrainStructure
.
from_string
(
bst
.
cifti
).
secondary
is
None
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