using vtkTransform....

View: New views
5 Messages — Rating Filter:   Alert me  

using vtkTransform....

by Anja Ende :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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




_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

Re: using vtkTransform....

by Anja Ende :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Forgot to mention...

I am using the index matrix in the vtkImageReslice class to do the input->output mapping and vice versa (by using the inverse of the matrix).

Anja

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

Re: Re: using vtkTransform....

by David Gobbi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I should point out that the IndexMatrix is not a public member of the
class... and if you have a special version of vtkImageReslice that makes
this member public, you are using vtkImageReslice in a way that other
people don't.

Why not just use the ResliceTransform and ResliceMatrix?

 - David



Anja Ende wrote:

> Forgot to mention...
>
> I am using the index matrix in the vtkImageReslice class to do the
> input->output mapping and vice versa (by using the inverse of the
> matrix).
>
> Anja
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>  

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

Re: Re: using vtkTransform....

by Anja Ende :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, I, unfortunately, could not get any other way to work... As I said, I am trying to get the TransformPoints method to work, but with little success so far.

Could you point an example as to how to use the ResliceTransform and the ResliceMatrix??

Cheers and thanks,

Anja

On 22/09/06, David Gobbi <dgobbi@...> wrote:
I should point out that the IndexMatrix is not a public member of the
class... and if you have a special version of vtkImageReslice that makes
this member public, you are using vtkImageReslice in a way that other
people don't.

Why not just use the ResliceTransform and ResliceMatrix?

- David



Anja Ende wrote:

> Forgot to mention...
>
> I am using the index matrix in the vtkImageReslice class to do the
> input->output mapping and vice versa (by using the inverse of the
> matrix).
>
> Anja
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

Re: using vtkTransform....

by superzz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello
Have you tried whether index matrix works fine when AutoCrop is set to ON?

Thanks!

superZZ

Anja Ende wrote:
Forgot to mention...

I am using the index matrix in the vtkImageReslice class to do the
input->output mapping and vice versa (by using the inverse of the matrix).

Anja

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers