Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fslpy
Commits
72c14d23
Commit
72c14d23
authored
Feb 23, 2021
by
Paul McCarthy
🚵
Browse files
TEST: numpy deprecation warnings
parent
a0862c6c
Changes
5
Hide whitespace changes
Inline
Side-by-side
tests/test_atlases_query.py
View file @
72c14d23
...
...
@@ -85,7 +85,7 @@ def _get_zero_mask(aimg):
elif
isinstance
(
aimg
,
fslatlases
.
ProbabilisticAtlas
):
# Keep memory usage down
zmask
=
np
.
ones
(
aimg
.
shape
[:
3
],
dtype
=
np
.
bool
)
zmask
=
np
.
ones
(
aimg
.
shape
[:
3
],
dtype
=
bool
)
for
vol
in
range
(
aimg
.
shape
[
-
1
]):
zmask
=
np
.
logical_and
(
zmask
,
aimg
[...,
vol
]
==
0
)
...
...
tests/test_image_resample.py
View file @
72c14d23
...
...
@@ -75,7 +75,7 @@ def test_resample(seed):
(
np
.
isclose
(
np
.
modf
(
origtestcoords
)[
0
],
0.5
)))
out
=
np
.
any
(
out
,
axis
=
1
)
|
(
resvals
==
0
)
origtestcoords
=
np
.
array
(
origtestcoords
.
round
(),
dtype
=
np
.
int
)
origtestcoords
=
np
.
array
(
origtestcoords
.
round
(),
dtype
=
int
)
origtestcoords
=
origtestcoords
[
~
out
,
:]
restestcoords
=
restestcoords
[
~
out
,
:]
...
...
@@ -166,8 +166,8 @@ def test_resampleToPixdims():
img
=
fslimage
.
Image
(
make_random_image
(
dims
=
(
10
,
10
,
10
)))
imglo
,
imghi
=
affine
.
axisBounds
(
img
.
shape
,
img
.
voxToWorldMat
)
oldpix
=
np
.
array
(
img
.
pixdim
,
dtype
=
np
.
float
)
oldshape
=
np
.
array
(
img
.
shape
,
dtype
=
np
.
float
)
oldpix
=
np
.
array
(
img
.
pixdim
,
dtype
=
float
)
oldshape
=
np
.
array
(
img
.
shape
,
dtype
=
float
)
for
i
,
origin
in
it
.
product
(
range
(
25
),
(
'centre'
,
'corner'
)):
...
...
@@ -215,16 +215,16 @@ def test_resampleToReference2():
# More specific test - output
# data gets transformed correctly
# into reference space
img
=
np
.
zeros
((
5
,
5
,
5
),
dtype
=
np
.
float
)
img
=
np
.
zeros
((
5
,
5
,
5
),
dtype
=
float
)
img
[
1
,
1
,
1
]
=
1
img
=
fslimage
.
Image
(
img
)
refv2w
=
affine
.
scaleOffsetXform
([
1
,
1
,
1
],
[
-
1
,
-
1
,
-
1
])
ref
=
np
.
zeros
((
5
,
5
,
5
),
dtype
=
np
.
float
)
ref
=
np
.
zeros
((
5
,
5
,
5
),
dtype
=
float
)
ref
=
fslimage
.
Image
(
ref
,
xform
=
refv2w
)
res
=
resample
.
resampleToReference
(
img
,
ref
,
order
=
0
)
exp
=
np
.
zeros
((
5
,
5
,
5
),
dtype
=
np
.
float
)
exp
=
np
.
zeros
((
5
,
5
,
5
),
dtype
=
float
)
exp
[
2
,
2
,
2
]
=
1
assert
np
.
all
(
np
.
isclose
(
res
[
0
],
exp
))
...
...
tests/test_imagewrapper.py
View file @
72c14d23
...
...
@@ -1195,7 +1195,7 @@ def test_3D_indexing(shape=None, img=None):
assert
type
(
img
[
0
,
0
,
0
])
==
np
.
float64
mask1
=
np
.
zeros
(
shape
,
dtype
=
np
.
bool
)
mask1
=
np
.
zeros
(
shape
,
dtype
=
bool
)
mask1
[
0
,
0
,
0
]
=
True
mask1
[
1
,
0
,
0
]
=
True
...
...
@@ -1252,7 +1252,7 @@ def test_3D_4D_indexing():
assert
type
(
img
[
0
,
0
,
0
,
0
])
==
np
.
float64
assert
type
(
img
[
0
,
0
,
0
,
:])
==
np
.
float64
mask
=
np
.
zeros
(
padShape
,
dtype
=
np
.
bool
)
mask
=
np
.
zeros
(
padShape
,
dtype
=
bool
)
mask
[
0
,
0
,
0
,
0
]
=
True
assert
type
(
img
[
mask
])
==
np
.
ndarray
...
...
@@ -1282,13 +1282,13 @@ def test_3D_len_one_indexing(shape=None, img=None):
assert
type
(
img
[
0
,
0
])
==
np
.
ndarray
assert
type
(
img
[
0
,
0
,
0
])
==
np
.
float64
mask
=
np
.
zeros
(
shape
[:
2
],
dtype
=
np
.
bool
)
mask
=
np
.
zeros
(
shape
[:
2
],
dtype
=
bool
)
mask
[
0
,
0
]
=
True
assert
type
(
img
[
mask
])
==
np
.
ndarray
assert
img
[
mask
].
shape
==
(
1
,
)
mask
=
np
.
zeros
(
shape
,
dtype
=
np
.
bool
)
mask
=
np
.
zeros
(
shape
,
dtype
=
bool
)
mask
[
0
,
0
,
0
]
=
True
assert
type
(
img
[
mask
])
==
np
.
ndarray
...
...
@@ -1352,7 +1352,7 @@ def test_4D_indexing(shape=None, img=None):
assert
type
(
img
[
0
,
0
,
0
,
0
])
==
np
.
float64
mask1
=
np
.
zeros
(
shape
,
dtype
=
np
.
bool
)
mask1
=
np
.
zeros
(
shape
,
dtype
=
bool
)
mask1
[
0
,
0
,
0
,
0
]
=
True
mask1
[
1
,
0
,
0
,
0
]
=
True
...
...
tests/test_transform/test_affine.py
View file @
72c14d23
...
...
@@ -395,7 +395,7 @@ def test_transform():
mask
=
np
.
array
([[
1
,
0
,
0
,
1
],
[
0
,
1
,
0
,
1
],
[
0
,
0
,
1
,
1
],
[
0
,
0
,
0
,
1
]],
dtype
=
np
.
bool
)
[
0
,
0
,
0
,
1
]],
dtype
=
bool
)
return
np
.
all
((
xform
!=
0
)
==
mask
)
...
...
tests/test_transform/test_nonlinear.py
View file @
72c14d23
...
...
@@ -161,7 +161,7 @@ def test_convertDeformationSpace():
refcoords
=
[
np
.
random
.
randint
(
0
,
basefield
.
shape
[
0
],
5
),
np
.
random
.
randint
(
0
,
basefield
.
shape
[
1
],
5
),
np
.
random
.
randint
(
0
,
basefield
.
shape
[
2
],
5
)]
refcoords
=
np
.
array
(
refcoords
,
dtype
=
np
.
int
).
T
refcoords
=
np
.
array
(
refcoords
,
dtype
=
int
).
T
refcoords
=
affine
.
transform
(
refcoords
,
ref
.
voxToScaledVoxMat
)
srccoords
=
basefield
.
transform
(
refcoords
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment