[vtkusers] vtkProbeFilter inconsistency

Santosh Biradar scbiradar at gmail.com
Thu Aug 16 08:53:02 EDT 2018


Thanks a lot Sujin.
If I understand correctly, the method you suggested will give the value of
the scalar from the cell data.
I am assuming I can use FindPoint to get the closest point and get the
point data from that point id.
However, I want to get the interpolated value at any arbitrary position,
which is why I felt the probe filter is the correct choice(?).
Of what I understand, the probe filter returns interpolated point data or
it returns the cell data if the point data is not available.
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.

Thanks again,
Santosh



On Tue, Aug 14, 2018 at 7:39 PM, Sujin Philip <sujin.philip at kitware.com>
wrote:

> 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/20180816/ee1baefa/attachment.html>


More information about the vtkusers mailing list