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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Evan Edmond
fslpy
Commits
366b0d2d
Commit
366b0d2d
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
TEST: Add srcToRef test
parent
e800b3d1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_transform/test_fnirt.py
+1
-2
1 addition, 2 deletions
tests/test_transform/test_fnirt.py
tests/test_transform/test_nonlinear.py
+30
-0
30 additions, 0 deletions
tests/test_transform/test_nonlinear.py
with
31 additions
and
2 deletions
tests/test_transform/test_fnirt.py
+
1
−
2
View file @
366b0d2d
...
...
@@ -75,9 +75,8 @@ def test_toFnirt():
src
=
fslimage
.
Image
(
op
.
join
(
datadir
,
'
src
'
))
ref
=
fslimage
.
Image
(
op
.
join
(
datadir
,
'
ref
'
))
coef
=
fnirt
.
readFnirt
(
op
.
join
(
datadir
,
'
coefficientfield
'
),
src
,
ref
)
disp
=
fnirt
.
readFnirt
(
op
.
join
(
datadir
,
'
displacementfield
'
),
src
,
ref
)
got
=
fnirt
.
toFnirt
(
coef
)
check
(
got
,
disp
)
check
(
got
,
coef
)
def
test_fromFnirt
():
...
...
This diff is collapsed.
Click to expand it.
tests/test_transform/test_nonlinear.py
+
30
−
0
View file @
366b0d2d
...
...
@@ -310,3 +310,33 @@ def test_coefficientFieldToDisplacementField():
assert
np
.
all
(
np
.
isclose
(
acnv
.
data
,
adf
.
data
,
**
tol
))
assert
np
.
all
(
np
.
isclose
(
rcnvnp
.
data
,
rdfnp
.
data
,
**
tol
))
assert
np
.
all
(
np
.
isclose
(
acnvnp
.
data
,
adfnp
.
data
,
**
tol
))
def
test_DisplacementFIeld_srcToRefMat
():
field1
=
_random_field
()
xform
=
affine
.
compose
(
np
.
random
.
randint
(
1
,
10
,
3
),
np
.
random
.
randint
(
1
,
100
,
3
),
np
.
random
.
random
(
3
)
*
np
.
pi
/
2
)
field2
=
nonlinear
.
DisplacementField
(
field1
.
data
,
xform
=
field1
.
voxToWorldMat
,
src
=
field1
.
src
,
ref
=
field1
.
ref
,
srcToRefMat
=
xform
)
x
=
np
.
random
.
randint
(
0
,
field1
.
shape
[
0
],
100
)
y
=
np
.
random
.
randint
(
0
,
field1
.
shape
[
1
],
100
)
z
=
np
.
random
.
randint
(
0
,
field1
.
shape
[
2
],
100
)
coords
=
np
.
array
([
x
,
y
,
z
]).
T
coords
=
affine
.
transform
(
coords
,
field1
.
ref
.
getAffine
(
'
voxel
'
,
'
fsl
'
))
coordsf1
=
field1
.
transform
(
coords
)
coordsf2
=
field2
.
transform
(
coords
)
coordsf1
=
affine
.
transform
(
coordsf1
,
affine
.
invert
(
xform
))
assert
np
.
all
(
np
.
isclose
(
coordsf1
,
coordsf2
))
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