[vtkusers] Get 2D ZSlice value from 3D point.

David Feng dfeng at cs.unc.edu
Mon Jan 4 08:06:03 EST 2010


A couple clarifying questions:

- What's in the 3D image?  I'm assuming it's some sort of surface. 
- What space is your point in?  Screen coordinates (2D) or world 
coordinates (3D)? 
- Have you applied any transformations (rotation, translation, etc) to 
the 3D representation?

If your point is an untransformed 3D world coordinate, your image space 
point would be:

x = point[0] / spacing[0]
y = point[1] / spacing[1]
z = point[2] / spacing[2]

z is your slice plane index.  If there's a transform applied, you'll 
need to un-apply to get the point back from world space into image space 
before doing the division above. 

If your point is a 2D screen space coordinate, you'll have to do some 
geometry picking, which isn't too hard with existing VTK classes.  Let 
me know if that's what you need.

Hope this helps.

David


superzz wrote:
> Hello
> I am reconstructing 3D image from DICOM files and present it to user. User
> can pick point on 3D image. Then I need to show the 2D dicom with
> corresponding ZSlice to user. Is there an easy way to get it?
>
> I've tried to calculate ZSlice value from point.X / spacing[2]. But it seems
> that the result is incorrect.
>
> Thanks
>
> superZZ
>   




More information about the vtkusers mailing list