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
caf473a1
Commit
caf473a1
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
ImageWrapper test updates.
parent
a9ff9e33
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
test/test_imagewrapper.py
+40
-3
40 additions, 3 deletions
test/test_imagewrapper.py
with
40 additions
and
3 deletions
test/test_imagewrapper.py
+
40
−
3
View file @
caf473a1
...
@@ -192,6 +192,43 @@ def test_adjustCoverage():
...
@@ -192,6 +192,43 @@ def test_adjustCoverage():
assert
np
.
all
(
imagewrap
.
adjustCoverage
(
coverage
,
expansion
)
==
result
)
assert
np
.
all
(
imagewrap
.
adjustCoverage
(
coverage
,
expansion
)
==
result
)
def
test_sliceOverlap
():
# A bunch of random coverages
for
i
in
range
(
250
):
# 2D, 3D or 4D?
# ndims is the number of dimensions
# in one vector/slice/volume
ndims
=
random
.
choice
((
2
,
3
,
4
))
-
1
# Shape of one vector[2D]/slice[3D]/volume[4D]
shape
=
np
.
random
.
randint
(
5
,
100
,
size
=
ndims
+
1
)
# Number of vectors/slices/volumes
nvols
=
shape
[
-
1
]
coverage
=
random_coverage
(
shape
)
# Generate some slices that should
# be contained within the coverage
for
j
in
range
(
250
):
slices
=
random_slices
(
coverage
,
shape
,
'
in
'
)
assert
imagewrap
.
sliceOverlap
(
slices
,
coverage
)
==
imagewrap
.
OVERLAP_ALL
# Generate some slices that should
# overlap with the coverage
for
j
in
range
(
250
):
slices
=
random_slices
(
coverage
,
shape
,
'
overlap
'
)
assert
imagewrap
.
sliceOverlap
(
slices
,
coverage
)
==
imagewrap
.
OVERLAP_SOME
# Generate some slices that should
# be outside of the coverage
for
j
in
range
(
250
):
slices
=
random_slices
(
coverage
,
shape
,
'
out
'
)
assert
imagewrap
.
sliceOverlap
(
slices
,
coverage
)
==
imagewrap
.
OVERLAP_NONE
def
test_sliceCovered
():
def
test_sliceCovered
():
# A bunch of random coverages
# A bunch of random coverages
...
@@ -214,19 +251,19 @@ def test_sliceCovered():
...
@@ -214,19 +251,19 @@ def test_sliceCovered():
# be contained within the coverage
# be contained within the coverage
for
j
in
range
(
250
):
for
j
in
range
(
250
):
slices
=
random_slices
(
coverage
,
shape
,
'
in
'
)
slices
=
random_slices
(
coverage
,
shape
,
'
in
'
)
assert
imagewrap
.
sliceCovered
(
slices
,
coverage
,
shape
)
assert
imagewrap
.
sliceCovered
(
slices
,
coverage
)
# Generate some slices that should
# Generate some slices that should
# overlap with the coverage
# overlap with the coverage
for
j
in
range
(
250
):
for
j
in
range
(
250
):
slices
=
random_slices
(
coverage
,
shape
,
'
overlap
'
)
slices
=
random_slices
(
coverage
,
shape
,
'
overlap
'
)
assert
not
imagewrap
.
sliceCovered
(
slices
,
coverage
,
shape
)
assert
not
imagewrap
.
sliceCovered
(
slices
,
coverage
)
# Generate some slices that should
# Generate some slices that should
# be outside of the coverage
# be outside of the coverage
for
j
in
range
(
250
):
for
j
in
range
(
250
):
slices
=
random_slices
(
coverage
,
shape
,
'
out
'
)
slices
=
random_slices
(
coverage
,
shape
,
'
out
'
)
assert
not
imagewrap
.
sliceCovered
(
slices
,
coverage
,
shape
)
assert
not
imagewrap
.
sliceCovered
(
slices
,
coverage
)
# The sum of the coverage ranges + the
# The sum of the coverage ranges + the
...
...
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