18
18
from nitransforms .base import (
19
19
SurfaceMesh
20
20
)
21
- import nibabel as nb
22
- from scipy .spatial import KDTree
23
- from scipy .spatial .distance import cdist
24
21
25
22
26
23
class SurfaceTransformBase ():
@@ -231,12 +228,11 @@ def __init__(self, reference, moving, interpolation_method='barycentric', mat=No
231
228
# transform
232
229
if mat is None :
233
230
self .__calculate_mat ()
234
- r_tree = KDTree (self .reference ._coords )
235
231
m_tree = KDTree (self .moving ._coords )
236
- kmr_dists , kmr_closest = m_tree .query (self .reference ._coords , k = 10 )
232
+ _ , kmr_closest = m_tree .query (self .reference ._coords , k = 10 )
237
233
238
234
# invert the triangles to generate a lookup table from vertices to triangle index
239
- tri_lut = dict ()
235
+ tri_lut = {}
240
236
for i , idxs in enumerate (self .moving ._triangles ):
241
237
for x in idxs :
242
238
if not x in tri_lut :
@@ -247,7 +243,7 @@ def __init__(self, reference, moving, interpolation_method='barycentric', mat=No
247
243
# calculate the barycentric interpolation weights
248
244
bc_weights = []
249
245
enclosing = []
250
- for sidx , ( point , kmrv ) in enumerate ( zip (self .reference ._coords , kmr_closest ) ):
246
+ for point , kmrv in zip (self .reference ._coords , kmr_closest ):
251
247
close_tris = _find_close_tris (kmrv , tri_lut , self .moving )
252
248
ww , ee = _find_weights (point , close_tris , m_tree )
253
249
bc_weights .append (ww )
0 commit comments