Description
Summary
FramewiseDisplacement
computes distances between frames at time t and frames at time (t+1). A frame is characterized by 3 degrees of freedom of translations and 3 degrees of freedom of rotations, a frame is thus a 6D vector.
The distance between two successive frames is currently computed as a L1 (weighted) norm of the element-wise difference between frames at (t+1) and frames at t. This does not respect the geometry of the 6D space of frames, which is the space of 3D rigid transformations, also called Special Euclidean group in 3D, or SE(3).
We suggest to compute the distance between two frames using a (weighted) geodesic distance that respects the geometry of the 6D space of frames SE(3), i.e. SE3_GROUP = SpecialEuclideanGroup(n=3)
.
Script/Workflow details
First convert the parameterization of frames given as input to a parameterization understandable by geomstats
.
se3pars = np.hstack(
[mpars[:, DIM_TRANSLATIONS:], mpars[:, :DIM_TRANSLATIONS]])
Construct the metric on the space of frames SE3_GROUP
:
diag_rotations = self.inputs.radius * np.ones(DIM_ROTATIONS)
diag_translations = np.ones(DIM_TRANSLATIONS)
diag = np.concatenate([diag_rotations, diag_translations])
inner_product = np.diag(diag)
metric = InvariantMetric(
group=SE3_GROUP,
inner_product_mat_at_identity=inner_product,
left_or_right='left')
Use the metric to compute the geodesic distance between frames at t+1 and frames at t.
fd_res = metric.dist(se3pars[:-1], se3pars[1:])
Platform details:
Please paste the output of: python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"
{'pkg_path': '/Users/nina/code/nipype/nipype', 'commit_source': 'repository', 'commit_hash': '422fbdd', 'nipype_version': '1.1.0-dev+g422fbdd', 'sys_version': '3.6.5 (default, Mar 30 2018, 06:42:10) \n[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]', 'sys_executable': '/usr/local/opt/python/bin/python3.6', 'sys_platform': 'darwin', 'numpy_version': '1.14.3', 'scipy_version': '0.19.0', 'networkx_version': '2.1', 'nibabel_version': '2.2.1', 'traits_version': '4.6.0'} 1.1.0-dev+g422fbdd
Execution environment
- My python environment outside container