<div dir="ltr">point picker or cell picker won't give you the same ijk since one will be the point ijk vs the cell one.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 18, 2019 at 11:42 AM Andrzej Marciniak <<a href="mailto:marciniak.andrzej.zg@gmail.com">marciniak.andrzej.zg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Sebastien,<br>
<br>
Thank you for the tip - it works for me. Now, I have only a problem with<br>
precision in finding IJK. <br>
Should I better use vtkPicker or vtkMappers to get IJK position of selected<br>
voxel? I have made a simple experiment with both ways to calculate IJK and I<br>
got different results. <br>
<br>
 renderWindow.getInteractor().onRightButtonPress((callData) => {<br>
  Â  Â  Â  Â  Â  if (renderer !== callData.pokedRenderer) {<br>
  Â  Â  Â  Â  Â  Â  Â  return;<br>
  Â  Â  Â  Â  Â  }<br>
  Â  Â  Â  Â  Â  const pos = callData.position;<br>
  Â  Â  Â  Â  Â  const point = [pos.x, pos.y, 0.0];<br>
  Â  Â  Â  Â  Â  picker.pick(point, renderer);<br>
  Â  Â  Â  Â  Â  const worldPos = picker.getPickedPositions()[0]; <br>
//I have only one Actor in renderer but 3 mappers set on different planes<br>
  Â  Â  Â  Â  Â  let slices = null;<br>
  Â  Â  Â  Â  Â  try {<br>
  Â  Â  Â  Â  Â  Â  Â  slices = mappers.map((el) => {  Â  Â  Â  Â  Â  Â <br>
  Â  Â  Â  Â  Â  Â  Â  Â  Â  return el.getSliceAtPosition(worldPos) // this is how I<br>
get I,J,K with ImageMapper API<br>
  Â  Â  Â  Â  Â  Â  Â  });<br>
  Â  Â  Â  Â  Â  }<br>
  Â  Â  Â  Â  Â  catch (err) {  alert("You cannot pick a point outside MRI<br>
volume");<br>
  Â  Â  Â  Â  Â  Â  Â  return;<br>
  Â  Â  Â  Â  Â  }<br>
  Â  Â  Â  Â  Â  const pointIndex = slices[0] + slices[1] * dims[0] + slices[2] *<br>
dims[0] * dims[1];<br>
  Â  Â  Â  Â  Â  const pointIndex2 = picker.getCellIJK()[0] <br>
  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â + picker.getCellIJK()[1] * dims[0] <br>
  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â + picker.getCellIJK()[2] * dims[0] * dims[1];<br>
  Â  Â  Â  Â  Â  if (pointIndex===pointIndex2)<br>
inputData.getPointData().getScalars().getData()[pointIndex]=1983;  Â  Â  Â  Â  Â  <br>
  Â  Â  Â  Â  Â  else {<br>
<br>
inputData.getPointData().getScalars().getData()[pointIndex]=1700;<br>
  Â  Â  Â  Â  Â  Â  Â  inputData.getPointData().getScalars().getData()[pointIndex2]<br>
= 1500;<br>
  Â  Â  Â  Â  Â  }<br>
  Â  Â  Â  });<br>
<<a href="http://vtk.1045678.n5.nabble.com/file/t342677/pickerProblem.png" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/file/t342677/pickerProblem.png</a>> <br>
As a result I have different voxels marked (please see image).  White voxel<br>
is when they agree, light- and dark-grey when they don't. The results are<br>
different when the selected point on canvas is close to the border of voxel<br>
(points 1 and 3). <br>
Which way is better?  Can be direction of the vtkDataImage problem here (its<br>
not aligned with xyz coordinates)?<br>
Thank you again <br>
Andrzej<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div>