View Issue Details

IDProjectCategoryView StatusLast Update
0003018Slicer4Core: Base Codepublic2014-03-06 05:54
Reporterimphead Assigned Toalexy  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.2.2-1 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.4.0 
Summary0003018: "Hardening" multiplies matrices in wrong order
Description

I have volume V under matrix M2. Then I decide to tweak the result M2(V), which is displayed on the screen. (When I decide to display V, I of course see M2(V).) I move M2(V) under M1, the tweaking matrix. So now I have in the data module:

+M1
+M2
V

That is: M1(M2(V)). And, I see M1(M2(V)). I decide to harden M2. Then my display changes! I didn't expect that. Here's the reason: the volume V is now under M2', which is now untransformed (free). But M2' is, it turns out, M2 x M1, not M1 x M2. That's why the display changed!

I'd like to think that this is a bug????

Additional Information

The Python code below defines M1 and M2 in a simpler scenario without a volume.

#################################################################
M1 = vtk.vtkMatrix4x4()
M1.DeepCopy([ 1, 0, 0, 0,
0, 0, 1, 0,
0, 1, 0, 0,
0, 0, 0, 1])

M2 = vtk.vtkMatrix4x4()
M2.DeepCopy([1, 0, 0, 0,
0, 1, 0, 0,
0, 1, 0, 0,
0, 0, 0, 1])

M1xM2 = vtk.vtkMatrix4x4()
vtk.vtkMatrix4x4.Multiply4x4(M1, M2, M1xM2)
print "M1xM2", M1xM2

1 0 0 0

0 1 0 0

0 1 0 0

0 0 0 1

M2xM1 = vtk.vtkMatrix4x4()
vtk.vtkMatrix4x4.Multiply4x4(M2, M1, M2xM1)
print "M2xM1", M2xM1

1 0 0 0

0 0 1 0

0 0 1 0

0 0 0 1

M1ltn = slicer.vtkMRMLLinearTransformNode()
M1ltn.SetName('M1')
slicer.mrmlScene.AddNode(M1ltn)
M1ltn.SetAndObserveMatrixTransformToParent(M1)

M2ltn = slicer.vtkMRMLLinearTransformNode()
M2ltn.SetName('M2')
slicer.mrmlScene.AddNode(M2ltn)
M2ltn.SetAndObserveMatrixTransformToParent(M2)

In Slicer:

(1) Drag M2 under M1 in Data editor (or use Transforms module).

(2) Harden M2, so as to bake left multiplication with M1 onto M2

(3) Now M2 is M2 x M1, which is incorrect (?). It should be M1 x M2.

TagsNo tags attached.

Activities

jcfr

jcfr

2013-03-19 10:23

administrator   ~0008149

Will be discussed during March 19th 2013 Developer Hangout. See http://www.slicer.org/slicerWiki/index.php/Developer_Meetings/20130319

alexy

alexy

2013-08-09 11:51

developer   ~0009445

JC, do you have a record of the result of the discussion?

jcfr

jcfr

2013-08-15 09:52

administrator   ~0009476

Reminder sent to: alexey, pieper

@Alex: ... no notes have been written done for that hangout.

@Steve: By any chance, do you recall the details ... ?

@Jc: Hangout conclusion matters ...

alexy

alexy

2013-08-16 07:13

developer   ~0009486

I verified that hardening of one transform in a hierarchy changes the display, and indeed the matrix multiplication order is incorrect.

Fixed matrix multiplication order in vtkMRMLLinearTransformNode::ApplyTransformMatrix()
At revision: 22290

jcfr

jcfr

2014-03-06 05:22

administrator   ~0011169

Closing resolved issues that have not been updated in more than 3 months

Issue History

Date Modified Username Field Change
2013-03-16 20:17 imphead New Issue
2013-03-16 20:17 imphead Status new => assigned
2013-03-16 20:17 imphead Assigned To => jcfr
2013-03-19 10:23 jcfr Note Added: 0008149
2013-03-19 12:19 jcfr Assigned To jcfr => alexy
2013-03-19 12:20 jcfr Target Version => Slicer 4.3.0
2013-03-19 12:20 jcfr Additional Information Updated
2013-08-09 11:51 alexy Note Added: 0009445
2013-08-15 09:52 jcfr Note Added: 0009476
2013-08-16 07:13 alexy Note Added: 0009486
2013-08-16 07:13 alexy Status assigned => resolved
2013-08-16 07:13 alexy Resolution open => fixed
2014-03-06 05:22 jcfr Note Added: 0011169
2014-03-06 05:23 jcfr Status resolved => closed
2014-03-06 05:54 jcfr Fixed in Version => Slicer 4.4.0