[vtkusers] vtkImagePlaneWidget UserMatrix?
John McManigle
mcmanigle at gmail.com
Wed Apr 10 17:32:30 EDT 2013
Hi all,
I'll give the short question and then the "what I'm trying to do" in
case there's a better way.
Short version: I have a system of three intersecting ImagePlaneWidgets
displaying a 3d image (vtkImageData). I'd like to take the whole
PlaneWidget system and apply an affine transform to them (ie without
resampling pixel data). Effectively, I want the equivalent of
SetUserMatrix for a vtkProp3D subclass.
What I've tried, with partial success, is to modify
vtkImagePlaneWidget to add a "SetUserMatrix" function that calls
SetUserMatrix on its actor members. This results in proper display of
the three planes, but mouse inputs are (predictably) not transformed
accordingly, so the resulting system is pretty hard to work with. Is
there a way to similarly transform mouse input?
Long version: Effectively this is all in order to do a
point-cloud-to-image registration. I have a series of (x,y,z) points,
and a distance map. The distance map is a DICOM image which I process
a bit with ITK and then convert to a vtkImageData. If you don't know,
ITK images have origin (point in real space where the image index
0,0,0 lives), spacing (distance from origin to (1,0,0), (0,1,0), and
(0,0,1)), and direction (direction of image axes in terms of "global"
axes). To the best of my understanding, image "direction" is
something vtk doesn't have in this way.
I am doing my registration in "global" coordinates, do after the
registration is done, I have a bunch of (x,y,z) point in those
coordinates. I display them with a vtkPolyDataMapper, which works
great. But I'd like to (in the same "global" coordinates) display the
image using the three orthogonal planes approach. My current strategy
is to reset the origin and spacing on the image to (0,0,0) and
(1,1,1), and then use the (known) affine transform from "image index
coordinates" to "real world point coordinates" to map the display.
I'm trying very hard to avoid resampling the image, which is why I'd
like to work with something that only affects the VTK display side of
things if possible.
I'm working in Python and C++. I'm also happy to hear about open
source programs that could take the "display" part of this off my
hands. I've not figured out a great point set export format that
common programs (MITK, ITK-Snap, Seg3D, Osirix, whatever) can read,
but answers I would absolutely love include:
- "Here is how you transform an ImagePlaneWidget!"
- "There's a much better way to display that kind of output reasonably."
- "There are free programs that will display your results; don't roll your own."
- etc
Thanks in advance,
John
John McManigle
MD/DPhil Student
NIH-Oxford Scholars Program
Duke University School of Medicine
More information about the vtkusers
mailing list