Description
Summary
I've run a subject through both MCFLIRT / SpaceTimeRealign and want to compare the movpars - so I'm using normalize_mc_params
to normalize both to SPM's format.
Actual behavior
MCFLIRT is normalized fine, but when trying nipy's movpar
ValueError Traceback (most recent call last)
<ipython-input-5-bd6ec26d8dba> in <module>()
1 mc1 = normalize_mc_params(mcflirt, 'FSL')
----> 2 mc2 = normalize_mc_params(spacetime, 'NIPY')
/om/user/mathiasg/projects/nipypedev/nipype/nipype/utils/misc.pyc in normalize_mc_params(params, source)
265 elif source.upper() == 'NIPY':
266 from nipy.algorithms.registration import to_matrix44, aff2euler
--> 267 matrix = to_matrix44(params)
268 params = np.zeros(6)
269 params[:3] = matrix[:3, 3]
/om/user/mathiasg/envs/mg_env/lib/python2.7/site-packages/nipy/algorithms/registration/affine.pyc in to_matrix44(t, dtype)
105 size = t.size
106 T = np.eye(4, dtype=dtype)
--> 107 R = rotation_vec2mat(t[3:6])
108 if size == 6:
109 T[0:3, 0:3] = R
/om/user/mathiasg/envs/mg_env/lib/python2.7/site-packages/nipy/algorithms/registration/affine.pyc in rotation_vec2mat(r)
77 elif theta > SMALL_ANGLE:
78 n = r / theta
---> 79 Sn = np.array([[0, -n[2], n[1]], [n[2], 0, -n[0]], [-n[1], n[0], 0]])
80 R = np.eye(3) + np.sin(theta) * Sn\
81 + (1 - np.cos(theta)) * np.dot(Sn, Sn)
ValueError: setting an array element with a sequence.
Expected behavior
both normalize
How to replicate the behavior
from nipype.utils.misc import normalize_mc_params
spacetime = np.genfromtxt('str.movpar.txt')
normalize_mc_params(spacetime, 'NIPY')
Platform details:
{'nibabel_version': '2.1.0', 'sys_executable': '/om/user/mathiasg/envs/mg_env/bin/python', 'networkx_version': '1.11', 'numpy_version': '1.13.1', 'sys_platform': 'linux2', 'sys_version': '2.7.12 | packaged by conda-forge | (default, Sep 8 2016, 14:22:31) \n[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]', 'commit_source': u'repository', 'commit_hash': 'ccacc55', 'pkg_path': '/om/user/mathiasg/projects/nipypedev/nipype/nipype', 'nipype_version': u'1.0.0-dev+gccacc55', 'traits_version': '4.6.0', 'scipy_version': '0.18.1'}
1.0.0-dev+gccacc55
Execution environment
- My python environment outside container
@effigies have you ever encountered this?