[vtkusers] Programming challenges with QT, VTK, and ITK
(Samuel) Byeongjun Park
byeongjun.park at case.edu
Fri Dec 17 10:50:26 EST 2010
Xiaopeng,
If you use iktImageToVTKImageFilter, it means the image data is in itk::Image object, not in vtkImageData.
So if you got world coordinate, then the first three elements of world coordinate array is the PhysicalPoint of itk::Image.
You can get the index of itkImage using itk::Image::TransformPhysicalPointToIndex(..).
You shouldn’t read the image to both of itk::Image and vtkImageData.
Summarizing..
1. Read the image to itk::Image.
2. Apply itkImageToVTKImageFilter
3. Get a point from vtk
4. Change it to world coordinate point
5. Store the x,y,z coordinate into Itk::Image::PointType object
6. Itk::Image::TransformPhysicalPointToIndex()
Now you get the index of the itk::Image where you picked in vtk window.
Good luck and merry Christmas!
Sam.
-------------- Innovation for the Future Radiation Oncology (http://rophys.meds.case.edu <http://rophys.meds.case.edu/> )
(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: Xiaopeng Yang [mailto:yxp233 at postech.ac.kr]
Sent: Friday, December 17, 2010 7:13 AM
To: '(Samuel) Byeongjun Park'
Cc: insight-users at itk.org; 'vtk'
Subject: RE: [vtkusers] Programming challenges with QT, VTK, and ITK
Hello Park,
It has been a very long time since I received your help. These days I am still working on this problem. Now I can get the VTK coordinate (i.e., world coordinate). You mentioned that if I use itk ImageToVTKImageFilter, I can directly use the VTK coordinate as ITK coordinate. However, I could not understand clearly. In my program, I need ITK coordinate for applying ITK region growing algorithm. I do not know how to translate VTK coordinate to ITK coordinate. Could you please explain more in detail?
Thanks very much!
Xiaopeng
发件人: (Samuel) Byeongjun Park [mailto:byeongjun.park at case.edu]
发送时间: 2010년 10월 27일 수요일 오후 10:41
收件人: 'Xiaopeng Yang'
抄送: 'vtk'
主题: RE: [vtkusers] Programming challenges with QT, VTK, and ITK
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/20101217/c3786d70/attachment.htm>
More information about the vtkusers
mailing list