[vtkusers] Programming challenges with QT, VTK, and ITK

(Samuel) Byeongjun Park byeongjun.park at case.edu
Wed Oct 27 09:41:00 EDT 2010


Hi,

 

My name is Sam Park. Since you told you are using QT, I think you are using
QVTKWidget.

You can make your own QVTK widget class inheriting QVTKWidget.

In there, override 

   Virtual void mousePressEvent(QMouseEvent *pevent);

You can read the mouse position in QVTKWidget window.

Then,

1.       Get the QT coordinate point (x,y)

2.       Flip y value by  y=height-y;

3.       Get the pointer of the Render in your QVTKWidget object.

4.       double wpoint[4];

5.       Render->SetDisplayPoint(x,y,0);

6.       Render->DisplayToWorld(); 

7.       Render->GetWorldPoint(wpoint);

 

Now You have the VTK coordinate of the point you clicked.

If you imported CT image in ITK and utilized itk::ImageToVTKImageFilter, 

you can directly use the VTK coordinate as ITK coordinate.

 

Good luck.

 

Sam.

-------------- Innovation for the Future Radiation Oncology 

(Samuel) Byeongjun Park, Ph.D.  -- Research associate of Sohn Lab.

Case Western Reserve Univerisity, School of Medicine

Visiting: Wood building W517,  Phone: 1-216-368-6583

 

 

 

From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Xiaopeng Yang
Sent: Tuesday, October 26, 2010 9:06 PM
To: 'Luis Ibanez'
Cc: 'itk'; 'vtk'
Subject: [vtkusers] Programming challenges with QT, VTK, and ITK

 

Dear Luis,

 

How are you doing? Thank you very much for your help so far. Sorry to ask
you a question again.

 

I am now developing a liver segmentation program using QT, VTK, and ITK
based on CT images. In my program, fast marching algorithm is used to
extract the liver by multiple seed points. To pick the positions of the seed
points, vtkImagePlaneWidget is applied. The problem is how to save the
multiple seed points I selected by left-clicking of the mouse so that I do
not need to type those positions into the code, which is time consuming.

 

Please provide me with your suggestions. I working on this for almost one
week still I cannot figure it out.

 

Thanks,

Xiaopeng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101027/d2dce6c3/attachment.htm>


More information about the vtkusers mailing list