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

David Feng dfeng at cs.unc.edu
Mon Jan 4 08:52:20 EST 2010


Sorry, I should have also mentioned that if the origin 
(image->GetOrigin()) of your dicom image is nonzero it should be:

x = (point[0] - origin[0]) / spacing[0]
y = (point[1] - origin[1]) / spacing[1]
z = (point[2] - origin[2]) / spacing[2]

David

David Feng wrote:
> 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
>>   
>
> _______________________________________________
> 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