Hi All,<br><br>I&#39;m using the VTKPointPicker to get the coords of the mouse over a widget displaying a vtkImageData object.<br><br>To display this image, I&#39;m using the vtkImageViewer2.<br><br>The coords are get correctly when I use a blank image like this:<br>
<br>&nbsp;&nbsp; vtlImageData* image = vtlImageData::New();<br>&nbsp;&nbsp; image-&gt;SetSize(200, 200);<br>&nbsp;&nbsp; image-&gt;AllocateScalars();<br>&nbsp;&nbsp; image-&gt;Update();<br><br>When I use an image that was extracted from a 3D volume, the x-axis is correct, but the y-axis is getting negative values.<br>
<br>Does anybody knows why this is happening? Is it an orientation problem? How can I fix that?<br><br>This is the code to get the coords:<br>
<br>&nbsp;&nbsp; if (!picker-&gt;Pick(this-&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; this-&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; 0,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; viewer-&gt;GetRenderer())) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; double ptMapped[3];<br>&nbsp;&nbsp; picker-&gt;GetMapperPosition(ptMapped);<br><br>&nbsp;&nbsp; double dSpacing[3];<br>&nbsp;&nbsp; viewer-&gt;GetInput()-&gt;GetSpacing(dSpacing);<br>&nbsp;&nbsp; ptMapped[2] = viewer-&gt;GetSlice() * dSpacing[2];<br>
<br>&nbsp;&nbsp; // Update Image<br>&nbsp;&nbsp; vtkImageData* image = vtkImageData::New();<br>&nbsp;&nbsp; image-&gt;DeepCopy(this-&gt;editorGui-&gt;getImageMarker());<br><br>&nbsp;&nbsp; int nVolIdx = viewer-&gt;GetInput()-&gt;FindPoint(ptMapped);<br>&nbsp;&nbsp; unsigned short* pPix = (unsigned short*)viewer-&gt;GetInput()-&gt;GetScalarPointer();<br>
&nbsp;&nbsp; int usPix = (int)pPix[nVolIdx];<br><br>&nbsp;&nbsp; printf(&quot;Coords: x %f &nbsp; y %f\n&quot;, ptMapped[0], ptMapped[1]);<br><br><br>Thanks,<br>Luis<br>