17
17
from functools import reduce
18
18
19
19
import numpy as np
20
- from numpy import dot
21
20
22
21
from .io import read_fiducials , write_fiducials , read_info
23
22
from .io .constants import FIFF
@@ -288,7 +287,7 @@ def _trans_from_params(param_info, params):
288
287
x , y , z = params [i :i + 3 ]
289
288
trans .append (scaling (x , y , z ))
290
289
291
- trans = reduce (dot , trans )
290
+ trans = reduce (np . dot , trans )
292
291
return trans
293
292
294
293
@@ -362,7 +361,7 @@ def fit_matched_points(src_pts, tgt_pts, rotate=True, translate=True,
362
361
def error (x ):
363
362
rx , ry , rz = x
364
363
trans = rotation3d (rx , ry , rz )
365
- est = dot (src_pts , trans .T )
364
+ est = np . dot (src_pts , trans .T )
366
365
d = tgt_pts - est
367
366
if weights is not None :
368
367
d *= weights
@@ -372,8 +371,8 @@ def error(x):
372
371
elif param_info == (True , True , 0 ):
373
372
def error (x ):
374
373
rx , ry , rz , tx , ty , tz = x
375
- trans = dot (translation (tx , ty , tz ), rotation (rx , ry , rz ))
376
- est = dot (src_pts , trans .T )[:, :3 ]
374
+ trans = np . dot (translation (tx , ty , tz ), rotation (rx , ry , rz ))
375
+ est = np . dot (src_pts , trans .T )[:, :3 ]
377
376
d = tgt_pts - est
378
377
if weights is not None :
379
378
d *= weights
@@ -383,9 +382,10 @@ def error(x):
383
382
elif param_info == (True , True , 1 ):
384
383
def error (x ):
385
384
rx , ry , rz , tx , ty , tz , s = x
386
- trans = reduce (dot , (translation (tx , ty , tz ), rotation (rx , ry , rz ),
387
- scaling (s , s , s )))
388
- est = dot (src_pts , trans .T )[:, :3 ]
385
+ trans = reduce (np .dot , (translation (tx , ty , tz ),
386
+ rotation (rx , ry , rz ),
387
+ scaling (s , s , s )))
388
+ est = np .dot (src_pts , trans .T )[:, :3 ]
389
389
d = tgt_pts - est
390
390
if weights is not None :
391
391
d *= weights
@@ -395,9 +395,10 @@ def error(x):
395
395
elif param_info == (True , True , 3 ):
396
396
def error (x ):
397
397
rx , ry , rz , tx , ty , tz , sx , sy , sz = x
398
- trans = reduce (dot , (translation (tx , ty , tz ), rotation (rx , ry , rz ),
399
- scaling (sx , sy , sz )))
400
- est = dot (src_pts , trans .T )[:, :3 ]
398
+ trans = reduce (np .dot , (translation (tx , ty , tz ),
399
+ rotation (rx , ry , rz ),
400
+ scaling (sx , sy , sz )))
401
+ est = np .dot (src_pts , trans .T )[:, :3 ]
401
402
d = tgt_pts - est
402
403
if weights is not None :
403
404
d *= weights
@@ -419,7 +420,7 @@ def error(x):
419
420
if tol is not None :
420
421
if not translate :
421
422
src_pts = np .hstack ((src_pts , np .ones ((len (src_pts ), 1 ))))
422
- est_pts = dot (src_pts , trans .T )[:, :3 ]
423
+ est_pts = np . dot (src_pts , trans .T )[:, :3 ]
423
424
err = np .sqrt (np .sum ((est_pts - tgt_pts ) ** 2 , axis = 1 ))
424
425
if np .any (err > tol ):
425
426
raise RuntimeError ("Error exceeds tolerance. Error = %r" % err )
0 commit comments