Skip to content

Commit 20645e0

Browse files
committed
WIP: fix P2PDistance and add tests
1 parent 4c69210 commit 20645e0

File tree

3 files changed

+93141
-0
lines changed

3 files changed

+93141
-0
lines changed

nipype/algorithms/tests/test_auto_P2PDistance.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ def test_P2PDistance_inputs():
66
input_map = dict(ignore_exception=dict(nohash=True,
77
usedefault=True,
88
),
9+
out_file=dict(usedefault=True,
10+
),
911
surface1=dict(mandatory=True,
1012
),
1113
surface2=dict(mandatory=True,
@@ -21,6 +23,7 @@ def test_P2PDistance_inputs():
2123

2224
def test_P2PDistance_outputs():
2325
output_map = dict(distance=dict(),
26+
out_file=dict(),
2427
)
2528
outputs = P2PDistance.output_spec()
2629

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# coding: utf-8
2+
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
3+
# vi: set ft=python sts=4 ts=4 sw=4 et:
4+
5+
import os
6+
from shutil import rmtree
7+
from tempfile import mkdtemp
8+
9+
from nipype.testing import (assert_equal, assert_raises,
10+
assert_almost_equal, example_data)
11+
12+
import numpy as np
13+
import nibabel as nb
14+
import nipype.testing as nit
15+
16+
from nipype.algorithms import mesh as m
17+
18+
19+
def test_distances():
20+
tempdir = mkdtemp()
21+
in_surf = example_data('surf01.vtk')
22+
23+
dist_ident = m.P2PDistance()
24+
dist_ident.inputs.surface1 = in_surf
25+
dist_ident.inputs.surface2 = in_surf
26+
dist_ident.inputs.out_file = os.path.join(tmpdir, 'distance.npy')
27+
res = dist_ident.run()
28+
yield assert_equal, res.outputs.distance, 0.0
29+
30+
dist_ident.inputs.weighting = 'area'
31+
res = dist_ident.run()
32+
yield assert_equal, res.outputs.distance, 0.0
33+
34+
rmtree(tempdir)

0 commit comments

Comments
 (0)