[vtkusers] using vtkTransform....
Anja Ende
anja.ende at googlemail.com
Fri Sep 22 14:17:03 EDT 2006
Hi everyone,
I am having problems transforming a point using vtkTransform object.
My setup is as follows:
I have 3 orthogonal views in the XY, YZ and XZ planes. I am using 3
vtkImageReslice objects to generate these slices.
Now, I have oblique slicing working which is basically vtkTransform object
with translation and rotation parameters.
Now, what I am trying to do is update the views based on selection on one of
the other views.
Say, someone selected a point (x, y, z) on one of the views... I want to
update the other views so that selected point is visible.
I have tried various approaches:
The first was to use the TranformPoint function in the vtkTransform and get
the corresponding point in the view...
myX = origin[0] + spacing[0] * x;
myY = origin[1] + spacing[1] * y;
myZ = origin[2] + spacing[2] * z;
then,
double * tp = myTransform->TransformPoint(myX, myY, myZ);
Then, convert the points back..
cpX = (tp[0] - origin[0]) / spacing[0];
// same for others
This for some reason does not return the correct values....
I also tried setting the reslice axes of the vtkImageReslice like:
vtkMatrix4x4 tm = myTransform->GetMatrix();
vtkMatrix4x4 sm = mySlicer->GetResliceAxes();
vtkMatrix4x4 * newM = vtkMatrix4x4::New();
vtkMatrix4x4::Multiply4x4(tm, sm, newM);
mySlicer->SetResliceAxes(newM);
This also is off. Also, results varies depending on whether I call
mySlicer->UpdateInformation() here or now...
So, basically given x, y, z in original image data in pixels, I need to map
it to transformed data and locate that point in display coordinates...
I hope someone out there can give me some pointers on this...
Cheers,
Anja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060922/50075229/attachment.htm>
More information about the vtkusers
mailing list