How to get the right 3D world position for the 2d point selected on DICOM slice?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to get the right 3D world position for the 2d point selected on DICOM slice?

Liu_tj
Hi,

In our application, we have 3 2d views using vtkImageViewer2 to display the sagittal, coronal and axial view of the DICOMs, and we have another view for the generated 3D model. Now I want to achieve the requirement below:

If user click a point on one slice on the 2D view, I need to get the corresponding 3D point on the 3D model view.
If user click a point on the 3D model view, I need to get the corresponding 2D point and slice number.

How to achieve that?

Thanks
tjlp


 


_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to get the right 3D world position for the 2d point selected on DICOM slice?

Andaharoo
I've been using vtkPicker to get the point on the image plane. Basically you give it the actor, call pick, and it gives you the point on the plane. If you want to convert that point to your image coordinates you can divide by the image spacing and round.

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Images/PickingAPixel2 this is a good example but has one error in it. I'd suggest something more like this when calculating the final point.

x = imageViewer->GetSlice();
y = vtkMath::Round(pos[1] / spacing[1]);
z = vtkMath::Round(pos[2] / spacing[2]);

As you can see in the example, depending on your orientation this changes. But they didn't account for images with spacing that isn't 1. And there is a typo I fixed in the orientation example I provided above. (instead of pos[0] and pos[1] it's pos[1] and pos[2])
Loading...