Import 2017-06-07 23:51:09: master a8cbe3d7

Author Committer Branch Timestamp Parent
jcfr jcfr master 2015-11-02 23:52:00 master 47845216
Affected Issues 0004073: BSpline-linear composite transform becomes inconsitent when split and edited
Changeset

BUG: Fixed transform splitting. Fixes 0004073

Fixes https://www.na-mic.org/Mantis/view.php?id=4073

Problem was that when a composite transform contained an inverse
linear transform, the inverse transform was used as transformToParent.
When transformToParent was later modified by the transform sliders on
the GUI, transformToParent was updated, but transformFromParent was
unchanged.

Script to reproduce the issue:

t1=vtk.vtkTransform()
m1=vtk.vtkMatrix4x4()
m1.SetElement(0,3,15)
t1.SetMatrix(m1)
t2=t1.GetInverse()
print t1.GetMatrix()
print t1.GetInverseFlag()
print t2.GetMatrix() # this is required, otherwise the behavior will not be inconsistent
print t2.GetInverseFlag()
t2.Inverse() # editing the inverse transform
print t1.GetMatrix() # returns ... 15 ...
print t1.GetInverseFlag() # returns 0
print t2.GetMatrix() # returns ... 15 ...
print t2.GetInverseFlag() # returns 0
0 on both and the matrix values are the same.

It seems that if a computed inverse transform is modified then the
transform pipeline becomes inconsistent. It may be the expected behavior
in VTK, one should simply never modify a computed transform. I'll confirm
this with David Gobbi.

The solution was to always set the forward transform in the node so that
when it is modified, it updates the inverse transform as well.

Tested-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>

From: Andras Lasso <lasso@queensu.ca>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24688 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Libs/MRML/Core/Testing/NonLinearTransformScene.mrml Diff File
add - Libs/MRML/Core/Testing/TestData/BSplineLinearCompositeTransform.h5 Diff File
mod - Libs/MRML/Core/Testing/vtkMRMLNonlinearTransformNodeTest1.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLTransformNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLTransformNode.h Diff File