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
8979cc26
Commit
8979cc26
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Unit test for find method
parent
2263243c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_atlases.py
+32
-0
32 additions, 0 deletions
tests/test_atlases.py
with
32 additions
and
0 deletions
tests/test_atlases.py
+
32
−
0
View file @
8979cc26
...
...
@@ -227,6 +227,38 @@ def test_load_atlas():
assert
isinstance
(
lblatlas
,
atlases
.
LabelAtlas
)
def
test_find
():
reg
=
atlases
.
registry
reg
.
rescanAtlases
probatlas
=
reg
.
loadAtlas
(
'
harvardoxford-cortical
'
)
probsumatlas
=
reg
.
loadAtlas
(
'
harvardoxford-cortical
'
,
loadSummary
=
True
)
lblatlas
=
reg
.
loadAtlas
(
'
talairach
'
)
for
atlas
in
[
probatlas
,
probsumatlas
,
lblatlas
]:
labels
=
atlas
.
desc
.
labels
for
label
in
labels
:
assert
atlas
.
find
(
value
=
label
.
value
)
==
label
assert
atlas
.
find
(
index
=
label
.
index
)
==
label
assert
atlas
.
desc
.
find
(
value
=
label
.
value
)
==
label
assert
atlas
.
desc
.
find
(
index
=
label
.
index
)
==
label
with
pytest
.
raises
(
ValueError
):
atlas
.
find
()
with
pytest
.
raises
(
ValueError
):
atlas
.
find
(
index
=
1
,
value
=
1
)
with
pytest
.
raises
(
IndexError
):
atlas
.
find
(
index
=
len
(
labels
))
maxval
=
max
([
l
.
value
for
l
in
labels
])
with
pytest
.
raises
(
KeyError
):
atlas
.
find
(
value
=
maxval
+
1
)
def
test_label_atlas_coord
():
reg
=
atlases
.
registry
reg
.
rescanAtlases
()
...
...
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