Skip to content

Commit e7546c3

Browse files
author
dPys
committed
Add test for affine_registration and add interfaces to use for emc
1 parent 3b8cfb8 commit e7546c3

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

dmriprep/utils/tests/test_registration.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,17 @@ def setup_module():
2727
subset_t2_img = nb.Nifti1Image(subset_t2, MNI_T2_affine)
2828

2929

30-
def test_affine_registration():
30+
@pytest.mark.parametrize("nbins", [32, 22])
31+
@pytest.mark.parametrize("sampling_prop", [1, 2])
32+
@pytest.mark.parametrize("metric", ["MI", "CC"])
33+
@pytest.mark.parametrize("level_iters", [[10000, 100], [1]])
34+
@pytest.mark.parametrize("sigmas", [[5.0, 2.5], [0.0]])
35+
@pytest.mark.parametrize("factors", [[4, 2], [1]])
36+
@pytest.mark.parametrize("params0", [np.eye(4), None])
37+
@pytest.mark.parametrize("pipeline", [["rigid"], ["affine"],
38+
["rigid", "affine"]])
39+
def test_affine_registration(nbins, sampling_prop, metric, level_iters,
40+
sigmas, factors, params0, pipeline):
3141
moving = subset_b0
3242
static = subset_b0
3343
moving_affine = static_affine = np.eye(4)
@@ -42,15 +52,8 @@ def test_affine_registration():
4252
# If providing nifti image objects, don't need to provide affines:
4353
moving_img = nb.Nifti1Image(moving, moving_affine)
4454
static_img = nb.Nifti1Image(static, static_affine)
45-
xformed, affine = affine_registration(moving_img, static_img)
46-
npt.assert_almost_equal(affine[:3, :3], np.eye(3), decimal=1)
47-
48-
# Using strings with full paths as inputs also works:
49-
t1_name, b0_name = dpd.get_fnames('syn_data')
50-
moving = b0_name
51-
static = t1_name
52-
xformed, affine = affine_registration(moving, static,
53-
level_iters=[5, 5],
54-
sigmas=[3, 1],
55-
factors=[4, 2])
55+
xformed, affine = affine_registration(moving_img, static_img, nbins,
56+
sampling_prop, metric, pipeline,
57+
level_iters, sigmas, factors,
58+
params0)
5659
npt.assert_almost_equal(affine[:3, :3], np.eye(3), decimal=1)

0 commit comments

Comments
 (0)