Skip to content

Commit de3b1ac

Browse files
committed
Extend constant field vs ANTs test
1 parent 44fdd7c commit de3b1ac

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nitransforms/tests/test_nonlinear.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,19 @@ def test_constant_field_vs_ants(tmp_path, mat):
343343
mapped = xfm.map(points)
344344

345345
assert np.allclose(mapped, ants_pts, atol=1e-6)
346+
347+
# Verify deformation field generated via NiTransforms matches SimpleITK
348+
csvout2 = tmp_path / "out.csv"
349+
warpfile2 = tmp_path / "const_disp.nii.gz"
350+
ITKDisplacementsField.to_image(nb.Nifti1Image(field, ref_affine, None)).to_filename(
351+
warpfile2
352+
)
353+
354+
check_call(
355+
f"antsApplyTransformsToPoints -d 3 -i {csvin} -o {csvout2} -t {warpfile}",
356+
shell=True,
357+
)
358+
ants_res2 = np.genfromtxt(csvout2, delimiter=",", names=True)
359+
ants_pts2 = np.vstack([ants_res2[n] for n in ("x", "y", "z")]).T
360+
361+
assert np.allclose(ants_pts, ants_pts2, atol=1e-6)

0 commit comments

Comments
 (0)