[vtkusers] vtkProbeFilter inconsistency

Sujin Philip sujin.philip at kitware.com
Tue Aug 14 10:09:24 EDT 2018


Hi Santosh,

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:

tol2 = 1e-6;
double pcoords[3];
double weights[8]; // size based on the max number of points in any of
"input's" cells
double pt[3] = { x, y, z };
auto cellId = input->FindCell(pt, NULL, -1, tol2, 0, pcoords, weights);
auto attr =
vtkDataArray::SafeDownCast(input->GetCellData().GetAbstractArray("T"));
double val = 0.0;
attr->GetTuple(cellId, &val);

Hope this helps

-Sujin


On Tue, Aug 14, 2018 at 7:54 AM, Santosh Biradar <scbiradar at gmail.com>
wrote:

> Hi VTKers,
>
> 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
>
> I have a snippet for what I am doing:
>
> #picker for getting the point
> picker = vtk.vtkCellPicker()
> picker.PickFromListOn()
> picker.AddPickList(c2pactor)
> picker.SetTolerance(0.000001*reader.GetOutput().GetLength())
> picker.Pick(x, y, 0, renderer)
> points = picker.GetPickedPositions()
> numPoints = points.GetNumberOfPoints()
> print numPoints
> if numPoints < 1:
>     return
> pnt = points.GetPoint(0)
>
> #probe filter
> pt = vtk.vtkPoints()
> pt.InsertPoint(0, x, y, z)
> polydata = vtk.vtkPolyData()
> polydata.SetPoints(pt)
> probe = vtk.vtkProbeFilter()
> probe.SetInputData(polydata)
> probe.SetSourceData(c2p.GetOutput())
>
> probe.Update()
>
> val = probe.GetPolyDataOutput().GetPointData().GetScalars("T")
> .GetRange(0)[0]
>
> Now, I am getting inconsistent behavior of the probe filter.
> Sometimes, I get the values of all the point data arrays as 0.0 for the
> probed location.
> I dont understand this behavior. It does work correctly but not always.
>
>
> 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.
> Is using a vtkPointPicker the correct option here?
>
> Also, should I explore using vtkPointLocator/vtkCellLocator ?
>
> I hope the question is clear. I am using VTK-6.3 on Windows.
>
> Thanks,
> Santosh
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180814/9515f2c1/attachment.html>


More information about the vtkusers mailing list