[vtkusers] pixel data at world position

Mark Wyszomierski markww at gmail.com
Thu Oct 6 12:04:00 EDT 2005


Ok then, divide the returned mapper position (for both x and y locs) by
whatever you set the pixel spacing of the input image data to be (keep in
mind your x/y spacing may be different too), add 0.5 and cast it to an
integer, and then that's your real x/y coordinate in your 'raw' image.
 But you have to keep in mind that your ITK image is most likely 'flipped'
compared to the input VTK image data you are using. So if the ITK image data
is a 1D array, the actual pixel index is just:
  nRealIdx = (ImgHeight - nRealY - 1) * (ImageWidth) + nRealX;
 If you're sure your ITK also has cartesian coordinates, or just the same as
your VTK data, its just:
  nRealIdx = nRealY * ImageWidth + nRealX;
 Mark

 On 10/6/05, Renaud Isabelle <renauisa at yahoo.fr> wrote:
>
> Hi Mark,
>  Yes. vtkPointPicker owns 3 different functions:
>  - *GetSelectionPoint* contains my (X,Y) =
> (Interactor->GetEventPosition()[0],
> Interactor->GetEventPosition()[1])...: returns my picked point in screen
> coordinates
>  - *GetMapperPosition* returns the real coordinates x,y,z of my picked
> point, non transformed point in 3D
>  - *GetPickPosition*, also a 3D position
>  You told me to use GetMapperPosition to compute my world coordinates from
> a point in screen coordinates. However, that is already that I have by using
> GetPickPosition: in my case, both functions, GetMapperPosition and
> GetPickPosition, return the same result.
>
> *Mark Wyszomierski <markww at gmail.com>* a écrit :
>
> I don't understand:
>  selection point (X,Y) in pixel coordinates // This is the loc picked in
> screen coordinates?
> *--> Yes, it is*
> real position in world (x,y,z) // This is the mapped position picked
> (mapped to an index in your image)?
> *-->ok, so what I would like to retrieve is the index which is mapped with
> my mapped position. Since index in my displayed image by VTK should be
> correspondant to my index in my itkImage read from a file, I could then get
> the pixel value of my itkimage at this index. Do you follow me? *
>  Mark
>
>  ------------------------------
> *Appel audio GRATUIT partout dans le monde* avec le nouveau Yahoo!
> Messenger
> Téléchargez le ici !<http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051006/0097fac9/attachment.htm>


More information about the vtkusers mailing list