Ok, I figured out that the GetMapperPosition() was the answer to my question. However, I have another problem now...<br><br>I included the following code in my left mouse button handler and it causes a segmentation fault!!!
<br><br>vtkRenderWindowInteractor *rwi = this->Interactor;<br> if (rwi)<br> {<br> vtkPointPicker *picker = (vtkPointPicker *)rwi->GetPicker();<br> picker->Pick(x, y, m_viewer->GetCurrentSlice(), this->CurrentRenderer);
<br> <br> std::cout << "PointId: " << picker->GetPointId() << "\n";<br> std::cout.flush();<br> if (picker->GetPointId() != -1)
<br> {<br> double * ptActual, *ptMapped;<br> picker->GetSelectionPoint(ptActual); // OK<br> picker->GetMapperPosition(ptMapped); // CRASHES!!!!!
<br> std::cout.flush();<br> }<br> }<br><br>This is a bit crazy... I guess the mapper is not set. So, I thought I would explicitly add a picker in my vtkImageViewer type class and I have the following code where I set my interactor...
<br><br>// rwi is the render window interactor<br><br>if (!this->m_interactor)<br> {<br> this->m_interactor = rwi;<br> rwi->Register(this);<br> }<br><br>vtkPointPicker * picker = vtkPointPicker::New();<br>
picker->SetTolerance(0.005);<br>picker->AddPickList(m_actor2D);<br>picker->PickFromListOn();<br>rwi->SetPicker(picker);<br>picker->Delete();<br><br>However, now it picks nothing. The PointID is always -1. Please if someone can help me solve this problem, I would be really grateful!
<br><br>Thanks,<br>Anja<br><br><div><span class="gmail_quote">On 31/08/06, <b class="gmail_sendername">Anja Ende</b> <<a href="mailto:anja.ende@googlemail.com">anja.ende@googlemail.com</a>> 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>Hi everyone,<br><br>I have a reslicer interface where I click on a 2D image and it reslices the volume at that point and returns me the slice.<br><br>Now, I could have the image zoomed and I want to pick the point in the original image regardless of the zoom factor. Of course, I can probably do that by taking the current zoom factor into account but there might be round off errors, so I was wondering if there is a better way.
<br><br>I can get the points bu using vtkPointPicker class and that seems to work. However, I do not know what to do with those values as the reslicer will not accept those values.<br><br>So, I was wondering if there was a way to pick points on the rendered 2D image (regardless of its zoom factor) that actually refers to the points in the original image size.
<br><br>Cheers and thanks,<br><br>Anja<br><br>Shamesless plug: <br>----------------------<br>I actually have another open question. I still have not figured out the correct strategy for setting the output setting. So, if someone would be kind enough to help me with that
<br><br><a href="http://public.kitware.com/pipermail/vtkusers/2006-August/086765.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://public.kitware.com/pipermail/vtkusers/2006-August/086765.html
</a><br>
</div></blockquote></div><br>