[Scipy-svn] r4482 - trunk/scipy/ndimage
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Jun 26 14:49:43 EDT 2008
Author: tom.waite
Date: 2008-06-26 13:49:38 -0500 (Thu, 26 Jun 2008)
New Revision: 4482
Modified:
trunk/scipy/ndimage/_registration.py
Log:
replace parameter vector with inverse affine matrix as input to remap_image method
Modified: trunk/scipy/ndimage/_registration.py
===================================================================
--- trunk/scipy/ndimage/_registration.py 2008-06-25 16:12:15 UTC (rev 4481)
+++ trunk/scipy/ndimage/_registration.py 2008-06-26 18:49:38 UTC (rev 4482)
@@ -1,5 +1,10 @@
+#
+# written by Tom Waite
+# rigid body 3D registration
+#
+
+
import math
-
import numpy as np
from scipy.special import erf
from scipy.ndimage import correlate1d
@@ -84,7 +89,7 @@
return image, M
-def remap_image(image, parm_vector, resample='linear'):
+def remap_image(image, M_inverse, resample='linear'):
"""
remaped_image = remap_image(image, parm_vector, resample='linear')
@@ -97,9 +102,8 @@
image : {ndarray}
image is the source image to be remapped.
- parm_vector : {ndarray}
- parm_vector is the 6-dimensional vector (3 angles, 3 translations)
- generated from the rigid body registration.
+ M_inverse : {ndarray}
+ M_inverse is the 4x4 inverse affine matrix
resample : {'linear', 'cubic'}, optional
@@ -112,17 +116,12 @@
--------
image = fmri_series[i]
x[0:6] = measures[i]['align_rotate'][0:6]
+ M = get_inverse_mappings(x)
# overwrite the fMRI volume with the aligned volume
- fmri_series[i] = remap_image(image, x, resample='cubic')
+ fmri_series[i] = remap_image(image, M, resample='cubic')
"""
- #
- # remap imageG to coordinates of imageF (creates imageG')
- # use the 6 dim parm_vector (3 angles, 3 translations) to remap
- #
- M_inverse = get_inverse_mappings(parm_vector)
-
# allocate the zero image
remaped_image = np.zeros(image.shape, dtype=np.uint8)
@@ -137,6 +136,7 @@
return remaped_image
+
def get_inverse_mappings(parm_vector):
"""
M_inverse = get_inverse_mappings(parm_vector)
More information about the Scipy-svn
mailing list