[vtkusers] coordinate transformation between polydata and image data

Bill Lorensen bill.lorensen at gmail.com
Mon Oct 18 00:26:13 EDT 2010


To go from a pixel i,j,k to the physical x,y,z the transform is
x = origin[0] + spacing[0] * i
y = origin[1] + spacing[1] * j
z = origin[2] + spacing[2] * k

where origin and spacing are stored in the image.

To go from x,y,z to a pixel i,j,k
i = (x - origin[0]) / spacing[0]
...
Conversion to integer will give you the i,j,k of the pixels lower left
corner.  If you want the nearest neighbor,
i = (x - origin[0] / spacing[0] + .5


On Sun, Oct 17, 2010 at 11:36 PM, Sara Rolfe <smrolfe at u.washington.edu> wrote:
> Hello,
>
> Sorry if this is a simple questions.  I have a 3D image which I extract a
> contour from using vtkContourFilter.  The output of this is polydata.  I'm
> interested in taking a point of interest from the polydata and finding the
> approximate corresponding point in the original image.  This seems to be a
> simple task, but I'm confused because the point locations appear to be in a
> different coordinate space.  The bounds of the polydata are greater than the
> region of the original image.  If I'm understanding this correctly, where
> can I find out what this transformation is, or how can I transform the
> polydata point locations back into voxel space?
>
> Thanks,
> Sara
> _______________________________________________
> 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
>



More information about the vtkusers mailing list