Hey Henrik,<br><br>Thanks for the clarification, I understand your solution but I don&#39;t think it&#39;s approperiate for Meisam&#39;s and my situation. We, at least&nbsp; I (and i presume Meisam does also), use glyphs to create a certain source at each point. In effect we only have a single mapper (a glyphMapper) and a single actor (a glyphActor). 
<br><br>So there is no easy way to get from picker.GetMapper() to the approperiate Actor. In fact when i try what you do I get returned an OpenGLActor... I&#39;ve tried asking questions about this on the list before but I didn&#39;t get any responses. In the mean time i did find out (perphaps helpful for Meisam) that if you use a Glyph3D or Glyph2D you can GeneratePointId&#39;s which will enable you to deduct to which glyph the point you picked is contributing (if i understand correctly). I on the other hand use the ProgrammableGlyphFilter which does not have this option so i still remain clueless on how to get from a pick action to the vertex or glyph-center i want.
<br><br>Regards - Geofram<br><br><div><span class="gmail_quote">On 6/14/07, <b class="gmail_sendername">Henrik Westerberg</b> &lt;<a href="mailto:henrik.westerberg@crg.es">henrik.westerberg@crg.es</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">







<div>

<br>
<br>

<p><font size="2">Hi folks,<br>
<br>
Ok, for my app I have a vtk file which consists a bunch<br>
of blobs. I find actors by first finding the number of blobs:<br>
<br>
# some vtk in python<br>
polyImg = vtkPolyDataReader())<br>
polyImg.SetFileName(name)<br>
<br>
# extract all regions for the blobs<br>
connImg = vtkPolyDataConnectivityFilter())<br>
connImg.SetExtractionModeToAllRegions()<br>
connImg.SetInput(polyImg.GetOutput())<br>
<br>
# update to get the number of blobs<br>
connImg.Update()<br>
<br>
# get the number of blobs<br>
numofblobs = connImg.GetNumberOfExtractedRegions()<br>
<br>
The blobs are then extrated into a list of mappers and actors using:<br>
<br>
# loop over the number of blobs (i)<br>
blobMappers.append(vtkPolyDataMapper())<br>
<br>
tempImg = vtkPolyDataConnectivityFilter()<br>
tempImg.SetExtractionModeToSpecifiedRegions()<br>
tempImg.SetInput(connImg.GetOutput())<br>
tempImg.AddSpecifiedRegion(i)<br>
<br>
blobMappers[i].SetInput(tempImg.GetOutput())<br>
blobActors.append(vtkActor())<br>
blobActors[i].SetMapper(blobMappers[i])<br>
<br>
ren1.AddActor(blobActors[i])<br>
<br>
I can then use vtkPicker.GetMapper() to get the mapper which was picked,<br>
and therefore the actor as they are created at the same time.<br>
<br>
# find the actor<br>
def handlePick(object, event):<br>
&nbsp;&nbsp;&nbsp; mapper =&nbsp; picker.GetMapper()<br>
&nbsp;&nbsp;&nbsp; for i in range(0, numofblobs 1):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if mapper == blobMappers[i]:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # find the mapper<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # do some stuff<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # i also indicates the correct actor<br>
<br>
Reading in all the blobs is a bit slow (100 or so blobs) but it works.<br>
<br>
hth,<br><span class="sg">
<br>
Henrik</span></font></p><div><span class="e" id="q_1132a54e2f4fd4a2_2"><font size="2"><br>
<br>
-----Original Message-----<br>
From: vtkusers-bounces+henrik.westerberg=<a href="mailto:crg.es@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">crg.es@vtk.org</a> on behalf of Geoframer<br>
Sent: Thu 6/14/2007 2:00 PM<br>
To: Meisam Aliroteh<br>
Cc: <a href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">vtkusers@vtk.org</a><br>
Subject: Re: [vtkusers] Picking and moving a vertex<br>
<br>
I think you can at least get the starting position by using the<br>
picker.GetPickPosition() although this is not your center of the vertex but<br>
the coordinates on the glyph. It is at least in 3D coordinates. To get the<br>
real starting point you should indeed get the Actor that is picked upon and<br>
use it&#39;s GetCenter() to retrieve the center of the glyph.<br>
<br>
I haven&#39;t been able to pull this off though. When i try to get the Actor i&#39;m<br>
picking on i seem to pick the picker&#39;s actor for my GetCenter() always<br>
returns the middle of the data instead of the middle of the vertex.<br>
<br>
In any case I&#39;m quite curious how you can go from a cellId to the<br>
approperiate vertex... Do you just integer divide by the number of cells per<br>
glyph?<br>
<br>
Perhaps Henrik can shed some more light on how you can actually get the<br>
actor of the glyph when picking?<br>
<br>
Regards - Geofram<br>
<br>
On 6/13/07, Meisam Aliroteh &lt;<a href="mailto:meisam.aliroteh@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">meisam.aliroteh@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I have a polydata and used a sphere source to render the polydata in<br>
&gt; point-cloud mode (i.e only vertices are rendered, and I use spheres to<br>
&gt; show these vertices). I want the user to be able to click on any vertex<br>
&gt; (shpere) and move it in the 3D space (well actually it would be a motion<br>
&gt; restricted to the current view plane). I used vtkCellPicker and know how to<br>
&gt; figure out which vertex is picked when the user clicks on it. What I don&#39;t<br>
&gt; know is how to figure out the motion vector when the user clicks and drags a<br>
&gt; sphere ? I can get the old and new mouse positions from the interactor but<br>
&gt; these are 2D coordinates.<br>
&gt;<br>
&gt; I guess what I need is the 3D coordinates of the previous and current<br>
&gt; mouse positions, so that when I subtract these 3D coordiantes I get a motion<br>
&gt; vector and then I can move the picked vertex by adding this motion vector to<br>
&gt; it. The problem is I don&#39;t know how to get the 3D coordinate of the mouse<br>
&gt; pointer using VTK !!!<br>
&gt;<br>
&gt; Any ideas?<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; This is the private VTK discussion list.<br>
&gt; Please keep messages on-topic. Check the FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
<br>
</font></span></div><font size="2"></font>
<p></p>

</div>
</blockquote></div><br>