[vtkusers] vtkImageReslice rotation when not about center of image.

Richard Frank rickfrank at me.com
Tue Oct 25 12:30:24 EDT 2016


Hi


I'm trying to modify the vtkExample to use vtkImageReslice about a point not at the center of the volume.



A link to my code is below, which is the Cxx folder from the Imaging Examples, with modifications to the ImageSlicing sub project.





https://1drv.ms/f/s!AvWAuQy-GUrmgyOyOKmDWSHhZUPk


Also, here is a link to my input data, a small mha file which is easy to see:



https://1drv.ms/u/s!AvWAuQy-GUrmg0YOY0ql2vr1StOU


if you load the file, you will see an axial view. The volume has an origin of (0,0,0). I compute the center of the volume, and then position the actor on that center point (actors are positioned by the center point).


This is analogous to what our application under development does - we position the slice actor in world coordinates using the DICOM Image Position Patient at the top left (depending on orientation) + center offset of the volume.



In my example code, when you load up for the first time and left click, and "rotate" with the mouse, I draw an angle widget for your convenience whose joint is on the center of rotation. I compute the matrix for the rotation, and set that in the reslice matrix, followed by  the origin. This works perfectly, and the slice rotates about its center.



If you right click, you will change the ctr of rotation in world coordinates.
ImageReslice->SetResliceAxesOrigin(rotationCenter[0], rotationCenter[1], rotationCenter[2]);


When you then rotate with left mouse, the angle widget joint is in the correct place in the view but  the the image rotates about a point which I can't quite determine.



The new center of rotation that the reslice uses seem to be proportionally related to how far away from the center of the image that is right clicked on - the closer to the center of the slice clicked, the less the center of rotation moves away from the click.



It seems like there's something I'm missing about how the center of rotation works.



Any help appreciated.





Thanks



Rick




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161025/506f88fd/attachment.html>


More information about the vtkusers mailing list