[vtkusers] 3D-position of vtkImageReslice
tutmann at gmail.com
Mon Jun 28 15:46:48 EDT 2010
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 = 0.38; // Hack
But this cannot possibly the solution. Do you have any idea how to
correct for this?
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 =
> rndr.SetDisplayPoint(currPos, currPos, 0);
> double point;
> // the value in the third component is fake, why???
> point = 0.0;
> // next, convert back to the original vtkImageData coordinate system
> vtkImageReslice* reslice = ImageReslice;
> vtkImageData& slice = *reslice->GetOutput();
> vtkMatrix4x4 *matrix = reslice->GetResliceAxes();
> double center;
> 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
>> 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!
>> Powered by www.kitware.com
>> Visit other Kitware open-source projects at
>> Please keep messages on-topic and check the VTK FAQ at:
>> Follow this link to subscribe/unsubscribe:
> Hotmail is redefining busy with tools for the New Busy. Get more from your
> inbox. Sign up now.
More information about the vtkusers