[vtkusers] Re: getting pointids from an imagedata

Dave Reed dreed at capital.edu
Thu Jul 5 14:30:26 EDT 2001


> From: "Matthias Zangl" <zangl at ism-austria.at>
> Date: Thu, 5 Jul 2001 15:16:44 +0200
> 
> Hello!
> 
> I am displaying a volume (vtkImageData) - slice by slice on my screen. I
> realized it by changing the outputorigin on slicing. Well, that works well
> so far. Now I want to get the pointid from a point the user is selecting on
> the screen. All I got are the coordinates in the renderwindow. I suppose
> I've to take care that they 're calculated dependend on the resolution and
> current zoomfactor of my image. Maybe someone have some hints for me.
> 
> greatly appreciated,
> 
> bye,
> Matt


Basically, you need to backward map the "origin z value" to determine
which slice you're in and then use:

GetScalarComponentAsFloat

with the x, y, and the slice value to get the image value.

If you panned or zoomed, you also need to backward map the the pointer
value to the x and y coordinates of the image.  All these "backward
maps" are linear functions so it's not too difficult.

HTH,
Dave




More information about the vtkusers mailing list