<DIV>Hi again, </DIV>
<DIV>&nbsp;</DIV>
<DIV>Ok, I checked out the difference between picker-&gt;GetPickPosition() and picker-&gt;GetMapperPosition(), and in my case, they are always the same: goo for me! </DIV>
<DIV>&nbsp;</DIV>
<DIV>So, I still have my selection point (X,Y) in pixel coordinates, and my real position in world (x,y,z), but i would like to know how to retrieve the pixel value of my itkImage since I have got my real position in world. </DIV>
<DIV>&nbsp;</DIV>
<DIV>BTW, did you finally manage to set a pixel that your user clicks on to a certain color, as you mentioned in your posted mail <A href="http://public.kitware.com/pipermail/vtkusers/2005-May/079622.html">http://public.kitware.com/pipermail/vtkusers/2005-May/079622.html</A>? </DIV>
<DIV>This could be exactly what I would like to do.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Isabelle<BR><BR><B><I>Mark Wyszomierski &lt;markww@gmail.com&gt;</I></B> a écrit :</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV>Hi Isabelle,</DIV>
<DIV>&nbsp;</DIV>
<DIV>So my observer is a class, who has a member to my 'view' class, as well as some storage for</DIV>
<DIV>the mapped point. Pseudo code looks like:</DIV>
<P>class vtkObserverLeftMouseDown : public vtkCommand {<BR>&nbsp;&nbsp;&nbsp; public:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMyView *m_pView;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double ptMapped[3];<BR>};</P>
<DIV>Now to fill in some of the blanks, the actual function looks like:</DIV>
<DIV>&nbsp;</DIV>
<DIV>void vtkObserverLeftMouseDown ::Execute(vtkObject *caller, unsigned long, void*) <BR>{</DIV>
<DIV>&nbsp;&nbsp;&nbsp; m_pView-&gt;Picker-&gt;Pick(m_pView-&gt;Interactor-&gt;GetEventPosition()[0], <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pView-&gt;Interactor-&gt;GetEventPosition()[1], <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pView-&gt;Renderer);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; m_pView-&gt;Picker-&gt;GetMapperPosition(ptMapped);</DIV>
<DIV>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>Once ptMapped is filled in for you, you can do the equation where you divide by the</DIV>
<DIV>pixel spacing etc. The (int)(+ 0.5) is just a shortcut for rounding - it is to make the</DIV>
<DIV>final determination about what pixel you're over. It is not related to my origin. You'll</DIV>
<DIV>have to come up with a way to get your picker to the observer. Using a pointer to</DIV>
<DIV>my view class worked for me.&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Mark</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=gmail_quote>On 10/5/05, <B class=gmail_sendername>Renaud Isabelle</B> &lt;<A href="mailto:renauisa@yahoo.fr">renauisa@yahoo.fr</A>&gt; wrote:</SPAN> 
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV>Hi Mark,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks for replying. </DIV>
<DIV>&nbsp;</DIV>
<DIV>I have already computed my world position by firing a picker from pixel coordinates. Sorry but I don't see or know what the mapper coordinates are. What is the difference and how this could help me to retrieve the index in my itkImage's buffer corresponding to my world position? &nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>BTW, what is your '+ 0.5'? I suppose this is the origin in x of your image, right? </DIV>
<DIV>&nbsp;</DIV>
<DIV>Isabelle<BR><BR><B><I>Mark Wyszomierski &lt;<A onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:markww@gmail.com" target=_blank>markww@gmail.com</A>&gt;</I></B> a écrit :</DIV>
<DIV><SPAN class=e id=q_106c240c57796646_1>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV>You can fire a pick event when the user clicks the mouse:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; Picker-&gt;Pick(eventpos[0], eventpos[1], 0, renderer);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; </DIV>
<DIV>Then you can get the mapped position:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; Picker-&gt;GetMapperPosition(...);</DIV>
<DIV>&nbsp;</DIV>
<DIV>Then&nbsp; the final x,y locs of the original image I get by:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; originalX = (int)(ptMapped[0] / pixel_spacing_x + 0.5);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; // same for y.</DIV>
<DIV>&nbsp;</DIV>
<DIV>This always has given me the correct 'real' location.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Mark<BR><BR>&nbsp;</DIV>
<DIV><SPAN class=gmail_quote>On 10/5/05, <B class=gmail_sendername>Renaud Isabelle</B> &lt;<A onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:renauisa@yahoo.fr" target=_blank>renauisa@yahoo.fr</A> &gt; wrote:</SPAN> 
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have read&nbsp;an initial&nbsp;3D image from a file with itkImageFileReader&nbsp;and displayed with VTK through&nbsp;vtkImageData/vtkImageActor.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Now, since a known world position in 3D x,y,z, I would like to retrieve the pixel value at this point of my image. </DIV>
<DIV>&nbsp;</DIV>
<DIV>This seems to be a complex problem,&nbsp;because I don't want the pixel data that is displayed at this position but the pixel data of the raw&nbsp;image, that is no rescaled instead.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is there some example where such a thing is done? Or any function? </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks, </DIV><SPAN>
<DIV>&nbsp;</DIV>
<DIV>Isabelle</DIV></SPAN><SPAN>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<P>
<HR SIZE=1>
<B><FONT color=#ff0000>Appel audio GRATUIT</FONT> partout dans le monde</B> avec le nouveau Yahoo! Messenger<BR><A onclick="return top.js.OpenExtLink(window,event,this)" href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com" target=_blank>Téléchargez le ici !</A> 
<P></P>
<P></P>
<P></P>
<P></P></SPAN><BR>_______________________________________________<BR>This is the private VTK discussion list.<BR>Please keep messages on-topic. Check the FAQ at: <A onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target=_blank>http://www.vtk.org/Wiki/VTK_FAQ</A><BR>Follow this link to subscribe/unsubscribe:<BR><A onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target=_blank>http://www.vtk.org/mailman/listinfo/vtkusers </A><BR><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE>
<P>
<HR SIZE=1>
<B><FONT color=#ff0000>Appel audio GRATUIT</FONT> partout dans le monde</B> avec le nouveau Yahoo! Messenger<BR><A onclick="return top.js.OpenExtLink(window,event,this)" href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com" target=_blank>Téléchargez le ici !</A> 
<P></P>
<P></P></SPAN></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE><p>
                <hr size=1> 
<b><font color=#FF0000>Appel audio GRATUIT</font> partout dans le monde</b> avec le nouveau Yahoo! Messenger<br> 
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.messenger.yahoo.com">Téléchargez le ici !</a>