[python-dtcwt] 430/497: registration: improve estimatereg performance
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.
commit efa6ef57d581d1e81a0c6ce30468a35e7484ed97
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Fri Mar 28 13:54:57 2014 +0000
registration: improve estimatereg performance
Instead of broadcasting the Python summation function when summing the
Qtilde matrices, make use of NumPy's far faster in-place summation.
---
dtcwt/registration.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dtcwt/registration.py b/dtcwt/registration.py
index 448c4c9..31ea838 100644
--- a/dtcwt/registration.py
+++ b/dtcwt/registration.py
@@ -364,9 +364,14 @@ def estimatereg(source, reference, regshape=None):
# Warp the levels we'll be looking at with the current best-guess transform
warped = warptransform(source, avecs, levels, method='bilinear')
- qts = np.sum(list(dtcwt.sampling.rescale(_boxfilter(x, 3), avecs.shape[:2], method='nearest')
- for x in qtildematrices(warped, reference, levels)),
- axis=0)
+ # Rescale and sample all the Qtilde matrix results
+ all_qts = qtildematrices(warped, reference, levels)
+ if all_qts is None or len(all_qts) < 1:
+ continue
+
+ qts = np.zeros(avecs.shape[:2] + all_qts[0].shape[2:])
+ for x in all_qts:
+ qts += dtcwt.sampling.rescale(_boxfilter(x, 3), avecs.shape[:2], method='nearest')
avecs += solvetransform(qts)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git
More information about the debian-science-commits
mailing list