<div dir="ltr">I played with this for quite a while, but never could get it to work. In the end I made an application specific probe. The code, for others who have the same issue is:<div><br></div><div><div><font face="courier new, monospace">#include &lt;vtkUnstructuredGridReader.h&gt;</font></div>

<div><font face="courier new, monospace">#include &lt;vtkPolyData.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkUnstructuredGrid.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkXMLPolyDataReader.h&gt;</font></div>

<div><font face="courier new, monospace">#include &lt;vtkXMLPolyDataWriter.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkSmartPointer.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkPointData.h&gt;</font></div>

<div><font face="courier new, monospace">#include &lt;vtkDoubleArray.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkCellLocator.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkWedge.h&gt;</font></div>

<div><font face="courier new, monospace">#include &lt;vtkCell.h&gt;</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">int main(int argc, char **argv)</font></div>

<div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace">    // Read the volume</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkUnstructuredGridReader&gt; volumeReader =</font></div>

<div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkUnstructuredGridReader&gt;::New();</font></div><div><font face="courier new, monospace">    volumeReader-&gt;SetFileName(&quot;/home/seth/Desktop/volume.vtk&quot;);</font></div>

<div><font face="courier new, monospace">    volumeReader-&gt;Update();</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // Read the surface</font></div><div>

<font face="courier new, monospace">    vtkSmartPointer&lt;vtkXMLPolyDataReader&gt; polyReader =</font></div><div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkXMLPolyDataReader&gt;::New();</font></div>

<div><font face="courier new, monospace">    polyReader-&gt;SetFileName(&quot;/home/seth/Desktop/aligned.vtp&quot;);</font></div><div><font face="courier new, monospace">    polyReader-&gt;Update();</font></div><div><font face="courier new, monospace"><br>

</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // remove pre-existing array data</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkPolyData&gt; inputSurface = polyReader-&gt;GetOutput();</font></div>

<div><font face="courier new, monospace">    unsigned int numberOfArrays = inputSurface-&gt;GetPointData()-&gt;GetNumberOfArrays();</font></div><div><font face="courier new, monospace">    for (unsigned int i = 0; i &lt; numberOfArrays; ++i)</font></div>

<div><font face="courier new, monospace">    {</font></div><div><font face="courier new, monospace">        inputSurface-&gt;GetPointData()-&gt;RemoveArray(i);</font></div><div><font face="courier new, monospace">    }</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    std::cout&lt;&lt;&quot;Images Read&quot;&lt;&lt;std::endl;</font></div><div><font face="courier new, monospace"><br></font></div>

<div><font face="courier new, monospace">    // create a new array to hold the data</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkDoubleArray&gt; newArray = vtkSmartPointer&lt;vtkDoubleArray&gt;::New();</font></div>

<div><font face="courier new, monospace">    newArray-&gt;SetNumberOfTuples(inputSurface-&gt;GetNumberOfPoints());</font></div><div><font face="courier new, monospace">    newArray-&gt;SetNumberOfComponents(1);</font></div>

<div><font face="courier new, monospace">    newArray-&gt;SetName(&quot;Extracted MinPStrain&quot;);</font></div><div><font face="courier new, monospace">    inputSurface-&gt;GetPointData()-&gt;AddArray(newArray);</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // create a cell locator to aid in finding the cells that points belong to</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkCellLocator&gt; cellLocator =</font></div>

<div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkCellLocator&gt;::New();</font></div><div><font face="courier new, monospace">    cellLocator-&gt;SetDataSet(volumeReader-&gt;GetOutput());</font></div>

<div><font face="courier new, monospace">    cellLocator-&gt;BuildLocator();</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // these will be used in the loop to hold data</font></div>

<div><font face="courier new, monospace">    double blankTuple = 0.0;</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkWedge&gt; cCell;</font></div><div><font face="courier new, monospace">    double cPoint[3];</font></div>

<div><font face="courier new, monospace">    double closestPoint[3];</font></div><div><font face="courier new, monospace">    int subId;</font></div><div><font face="courier new, monospace">    double pcoords[3];</font></div>

<div><font face="courier new, monospace">    double dist2;</font></div><div><font face="courier new, monospace">    double weights[6];</font></div><div><font face="courier new, monospace">    double cellData[6];</font></div>

<div><font face="courier new, monospace">    double cValue;</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkIdList&gt; cellPoints;</font></div><div><font face="courier new, monospace"><br></font></div>

<div><font face="courier new, monospace">    // loop through each point in the input surface</font></div><div><font face="courier new, monospace">    for (unsigned int i = 0; i &lt; inputSurface-&gt;GetNumberOfPoints(); ++i)</font></div>

<div><font face="courier new, monospace">    {</font></div><div><font face="courier new, monospace">        // get the point location</font></div><div><font face="courier new, monospace">        inputSurface-&gt;GetPoint(i,cPoint);</font></div>

<div><font face="courier new, monospace">        // find the cell that contains the point</font></div><div><font face="courier new, monospace">        vtkIdType cCellNo = cellLocator-&gt;FindCell(cPoint);</font></div><div>

<font face="courier new, monospace">        if (cCellNo == -1)  // if the point is outside of cells, enter a value of zero in the data array</font></div><div><font face="courier new, monospace">        {</font></div><div>

<font face="courier new, monospace">            inputSurface-&gt;GetPointData()-&gt;GetArray(0)-&gt;SetTuple(i,&amp;blankTuple);</font></div><div><font face="courier new, monospace">            continue;</font></div><div>

<font face="courier new, monospace">        }</font></div><div><font face="courier new, monospace">        // get the point IDs that define the containing cell</font></div><div><font face="courier new, monospace">        cellPoints = volumeReader-&gt;GetOutput()-&gt;GetCell(cCellNo)-&gt;GetPointIds();</font></div>

<div><font face="courier new, monospace">        // get the strain values for each point in the containing cell</font></div><div><font face="courier new, monospace">        cellData[0] = *volumeReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetArray(0)-&gt;GetTuple(cellPoints-&gt;GetId(0));</font></div>

<div><font face="courier new, monospace">        cellData[1] = *volumeReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetArray(0)-&gt;GetTuple(cellPoints-&gt;GetId(1));</font></div><div><font face="courier new, monospace">        cellData[2] = *volumeReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetArray(0)-&gt;GetTuple(cellPoints-&gt;GetId(2));</font></div>

<div><font face="courier new, monospace">        cellData[3] = *volumeReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetArray(0)-&gt;GetTuple(cellPoints-&gt;GetId(3));</font></div><div><font face="courier new, monospace">        cellData[4] = *volumeReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetArray(0)-&gt;GetTuple(cellPoints-&gt;GetId(4));</font></div>

<div><font face="courier new, monospace">        cellData[5] = *volumeReader-&gt;GetOutput()-&gt;GetPointData()-&gt;GetArray(0)-&gt;GetTuple(cellPoints-&gt;GetId(5));</font></div><div><font face="courier new, monospace">        // use the EvaluatePosition method of the cell to get the interpolation function weight values. The rest of the data is not used</font></div>

<div><font face="courier new, monospace">        volumeReader-&gt;GetOutput()-&gt;GetCell(cCellNo)-&gt;EvaluatePosition(cPoint,closestPoint,subId,pcoords,dist2,weights);</font></div><div><font face="courier new, monospace">        // calculate the value at the point by multiplying each weight by the data</font></div>

<div><font face="courier new, monospace">        cValue = cellData[0]*weights[0] + cellData[1]*weights[1] + cellData[2]*weights[2] + cellData[3]*weights[3] + cellData[4]*weights[4] + cellData[5]*weights[5];</font></div><div>

<font face="courier new, monospace">        // set the data.</font></div><div><font face="courier new, monospace">        inputSurface-&gt;GetPointData()-&gt;GetArray(0)-&gt;SetTuple(i,&amp;cValue);</font></div><div><font face="courier new, monospace">    }</font></div>

<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // write the probed surface out</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt; polyWirter =</font></div>

<div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkXMLPolyDataWriter&gt;::New();</font></div><div><font face="courier new, monospace">    polyWirter-&gt;SetInput(inputSurface);</font></div><div><font face="courier new, monospace">    polyWirter-&gt;SetFileName(&quot;/home/seth/Desktop/testProbe.vtp&quot;);</font></div>

<div><font face="courier new, monospace">    polyWirter-&gt;Write();</font></div><div><font face="courier new, monospace">}</font></div></div></div><div class="gmail_extra"><br clear="all"><div><i>Seth Gilchrist, MASc, PhD Candidate<br>

<span style="font-family:courier new,monospace">+---------------------------------------+</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">Orthopaedic and Injury Biomechanics Group<br>

UBC Department of Mechanical Engineering</span><span style="font-family:courier new,monospace"></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">6th Floor-2635 Laurel Street</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">Vancouver, BC V5Z-1M9<br></span><span style="font-family:courier new,monospace">+---------------------------------------+<br><a href="mailto:seth@mech.ubc.ca" target="_blank">seth@mech.ubc.ca</a><br>

Fax 604-675-2576</span></i><br></div>
<br><br><div class="gmail_quote">On Thu, May 23, 2013 at 12:08 PM, Seth Gilchrist <span dir="ltr">&lt;<a href="mailto:seth@mech.ubc.ca" target="_blank">seth@mech.ubc.ca</a>&gt;</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>Hello all,</div><div>I&#39;m having a problem with the vtkProbeFilter. I have a vtkUnstructuredGrid volume with one data field called MinPStrain and I am trying to probe it with a vtkPolyData surface. The output indicates that the two interact in only a very small portion of the surface, when in reality they almost completely overlap.</div>


<div><br></div><div>There are some screen shots at: <a href="https://plus.google.com/photos/101839812291734892344/albums/5881253191058882961?authkey=CIOdsYjQi8zKjQE" target="_blank">https://plus.google.com/photos/101839812291734892344/albums/5881253191058882961?authkey=CIOdsYjQi8zKjQE</a></div>


<div><br></div><div>On the left is the surface and volume in their actual positions. On the right is the output of the probe, translated so that it can be viewed.</div><div><br></div><div>Most recently I have tried using the vtkAppendFilter to convert the vtkPolyData to a vtkUnstructuredGrid, but to no avail. The latest code is:</div>


<div><br></div><div><div><font face="courier new, monospace">#include &lt;vtkUnstructuredGridReader.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkXMLUnstructuredGridWriter.h&gt;</font></div>
<div><font face="courier new, monospace">#include &lt;vtkPolyData.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkUnstructuredGrid.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkXMLPolyDataReader.h&gt;</font></div>


<div><font face="courier new, monospace">#include &lt;vtkXMLPolyDataWriter.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkProbeFilter.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkSmartPointer.h&gt;</font></div>


<div><font face="courier new, monospace">#include &lt;vtkAppendFilter.h&gt;</font></div><div><font face="courier new, monospace">#include &lt;vtkPointData.h&gt;</font></div><div><font face="courier new, monospace"><br></font></div>


<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">int main(int argc, char **argv)</font></div><div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace">    // Read the volume</font></div>


<div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkUnstructuredGridReader&gt; volumeReader =</font></div><div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkUnstructuredGridReader&gt;::New();</font></div>


<div><font face="courier new, monospace">    volumeReader-&gt;SetFileName(&quot;/home/seth/Desktop/volume.vtk&quot;);</font></div><div><font face="courier new, monospace">    volumeReader-&gt;Update();</font></div><div><font face="courier new, monospace"><br>


</font></div><div><font face="courier new, monospace">    // Read the surface</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkXMLPolyDataReader&gt; polyReader =</font></div><div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkXMLPolyDataReader&gt;::New();</font></div>


<div><font face="courier new, monospace">    polyReader-&gt;SetFileName(&quot;/home/seth/Desktop/aligned.vtp&quot;);</font></div><div><font face="courier new, monospace">    polyReader-&gt;Update();</font></div><div><font face="courier new, monospace"><br>


</font></div><div><font face="courier new, monospace">    // remove pre-existing array data</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkPolyData&gt; inputSurface = polyReader-&gt;GetOutput();</font></div>


<div><font face="courier new, monospace">    unsigned int numberOfArrays = inputSurface-&gt;GetPointData()-&gt;GetNumberOfArrays();</font></div><div><font face="courier new, monospace">    for (unsigned int i = 0; i &lt; numberOfArrays; ++i)</font></div>


<div><font face="courier new, monospace">    {</font></div><div><font face="courier new, monospace">        inputSurface-&gt;GetPointData()-&gt;RemoveArray(i);</font></div><div><font face="courier new, monospace">    }</font></div>


<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    std::cout&lt;&lt;&quot;Images Read&quot;&lt;&lt;std::endl;</font></div><div><font face="courier new, monospace"><br></font></div>


<div><font face="courier new, monospace">    // convert the surface from vtkPolyData to vtkUnstructuredGrid</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkAppendFilter&gt; appender =</font></div>


<div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkAppendFilter&gt;::New();</font></div><div><font face="courier new, monospace">    appender-&gt;SetInput(inputSurface);</font></div><div><font face="courier new, monospace">    appender-&gt;Update();</font></div>


<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // probe the volume with the surface</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkProbeFilter&gt; probe =</font></div>


<div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkProbeFilter&gt;::New();</font></div><div><font face="courier new, monospace">    probe-&gt;SetInput(appender-&gt;GetOutput());</font></div><div><font face="courier new, monospace">    probe-&gt;SetSource(volumeReader-&gt;GetOutput());</font></div>


<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">    // write the probed surface out</font></div><div><font face="courier new, monospace">    vtkSmartPointer&lt;vtkXMLUnstructuredGridWriter&gt; polyWirter =</font></div>


<div><font face="courier new, monospace">        vtkSmartPointer&lt;vtkXMLUnstructuredGridWriter&gt;::New();</font></div><div><font face="courier new, monospace">    polyWirter-&gt;SetInputConnection(probe-&gt;GetOutputPort());</font></div>


<div><font face="courier new, monospace">    polyWirter-&gt;SetFileName(&quot;/home/seth/Desktop/testProbe.vtu&quot;);</font></div><div><font face="courier new, monospace">    polyWirter-&gt;Write();</font></div><div><font face="courier new, monospace">}</font></div>


</div></div>
</blockquote></div><br></div>