<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>