[vtkusers] 3D-position of vtkImageReslice

Xiaofeng Z xf10036 at hotmail.com
Thu Mar 25 17:51:14 EDT 2010


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.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100325/f04e1755/attachment.htm>


More information about the vtkusers mailing list