[vtkusers] [Insight-users] Get the selection point in screen (pixel) coordinates

Xiaopeng Yang yxp233 at postech.ac.kr
Mon Nov 29 21:36:50 EST 2010


Index looks like world coordinates, but always is positive. For example, for a point of world coordinates (-143.2, -277.5, 1407.9), its index is (169, 230, 34). The index you mentioned is a int type. So I think we are talking about two different things.

Xiaopeng

-----邮件原件-----
发件人: David Doria [mailto:daviddoria at gmail.com] 
发送时间: 2010년 11월 30일 화요일 오전 11:00
收件人: Xiaopeng Yang
抄送: Luis Ibanez; vtkusers at vtk.org; insight-users at itk.org
主题: Re: [Insight-users] Get the selection point in screen (pixel) coordinates

> Actually I do not need the world coordinates. What I need is called “Index”.
> Have you tried to use MITK? In MITK, if you select a point, then on the
> right bottom of the screen, information of that point like “world position”,
> “Index”, “pixel value” appears. As you know, seed point setting in ITK
> segmentation uses “Index”, not “world position”. Am I right?

You should be able to get the index from the world coordinate by using FindCell:

  int subId;
  double pcoords[3];
  int index = image->FindCell(p, NULL, 0, 0.0, subId, pcoords, NULL);

As you can see, the interface is terribly awkard. I though I had
pushed a patch to allow simply:
  int index = image->FindCell(p);

but I guess I did not. I will start the review process on that patch tomorrow.

Does this do what you're looking for?

David












More information about the vtkusers mailing list