WG: [vtkusers] vtkTransform and SetMatrix...

Michael Knopke Michael.Knopke at gmx.de
Tue Oct 2 12:10:32 EDT 2007


 

Hi,

I just tried explicitly setting a 4x4Matrix for an vtkTransform-object,
which has NO effect at all. Can anybody explain why this is?

 

SampleCode:

 

// create vtkTransform

 

vtkTransform *myTransform = vtkTransform::New();

// rotate it a bit

myTransform->RotateX(90);

 

//create matrix

vtkMatrix4x4 = inputMatrix = vtkMatrix4x4::New();

   inputMatrix->SetElement(0,0,1);

   inputMatrix->SetElement(0,1,0);

   inputMatrix->SetElement(0,2,0);

   inputMatrix->SetElement(0,3,0);

   inputMatrix->SetElement(1,0,0);

   inputMatrix->SetElement(1,1,1);

   inputMatrix->SetElement(1,2,0);

   inputMatrix->SetElement(1,3,0);

   inputMatrix->SetElement(2,0,0);

   inputMatrix->SetElement(2,1,0);

   inputMatrix->SetElement(2,2,1);

   inputMatrix->SetElement(2,3,0);

   inputMatrix->SetElement(3,0,0);

   inputMatrix->SetElement(3,1,0);

   inputMatrix->SetElement(3,2,0);

   inputMatrix->SetElement(3,3,1);

   inputMatrix->Update();

   

myTransform->SetMatrix(inputMatrix);

myTransform->Update();

 

// now feeding it to ImageReslice.

.

imageReslice->SetResliceTransform(myTransform);

.

 

Yields always the same rotated image, independent what elements I use?! How
come?

 

Thanks for some suggestions.

 

Btw: Am I right to think that the elements of a 4x4 matrix are directly
correlated to direction cosines? (so first column = x, second = y, third =
z, where the last element of each col always belongs to homogeneous cords,)?

 

Michael

 

 

PS: I know that I can set the direction cosines in imageReslice directly,
that works, but I need it this way.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071002/f103606b/attachment.htm>


More information about the vtkusers mailing list