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
6e33e589
Commit
6e33e589
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Test ImageWrapper with a 1D image
parent
9a30c50e
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_imagewrapper.py
+22
-4
22 additions, 4 deletions
tests/test_imagewrapper.py
with
22 additions
and
4 deletions
tests/test_imagewrapper.py
+
22
−
4
View file @
6e33e589
...
...
@@ -1173,8 +1173,10 @@ def test_3D_indexing(shape=None, img=None):
# Test that a 3D image looks like a 3D image
if
shape
is
None
:
shape
=
(
21
,
22
,
23
)
elif
len
(
shape
)
==
2
:
shape
=
tuple
(
list
(
shape
)
+
[
1
])
if
shape
is
None
:
shape
=
(
21
,
22
,
23
)
elif
len
(
shape
)
<
3
:
shape
=
tuple
(
list
(
shape
)
+
[
1
]
*
(
3
-
len
(
shape
)))
if
img
is
None
:
data
=
np
.
random
.
random
(
shape
)
...
...
@@ -1264,8 +1266,10 @@ def test_3D_len_one_indexing(shape=None, img=None):
# look like a 3D image, but should still
# accept (valid) 2D slicing.
if
shape
is
None
:
shape
=
(
20
,
20
,
1
)
elif
len
(
shape
)
<
3
:
shape
=
tuple
(
list
(
shape
)
+
[
1
])
if
shape
is
None
:
shape
=
(
20
,
20
,
1
)
elif
len
(
shape
)
<
3
:
shape
=
tuple
(
list
(
shape
)
+
[
1
]
*
(
3
-
len
(
shape
)))
if
img
is
None
:
data
=
np
.
random
.
random
(
shape
)
...
...
@@ -1305,6 +1309,20 @@ def test_2D_indexing():
test_3D_len_one_indexing
(
shape
,
img
)
def
test_1D_indexing
():
# Testing ImageWrapper for a 1D image -
# it should look just like a 3D image
# (the same as is tested above).
shape
=
(
20
,)
data
=
np
.
random
.
random
(
shape
)
nibImg
=
nib
.
Nifti1Image
(
data
,
np
.
eye
(
4
))
img
=
imagewrap
.
ImageWrapper
(
nibImg
,
loadData
=
True
)
test_3D_len_one_indexing
(
shape
,
img
)
def
test_4D_indexing
(
shape
=
None
,
img
=
None
):
if
shape
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