[vtkusers] getting pointids from an imagedata

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Tue Jul 10 07:44:42 EDT 2001


You'll also need to
> > imagedata->GetPointData()->GetScalars()->SetScalar(mydubiousPointID,255)
then
imagedata-Modified to make sure the renderer forces a full update

By offset and Scaling I simply mean that if the origin (of the image) is at 
x,y then pixel 1,1 is at some x,y offset and the rest follow.

JB


At 10:37 10/07/2001, Matthias Zangl wrote:
>Hello John,
>
>thanks for answering my questions. I am using a renderwindow. Its actually a
>self-written imageviewer by using the Actor2D and setting the origin.
>
>I've the x y coords from the mouse click.
>
>I tried them to convert it with setdisplaypoint, displaytoworld and then get
>the worldpoint. Maybe thats the wrong way of conversion?
>
>Could you give me more details / infos on what you mean by computing the
>pixel location from origin + offset and scaling?
>
>Well, its very helpful for me to set the scalar so that I can see whether my
>point is the correct one...
>
>Matt
>----- Original Message -----
>From: "John Biddiscombe" <jbiddiscombe at skippingmouse.co.uk>
>To: "Matthias Zangl" <zangl at ism-austria.at>; <vtkusers at public.kitware.com>
>Sent: Tuesday, July 10, 2001 11:04 AM
>Subject: Re: [vtkusers] getting pointids from an imagedata
>
>
> > Matt
> >
> > I'm not sure I'm able to help you really. There are so many details of how
> > you are displaying your image data (renderwindow or imagewindow -
> > drawpixels or imageactor) if you're using an imagewindow then I never
>touch
> > them so can't help, they may not implement the worldpoint-displaypoint
> > features in the same way as the renderwindow. Check also that the slice
> > number you're using is being set into your SetDisplayPoint(x,y,lastY)
>call.
> > I generally do something like this
> >
> > MouseClick->
> >    Get X,Y coords
> > Compute pixel location from origin+offsetx/y and scaling
> >    pointID follows,
> > but as I mentioned in an earlier post last week I think, I don't use an
> > imagewindow and have implemented all the image display code myself from
> > scratch - this means I know exactly where pixel 0,0 is etc etc and there
> > are no problems. I'm afraid you're going to have to use a lot of trial and
> > error but if you do have a dataset and want to see if the pixel you've got
> > is correct, the easiest way is probably
> > imagedata->GetPointData()->GetScalars()->SetScalar(mydubiousPointID,255)
> > or something along those lines. Then it should change colour and you can
>at
> > least test it - n'est pas?
> >
> > JB
> >
> > At 14:59 09/07/2001, Matthias Zangl wrote:
> > >Hello John,
> > >
> > >I tried out your suggestion and I am not clear, if everything is working
> > >properly:
> > >
> > >float worldPoint[4];
> > >
> > >  this->GetRenderer()->SetDisplayPoint(x,y,lastY);
> > >  this->GetRenderer()->DisplayToWorld();
> > >  this->GetRenderer()->GetWorldPoint(worldPoint);
> > >
> > >  int pointId =
>data->FindPoint(worldPoint[0],worldPoint[1],worldPoint[2]);
> > >
> > >  float coord[3];
> > >  data->GetPoint(pointId,coord);
> > >
> > >The function FidnPoint seems to return a valid pointId (although the
> > >worldPoint-coords are not very familiar for me (0.001....)). But at least
>I
> > >am getting a pointId. For checking if its valid I tried to get the coords
> > >from the point id (with getpoint). But the coords stored in the
>coord-array
> > >are always 0,5 or -0,5 for all axes.. There should definitly be a way for
> > >transforming them to useful coordinates,right?
> > >
> > >Is there another way for doing something with my point for ensuring that
>I
> > >got the right one?
> > >
> > >thx,
> > >Matt
> > >----- Original Message -----
> > >From: "John Biddiscombe" <jbiddiscombe at skippingmouse.co.uk>
> > >To: "Matthias Zangl" <zangl at ism-austria.at>;
><vtkusers at public.kitware.com>
> > >Sent: Saturday, July 07, 2001 12:25 PM
> > >Subject: Re: [vtkusers] getting pointids from an imagedata
> > >
> > >
> > > > Sorry, I misread your request. You'll need to get the window->World
> > > > coordinate conversion from
> > > > vtkViewPort::DisplayToWorld
> > > > and then use findpoint...
> > > >
> > > >
> > > > At 15:29 06/07/2001, John Biddiscombe wrote:
> > > > >vtkDataSet::
> > > > >int FindPoint (float x, float y, float z)
> > > > >int FindPoint (float x[3])
> > > > >
> > > > >all subclasses (ImageData) implement it and given a 3space
>coordinate,
> > >you
> > > > >can find the point ID of the one you want.
> > > > >
> > > > >JB
> > > > >
> > > > >
> > > > >At 14:16 05/07/2001, Matthias Zangl wrote:
> > > > >>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
> > > > >>
> > > > >>
> > > > >>_______________________________________________
> > > > >>This is the private VTK discussion list.
> > > > >>Please keep messages on-topic. Check the FAQ at:
> > > > >><http://public.kitware.com/cgi-bin/vtkfaq>
> > > > >>Follow this link to subscribe/unsubscribe:
> > > > >>http://public.kitware.com/mailman/listinfo/vtkusers
> > > > >
> > > > >
> > > > >_______________________________________________
> > > > >This is the private VTK discussion list. Please keep messages
>on-topic.
> > > > >Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> > > > >Follow this link to subscribe/unsubscribe:
> > > > >http://public.kitware.com/mailman/listinfo/vtkusers
> > > >
> > >
> > >
> > >
> > >_______________________________________________
> > >This is the private VTK discussion list.
> > >Please keep messages on-topic. Check the FAQ at:
> > ><http://public.kitware.com/cgi-bin/vtkfaq>
> > >Follow this link to subscribe/unsubscribe:
> > >http://public.kitware.com/mailman/listinfo/vtkusers
> >
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> >





More information about the vtkusers mailing list