1818from nitransforms .base import (
1919 SurfaceMesh
2020)
21- import nibabel as nb
22- from scipy .spatial import KDTree
23- from scipy .spatial .distance import cdist
2421
2522
2623class SurfaceTransformBase ():
@@ -231,12 +228,11 @@ def __init__(self, reference, moving, interpolation_method='barycentric', mat=No
231228 # transform
232229 if mat is None :
233230 self .__calculate_mat ()
234- r_tree = KDTree (self .reference ._coords )
235231 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 )
237233
238234 # invert the triangles to generate a lookup table from vertices to triangle index
239- tri_lut = dict ()
235+ tri_lut = {}
240236 for i , idxs in enumerate (self .moving ._triangles ):
241237 for x in idxs :
242238 if not x in tri_lut :
@@ -247,7 +243,7 @@ def __init__(self, reference, moving, interpolation_method='barycentric', mat=No
247243 # calculate the barycentric interpolation weights
248244 bc_weights = []
249245 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 ):
251247 close_tris = _find_close_tris (kmrv , tri_lut , self .moving )
252248 ww , ee = _find_weights (point , close_tris , m_tree )
253249 bc_weights .append (ww )
0 commit comments