<HTML dir=ltr><HEAD><TITLE>Re: [vtkusers] vtkPolyData as source of vtkProbeFilter does not work</TITLE>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18812"></HEAD>
<BODY>
<DIV dir=ltr id=idOWAReplyText79066>
<DIV dir=ltr><FONT color=#000000 size=3 face=Arial>Bill</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>Thank you for your help!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>Yes, unfortunately both data sets overlap. </FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>This is the code I use for testing:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>&nbsp;<EM>vtkSphereSource *sphere = vtkSphereSource::New();<BR>&nbsp;&nbsp;sphere-&gt;SetRadius(4);<BR>&nbsp;&nbsp;sphere-&gt;SetThetaResolution(50);<BR>&nbsp;&nbsp;sphere-&gt;SetPhiResolution(50);<BR>&nbsp;&nbsp;sphere-&gt;Update();</EM></FONT></DIV><FONT face=Arial>
<DIV dir=ltr><BR><EM>&nbsp;vtkSimpleElevationFilter *elevation = vtkSimpleElevationFilter::New();<BR>&nbsp;&nbsp;elevation-&gt;SetInput(sphere-&gt;GetOutput());<BR>&nbsp;&nbsp;elevation-&gt;SetVector(0,1,0);<BR>&nbsp;&nbsp;elevation-&gt;Update();<BR>&nbsp;&nbsp;</EM></DIV>
<DIV dir=ltr><EM>&nbsp;vtkImageData *image = vtkImageData::New();<BR>&nbsp;&nbsp;image-&gt;SetDimensions(100,100,100);<BR>&nbsp;&nbsp;image-&gt;SetSpacing(0.1,0.1,0.1);<BR>&nbsp;&nbsp;image-&gt;SetScalarTypeToDouble();<BR>&nbsp;&nbsp;image-&gt;SetNumberOfScalarComponents(1);<BR>&nbsp;&nbsp;image-&gt;AllocateScalars();<BR>&nbsp;&nbsp;image-&gt;Update();</EM></DIV>
<DIV dir=ltr><EM>&nbsp;&nbsp;// Center the image over the sphere<BR>&nbsp;&nbsp;int dim[3];<BR>&nbsp;&nbsp;double spacing[3];<BR>&nbsp;&nbsp;image-&gt;GetDimensions(dim);<BR>&nbsp;&nbsp;image-&gt;GetSpacing(spacing);<BR>&nbsp;&nbsp;image-&gt;SetOrigin(-(dim[0]-1)*spacing[0]/2, -(dim[1]-1)*spacing[1]/2, -(dim[2]-1)*spacing[2]/2);<BR>&nbsp;&nbsp;image-&gt;Update();</EM></DIV>
<DIV dir=ltr><BR><EM>&nbsp;&nbsp;// Check if the data overlap<BR>&nbsp;&nbsp;double boundsInput[6], boundsSource[6];<BR>&nbsp;&nbsp;image-&gt;GetBounds(boundsInput);<BR>&nbsp;&nbsp;elevation-&gt;GetOutput()-&gt;GetBounds(boundsSource);</EM></DIV>
<DIV dir=ltr><EM>&nbsp;</EM></DIV>
<DIV dir=ltr><EM>&nbsp;// probe the sphere with the imagedata<BR>&nbsp;vtkProbeFilter *probe = vtkProbeFilter::New();<BR>&nbsp;&nbsp;probe-&gt;SetInput(image);<BR>&nbsp;&nbsp;probe-&gt;SetSource(elevation-&gt;GetOutput());<BR>&nbsp;&nbsp;probe-&gt;Update();</EM></DIV>
<DIV dir=ltr><EM></EM>&nbsp;</DIV>
<DIV dir=ltr><EM>&nbsp;&nbsp;vtkStructuredPointsWriter *writer = vtkStructuredPointsWriter::New();<BR>&nbsp;&nbsp;writer-&gt;SetFileName("Sphere_probed.vtk");<BR>&nbsp;&nbsp;writer-&gt;SetInput(probe-&gt;GetOutput());<BR>&nbsp;&nbsp;writer-&gt;Write();</EM></DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr><FONT color=#ff0000>Sphere_probed.vtk only contains scalars of 0.0.</FONT></DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>Peter.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT color=#000000 size=3 face=Arial></FONT>&nbsp;</DIV></DIV>
<DIV dir=ltr id=idSignature39463>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> Bill Lorensen [mailto:bill.lorensen@gmail.com]<BR><B>Gesendet:</B> Sa 12.09.2009 17:35<BR><B>An:</B> Boettcher, Dr. Peter<BR><B>Cc:</B> vtkusers@vtk.org<BR><B>Betreff:</B> Re: [vtkusers] vtkPolyData as source of vtkProbeFilter does not work<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>It should work. Are you sure they overlap? Check the bounds for both<BR>the source and inoput.<BR><BR>On Sat, Sep 12, 2009 at 10:56 AM, Boettcher, Dr. Peter<BR>&lt;Boettcher@kleintierklinik.uni-leipzig.de&gt; wrote:<BR>&gt; Dear all<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; I would like to probe a vtkPolyData (e.g. a sphere) with a vtkImageData:<BR>&gt;<BR>&gt; Source = vtkPolyData<BR>&gt;<BR>&gt; Input =&nbsp;vtkImageData<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; Unfortunately vtkProbeFilter always returns -1 when calling<BR>&gt; FindCell(x,NULL,-1,tol2,subId,pcoords,weights) and therefore the image is<BR>&gt; passed through vtkProbeFilter remaining unchanged as no interpolation of<BR>&gt; scalars is performed at any point of the vtkImageData. Both data overlaps<BR>&gt; each other completely. Therefore, probing should give valuable results!<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; I think it has something to do with tol2. Any suggestions?<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; Thanks &#8211; Peter.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; Using vtkGaussianSplatter works well. However no scalars are splatted into<BR>&gt; the vtkImageData.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; _______________________________________________<BR>&gt; Powered by www.kitware.com<BR>&gt;<BR>&gt; Visit other Kitware open-source projects at<BR>&gt; <A href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A><BR>&gt;<BR>&gt; Please keep messages on-topic and check the VTK FAQ at:<BR>&gt; <A href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A><BR>&gt;<BR>&gt; Follow this link to subscribe/unsubscribe:<BR>&gt; <A href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A><BR>&gt;<BR>&gt;<BR></FONT></P></DIV></BODY></HTML>