[vtkusers] 3D-position of vtkImageReslice

Henning Meyer tutmann at gmail.com
Mon Jun 28 15:46:48 EDT 2010


Hi Xiaofeng,

it's me again with the 3D-Position issue in a vtkImageReslice.
It seems to work great for relative positions like interactions for
translations and stuff.
But when I use it to paint directly into an image, I find, that the
reported position is off in the direction of the viewer. The offset
depends on the scale of the transform.
So for my scale-settings a hack like this works somehow:

point[2] = 0.38; // Hack

But this cannot possibly the solution. Do you have any idea how to
correct for this?

Thank you,

Henning

2010/3/25 Xiaofeng Z <xf10036 at hotmail.com>:
> It took me a day to figure out:
>
> // first convert from display to world in the resliced coordinate
> vtkRenderer& rndr =
> *interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer();
> rndr.SetDisplayPoint(currPos[0], currPos[1], 0);
> rndr.DisplayToWorld();
> double point[4];
> rndr.GetWorldPoint(point);
> // the value in the third component is fake, why???
> point[2] = 0.0;
>
> // next, convert back to the original vtkImageData coordinate system
> vtkImageReslice* reslice = ImageReslice;
> reslice->GetOutput()->UpdateInformation();
> vtkImageData& slice = *reslice->GetOutput();
> vtkMatrix4x4 *matrix = reslice->GetResliceAxes();
> double center[4];
> matrix->MultiplyPoint(point, center);
>
>
> Hope this works!
>
> Xiaofeng Zhao
>
>
>
>> Date: Wed, 24 Mar 2010 16:09:57 -0400
>> From: tutmann at gmail.com
>> To: vtkusers at vtk.org
>> Subject: [vtkusers] 3D-position of vtkImageReslice
>>
>> Hello,
>>
>> I'm building an application based on ImageProcessing/Cxx/ImageSlicing.cxx.
>> Currently I'm on my way of writing my own interactor style in order to
>> have more flexible interaction freedom.
>>
>> Rotation, windowing and zoom works fine - but now I want to move my
>> Volume by dragging the mouse. The movement should be in sync with the
>> mouse motion.
>> Therefore I'd like to find out the real 3D-Position (in the volume) of
>> the EventPosition and the LastEventPosition.
>> But I don't know how to do that. The Display chain is like:
>>
>> vtkImageData -> vtkImageReslice -> vtkImageMapToColors ->
>> vtkImageActor -> vtkRenderer -> vtkViewPort
>>
>>
>> How can I find out the amount of translation that has to be applied to
>> the ResliceAxes-Matrix? (I already have the right direction - am just
>> missing the scaling value of the translation).
>>
>>
>> Thank you for your help!
>>
>> Henning
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>
> ________________________________
> Hotmail is redefining busy with tools for the New Busy. Get more from your
> inbox. Sign up now.



More information about the vtkusers mailing list