<div>Please also be aware - depending on if your original image is a VTK image vs an ITK image - the</div>
<div>points mapped through this method are in 'cartesian coordinates' - so if you're referencing an</div>
<div>ITK image who has 'image' coordinates (i think they do anyways), you'll have to flip the y axis </div>
<div>to reference the correct original pixel. <br>&nbsp;</div>
<div>Mark<br>&nbsp;</div>
<div><span class="gmail_quote">On 10/5/05, <b class="gmail_sendername">Mark Wyszomierski</b> &lt;<a href="mailto:markww@gmail.com">markww@gmail.com</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 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><span class="e" id="q_106c24ba063f9258_1">
<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 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 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>
<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></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></p></span></div></blockquote></div><br></span></div></blockquote></div><br>