<div dir="ltr"><div style>Hello all,</div><div style>I'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 style><br></div><div style>There are some screen shots at: <a href="https://plus.google.com/photos/101839812291734892344/albums/5881253191058882961?authkey=CIOdsYjQi8zKjQE">https://plus.google.com/photos/101839812291734892344/albums/5881253191058882961?authkey=CIOdsYjQi8zKjQE</a></div>
<div style><br></div><div style>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 style><br></div><div style>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 style><br></div><div style><div><font face="courier new, monospace">#include <vtkUnstructuredGridReader.h></font></div><div><font face="courier new, monospace">#include <vtkXMLUnstructuredGridWriter.h></font></div>
<div><font face="courier new, monospace">#include <vtkPolyData.h></font></div><div><font face="courier new, monospace">#include <vtkUnstructuredGrid.h></font></div><div><font face="courier new, monospace">#include <vtkXMLPolyDataReader.h></font></div>
<div><font face="courier new, monospace">#include <vtkXMLPolyDataWriter.h></font></div><div><font face="courier new, monospace">#include <vtkProbeFilter.h></font></div><div><font face="courier new, monospace">#include <vtkSmartPointer.h></font></div>
<div><font face="courier new, monospace">#include <vtkAppendFilter.h></font></div><div><font face="courier new, monospace">#include <vtkPointData.h></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<vtkUnstructuredGridReader> volumeReader =</font></div><div><font face="courier new, monospace"> vtkSmartPointer<vtkUnstructuredGridReader>::New();</font></div>
<div><font face="courier new, monospace"> volumeReader->SetFileName("/home/seth/Desktop/volume.vtk");</font></div><div><font face="courier new, monospace"> volumeReader->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<vtkXMLPolyDataReader> polyReader =</font></div><div><font face="courier new, monospace"> vtkSmartPointer<vtkXMLPolyDataReader>::New();</font></div>
<div><font face="courier new, monospace"> polyReader->SetFileName("/home/seth/Desktop/aligned.vtp");</font></div><div><font face="courier new, monospace"> polyReader->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<vtkPolyData> inputSurface = polyReader->GetOutput();</font></div>
<div><font face="courier new, monospace"> unsigned int numberOfArrays = inputSurface->GetPointData()->GetNumberOfArrays();</font></div><div><font face="courier new, monospace"> for (unsigned int i = 0; i < numberOfArrays; ++i)</font></div>
<div><font face="courier new, monospace"> {</font></div><div><font face="courier new, monospace"> inputSurface->GetPointData()->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<<"Images Read"<<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<vtkAppendFilter> appender =</font></div>
<div><font face="courier new, monospace"> vtkSmartPointer<vtkAppendFilter>::New();</font></div><div><font face="courier new, monospace"> appender->SetInput(inputSurface);</font></div><div><font face="courier new, monospace"> appender->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<vtkProbeFilter> probe =</font></div>
<div><font face="courier new, monospace"> vtkSmartPointer<vtkProbeFilter>::New();</font></div><div><font face="courier new, monospace"> probe->SetInput(appender->GetOutput());</font></div><div><font face="courier new, monospace"> probe->SetSource(volumeReader->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<vtkXMLUnstructuredGridWriter> polyWirter =</font></div>
<div><font face="courier new, monospace"> vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();</font></div><div><font face="courier new, monospace"> polyWirter->SetInputConnection(probe->GetOutputPort());</font></div>
<div><font face="courier new, monospace"> polyWirter->SetFileName("/home/seth/Desktop/testProbe.vtu");</font></div><div><font face="courier new, monospace"> polyWirter->Write();</font></div><div><font face="courier new, monospace">}</font></div>
</div></div>