<div dir="ltr"><div>Hi Santosh,</div><div><br></div><div>For 2D cells its difficult to find a point that is exactly on the cell due to floating point precision issues. Some kind of tolerance will always be required. When "ComputeTolerance" is on, the filter tries to compute this tolerance value based on the input dataset. In your case it seems to be not good enough. I recall making some improvements to the tolerance code, but those are in newer versions of VTK. If possible, you should try the latest version.</div><div><br></div><div>-Sujin</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 17, 2018 at 9:39 AM, Santosh Biradar <span dir="ltr"><<a href="mailto:scbiradar@gmail.com" target="_blank">scbiradar@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">As you pointed out, the issue is with the tolerance. By setting the tolerance I was able to get correct probed values. <div>However, my input dataset can keep changing and I am not sure I can really set an optimum tolerance value each time. </div><div><br><div>Basically what I observed in the implementation of the Probe Filter is that it picks a cell based on the tolerance set and then if it feels the cell is actually "far" from the probe location, it returns the zero values in the output point data.</div><div><br></div><div>I dont understand why does the probe filter pick the wrong cell in the first place. I am doubting the FindCell call here. Why does it pick the right or wrong cell arbitrarily on only ever so slight variation in the input probe location is not clear to me. </div><div>I am inclining towards using a cell picker to get the "correct" cell id and then doing interpolation myself to get the point data from the points of the cell as you suggested.</div><div>Thanks Sujin for pointing me in the right direction.</div><div><br></div><div>Thanks,</div><div>Santosh</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 16, 2018 at 7:34 PM, Sujin Philip <span dir="ltr"><<a href="mailto:sujin.philip@kitware.com" target="_blank">sujin.philip@kitware.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>Hi Santosh,<br></div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>If I understand correctly, the method you suggested will give the value of the scalar from the cell data.</div></blockquote></span><div>Correct.</div><span><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">However,
I want to get the interpolated value at any arbitrary position, which
is why I felt the probe filter is the correct choice(?).</span></div></blockquote></span><div>Probe filter will do that for you. If it is just a few points you can also use the "weights" you get from the call to "FindCell" to do the interpolation yourself. There is an overloaded "FindCell" that will give you the "vtkCell". From there, you can get the ids of the cell's points.<br></div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Of what I understand, the probe filter returns interpolated point data or it returns the cell data <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">if the point data is not available.</span></span></div></blockquote></span><div>Your understanding is correct.<br></div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">On
my data set, the probe filter's output has all the arrays of the point
data but the values are all zero. This happens on probing random
positions on the surface of the dataset. Do let me know if you need any
further information. </span></span></div></blockquote><div></div></span><div>If the cells in your input dataset are 2D cells then the tolerance maybe the issue. Try setting ComputeTolerence to false and experiment with SetTolerance and see if that works.</div><div><br></div><div>Thanks</div><span class="m_1578737378810864423HOEnZb"><font color="#888888"><div>Sujin</div><div> </div></font></span></div><div class="m_1578737378810864423HOEnZb"><div class="m_1578737378810864423h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 16, 2018 at 8:53 AM, Santosh Biradar <span dir="ltr"><<a href="mailto:scbiradar@gmail.com" target="_blank">scbiradar@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 a lot Sujin.<div>If I understand correctly, the method you suggested will give the value of the scalar from the cell data.</div><div>I am assuming I can use FindPoint to get the closest point and get the point data from that point id.</div><div>
<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">However, I want to get the interpolated value at any arbitrary position, which is why I felt the probe filter is the correct choice(?).</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Of what I understand, the probe filter returns interpolated point data or it returns the cell data <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">if the point data is not available.</span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">On my data set, the probe filter's output has all the arrays of the point data but the values are all zero. This happens on probing random positions on the surface of the dataset. Do let me know if you need any further information. </span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thanks again,</span></span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Santosh</span></span></div><div><br><div><br></div></div></div><div class="m_1578737378810864423m_8781401025274503112HOEnZb"><div class="m_1578737378810864423m_8781401025274503112h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 14, 2018 at 7:39 PM, Sujin Philip <span dir="ltr"><<a href="mailto:sujin.philip@kitware.com" target="_blank">sujin.philip@kitware.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>Hi Santosh,</div><div><br></div><div>I cannot say for sure what is going wrong in the probe filter without more information. Looking at your code it looks like all you want to do is to find a cell that contains a given point and get its cell attribute. An easier way to achieve that would be:</div><div><br></div><div><span style="font-family:monospace,monospace">tol2 = 1e-6;<br>double pcoords[3];<br>double weights[8]; // size based on the max number of points in any of "input's" cells<br>double pt[3] = { x, y, z };<br>auto cellId = input->FindCell(pt, NULL, -1, tol2, 0, pcoords, weights);<br>auto attr = vtkDataArray::SafeDownCast(inp<wbr>ut->GetCellData().GetAbstractA<wbr>rray("T"));<br>double val = 0.0;<br>attr->GetTuple(cellId, &val);</span><br></div><div><br></div><div>Hope this helps</div><div><br></div><div></div><div>-Sujin</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_1578737378810864423m_8781401025274503112m_9106585612765893220h5">On Tue, Aug 14, 2018 at 7:54 AM, Santosh Biradar <span dir="ltr"><<a href="mailto:scbiradar@gmail.com" target="_blank">scbiradar@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 class="m_1578737378810864423m_8781401025274503112m_9106585612765893220h5"><div dir="ltr">Hi VTKers,<div><br></div><div>I am trying to use the vtkProbeFilter on an unstructured data set. I am using a cell to point filter on my input dataset and trying to probe the output of the cell to point filter</div><div><br></div><div>I have a snippet for what I am doing:</div><div><br></div><div>#picker for getting the point</div><div><div>picker = vtk.vtkCellPicker()</div><div>picker.PickFromListOn()</div><div>picker.AddPickList(c2pactor)</div><div>picker.SetTolerance(0.000001*r<wbr>eader.GetOutput().GetLength())</div><div>picker.Pick(x, y, 0, renderer)</div><div>points = picker.GetPickedPositions()</div><div>numPoints = points.GetNumberOfPoints()</div><div>print numPoints</div><div>if numPoints < 1: </div><div> return</div><div>pnt = points.GetPoint(0)</div></div><div><br></div><div>#probe filter</div><div><div>pt = vtk.vtkPoints()</div><div>pt.InsertPoint(0, x, y, z)</div><div>polydata = vtk.vtkPolyData()</div><div>polydata.SetPoints(pt)</div><div>probe = vtk.vtkProbeFilter()</div><div>probe.SetInputData(polydata)</div><div>probe.SetSourceData(c2p.GetOut<wbr>put())</div><div> </div><div>probe.Update()</div><div><br></div><div>val = probe.GetPolyDataOutput().GetP<wbr>ointData().GetScalars("T").Get<wbr>Range(0)[0]</div></div><div><br></div><div>Now, I am getting inconsistent behavior of the probe filter. </div><div>Sometimes, I get the values of all the point data arrays as 0.0 for the probed location.</div><div>I dont understand this behavior. It does work correctly but not always. </div><div><br></div><div><br></div><div>Alternately, I tried using the picker.GetCellId() and picker.GetPointId() to directly fetch the value from the actor's input dataset (in this case, output of cell to point filter). Again here, the point id obtained always seems to be only a particular point in the cell irresepctive of whether probed location is near that point or any other point in that cell. So, I end up getting point data of a particular point in that cell no matter where I probe in that cell. </div><div>Is using a vtkPointPicker the correct option here?<br></div><div><br></div><div>Also, should I explore using vtkPointLocator/vtkCellLocator ?</div><div><br></div><div>I hope the question is clear. I am using VTK-6.3 on Windows.</div><div><br></div><div>Thanks,</div><div>Santosh</div><div><br></div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<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/opensou<wbr>rce/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_FA<wbr>Q</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=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mai<wbr>lman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>