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
fsleyes
fsleyes
Commits
ef47ef6a
Commit
ef47ef6a
authored
Sep 10, 2021
by
Paul McCarthy
🚵
Browse files
TEST: Basic unit tests for displayspace
parent
8e5f712a
Changes
11
Hide whitespace changes
Inline
Side-by-side
fsleyes/tests/__init__.py
View file @
ef47ef6a
...
...
@@ -32,6 +32,7 @@ import matplotlib.image as mplimg
import
fsleyes_props
as
props
from
fsl.utils.tempdir
import
tempdir
import
fsl.utils.idle
as
idle
import
fsl.utils.image.resample
as
resample
import
fsl.transform.affine
as
affine
import
fsl.data.image
as
fslimage
import
fsleyes
...
...
@@ -693,6 +694,18 @@ def roi(fname, roi):
return
outfile
def
resampled
(
fname
,
fac
):
base
=
fslimage
.
removeExt
(
op
.
basename
(
fname
))
outfile
=
'{}_resampled_{}'
.
format
(
base
,
fac
)
img
=
fslimage
.
Image
(
fname
)
pix
=
np
.
array
(
img
.
pixdim
[:
3
])
*
fac
data
,
xform
=
resample
.
resampleToPixdims
(
img
,
pix
)
fslimage
.
Image
(
data
,
header
=
img
.
header
,
xform
=
xform
).
save
(
outfile
)
return
outfile
def
asrgb
(
infile
):
basename
=
fslimage
.
removeExt
(
op
.
basename
(
infile
))
outfile
=
'{}_asrgb.nii.gz'
.
format
(
basename
)
...
...
fsleyes/tests/test_displayspace.py
0 → 100644
View file @
ef47ef6a
#!/usr/bin/env python
#
# test_displayspace.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
pytest
from
fsleyes.tests
import
run_cli_tests
,
resampled
,
roi
,
rotate
pytestmark
=
pytest
.
mark
.
clitest
tests
=
"""
-vl 10 8 8 -o 0 3d {{roi('3d', (8, 13, 6, 10, 6, 10))}} -cm red-yellow
-vl 10 8 8 -o 0 3d {{resampled(roi('3d', (8, 13, 6, 10, 6, 10)), 0.5)}} -cm red-yellow
-ds scaledVoxel -vl 0 0 0 -o 0 3d {{roi('3d', (8, 13, 6, 10, 6, 10))}} -cm red-yellow
-ds scaledVoxel -vl 0 0 0 -o 0 3d {{resampled(roi('3d', (8, 13, 6, 10, 6, 10)), 0.5)}} -cm red-yellow
3d {{rotate('3d', 20, 20, 20)}} -cm red-yellow -a 50
-ds 3d 3d {{rotate('3d', 20, 20, 20)}} -cm red-yellow -a 50
-ds 3d_rotated_20_20_20 3d {{rotate('3d', 20, 20, 20)}} -cm red-yellow -a 50
-ds world 3d {{rotate('3d', 20, 20, 20)}} -cm red-yellow -a 50
-ds scaledVoxel 3d {{rotate('3d', 20, 20, 20)}} -cm red-yellow -a 50
"""
def
test_displayspace
():
extras
=
{
'roi'
:
roi
,
'resampled'
:
resampled
,
'rotate'
:
rotate
}
run_cli_tests
(
'test_displayspace'
,
tests
,
extras
=
extras
)
fsleyes/tests/testdata/cli_tests/test_displayspace_-ds_3d_3d_3d_rotated_20_20_20.nii.gz_-cm_red-yellow_-a_50.png
0 → 100644
View file @
ef47ef6a
27.2 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-ds_3d_rotated_20_20_20_3d_3d_rotated_20_20_20.nii.gz_-cm_red-yellow_-a_50.png
0 → 100644
View file @
ef47ef6a
31.4 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-ds_scaledVoxel_-vl_0_0_0_-o_0_3d_3d_roi_8_13_6_10_6_10_-cm_red-yellow.png
0 → 100644
View file @
ef47ef6a
11 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-ds_scaledVoxel_-vl_0_0_0_-o_0_3d_3d_roi_8_13_6_10_6_10_resampled_0.5_-cm_red-yellow.png
0 → 100644
View file @
ef47ef6a
11.5 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-ds_scaledVoxel_3d_3d_rotated_20_20_20.nii.gz_-cm_red-yellow_-a_50.png
0 → 100644
View file @
ef47ef6a
13.2 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-ds_world_3d_3d_rotated_20_20_20.nii.gz_-cm_red-yellow_-a_50.png
0 → 100644
View file @
ef47ef6a
27.2 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-vl_10_8_8_-o_0_3d_3d_roi_8_13_6_10_6_10_-cm_red-yellow.png
0 → 100644
View file @
ef47ef6a
7.29 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_-vl_10_8_8_-o_0_3d_3d_roi_8_13_6_10_6_10_resampled_0.5_-cm_red-yellow.png
0 → 100644
View file @
ef47ef6a
7.96 KB
fsleyes/tests/testdata/cli_tests/test_displayspace_3d_3d_rotated_20_20_20.nii.gz_-cm_red-yellow_-a_50.png
0 → 100644
View file @
ef47ef6a
27.2 KB
Write
Preview
Markdown
is supported
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