<div dir="ltr">I am trying with this but getting strange values (negative values for z index for instance):<div><br></div><div><div>double* o = image->GetOrigin();</div><div>double* s = image->GetSpacing();</div><div>
indices[0] = static_cast<int>( ( xPos - o[0] ) / s[0] + 0.5 );</div><div>indices[1] = static_cast<int>( ( yPos - o[1] ) / s[1] + 0.5 );</div><div>indices[2] = static_cast<int>( ( zPos - o[2] ) / s[2] + 0.5 ); </div>
<div>return indices;</div></div><div><br></div><div>I am mixing the coordinate somehow? Can you help me?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 24, 2013 at 3:41 PM, Manuel Corrales <span dir="ltr"><<a href="mailto:manuelcorrales@gmail.com" target="_blank">manuelcorrales@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Dean! Will try it.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Jun 24, 2013 at 3:04 PM, Dean Inglis <span dir="ltr"><<a href="mailto:inglis.dl@gmail.com" target="_blank">inglis.dl@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi Manuel,<br><br>the example code in<br>Wiki/VTK/Examples/Cxx/Images/PickingAPixel<br>
</div>provides the world coordinates of the picked location. If you want image i,j,k<br></div>
indices, you have to convert those coordinates yourself using the image data's<br></div>origin and spacing information.<br></div>double* o = image->GetOrigin();<br></div>double* s = image->GetSpacing();<br></div>
int x = static_cast<int>( ( x_world_pos - o[0] ) / s[0] + 0.5 );<br><br><div><div><div><div><div>do similar calcs for y and z.<br><br></div><div>regards,<br></div><div>Dean<br></div><div><br><br></div></div></div></div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Thu, Jun 20, 2013 at 6:39 PM, Manuel Corrales <span dir="ltr"><<a href="mailto:manuelcorrales@gmail.com" target="_blank">manuelcorrales@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello, <div><br></div><div>I am displaying a DICOM series using vtk and "navigating" through the slices using mouse interaction. I need to pick a pixel from the displayed image, and I expected to get something like an array of coordinates e.g: (142, 342, 13) assuming I can use this to actually fetch the data from the vtkImageData structure.</div>
<div><br></div><div>I tried to use the PickPixel and PickPixel examples from the wiki, but I get coordinates with negative numbers </div><div><br></div><div>(Location: ( -49.3894, 37.2297, -97.2094 )) </div><div><br></div>
<div>and don't know what to do with that. My goal is to be able to pick a pixel, get a coordinate and being able to use that coordinate to fetch the pixel color from the vtkImageData.</div><div><br></div><div>Any hints?</div>
<div><br></div><div>Regards,</div><div>Manuel.</div><div><br></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>