<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=idOWAReplyText6598>
<DIV dir=ltr><FONT color=#000000 size=3 face=Arial>Thank you both!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>The reason why I would like to probe a polysurface with an imagedata is becauseI would like to compute the distance between two polysurfaces along a given vector. vtkElevationFilter of both surfaces along this vector will color the surfaces with their height along this vector. Probing each surfaces with an imagedata along the vector results in a regular data set of my irregular polysurface along with the height values from the elevation filter. Now, after collapsing both image data along the vector I would have two grids in which the ith point corresponds to the ith point in the other grid. Substracting both scalar values (the height values) at the ith point should give the distance of both surfaces along the vector at that specific location. Or am I wrong?</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>In the mean time I found a similar approach in the vtk wiki pages (<A href="http://www.vtk.org/Wiki/Demystifying_the_vtkProbeFilter">http://www.vtk.org/Wiki/Demystifying_the_vtkProbeFilter</A>). Collpasing is done before probing. A detail which should allow probing a (flat) polysurface with a (flat)&nbsp;imagedata (= grid)</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>Thank you very much!!!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>Peter.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</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=idSignature76962>
<DIV><FONT color=#000000 size=2 face=Arial>------------------------------------</FONT></DIV>
<DIV><FONT color=#000000 size=2 face=Arial>Peter Böttcher, Dr med vet, DipECVS</FONT></DIV>
<DIV><FONT color=#000000 size=2 face=Arial><FONT size=2 face=Arial><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">European Veterinary Specialist in Surgery</SPAN></FONT></FONT></DIV>
<DIV><FONT color=#000000 size=2 face=Arial><FONT size=2 face=Arial><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">Fachtierarzt für Kleintierchirurgie</SPAN></FONT></FONT></DIV>
<DIV><FONT color=#000000 size=2 face=Arial><FONT size=2 face=Arial><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt"></SPAN></FONT></FONT><FONT face=Arial><FONT size=2>Klinik für Kleintiere</FONT> <BR><FONT size=2>Universität Leipzig</FONT> <BR><FONT size=2>An den Tierkliniken 23</FONT> <BR><FONT size=2>D-04103 Leipzig (Germany)</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>Tel: +49-341-9738700</FONT> <BR><FONT size=2>Fax: +49-341-9738799</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>email: <A href="mailto:boettcher@kleintierklinik.uni-leipzig.de">boettcher@kleintierklinik.uni-leipzig.de</A></FONT><BR></FONT></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 18:50<BR><B>An:</B> John Biddiscombe<BR><B>Cc:</B> Boettcher, Dr. Peter; 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>Peter,<BR><BR>You can probe a volume with polydata, but you cannot probe a polydata<BR>with a volume as John pointed out.<BR><BR>Peter, you have the source and input reversed. For instance if you<BR>wanted a curvilinear reformatting of a volume, you could create a<BR>ruled surface and probe the volume.<BR>In this 1998 talk:<BR><A href="http://marchingcubes.org/images/4/49/SciToolsLorensen1998.pdf">http://marchingcubes.org/images/4/49/SciToolsLorensen1998.pdf</A> on page<BR>70, I probed a ct volume with a sphere.<BR><BR>But maybe that is not what you want.<BR><BR>From the documentation:<BR><BR>// vtkProbeFilter is a filter that computes point attributes (e.g., scalars,<BR>// vectors, etc.) at specified point positions. The filter has two inputs:<BR>// the Input and Source. The Input geometric structure is passed through the<BR>// filter. The point attributes are computed at the Input point positions<BR>// by interpolating into the source data. For example, we can compute data<BR>// values on a plane (plane specified as Input) from a volume (Source).<BR>// The cell data of the source data is copied to the output based on in<BR>// which source cell each input point is. If an array of the same name exists<BR>// both in source's point and cell data, only the one from the point data is<BR>// probed.<BR><BR>On Sat, Sep 12, 2009 at 12:24 PM, John Biddiscombe &lt;biddisco@cscs.ch&gt; wrote:<BR>&gt; PolyData consists of flat 2D elements in 3D space. If you try to find the<BR>&gt; point inside the cell, it needs to be 'infinitessimally' accurate for it to<BR>&gt; actually lie inside a cell. Each point of the image is tested against the<BR>&gt; polygons, but oinly very rarely will one lie exactly inside a polygon. What<BR>&gt; you want to do would work with UnstructuredGrid 3D cells, but not with<BR>&gt; Polydata. You should reevaluate wht it is you're trying to do and think of<BR>&gt; another way. (are you sure you don't want to probe the other way around?)<BR>&gt;<BR>&gt; JB<BR>&gt;<BR>&gt; Bill<BR>&gt;<BR>&gt; Thank you for your help!<BR>&gt;<BR>&gt; Yes, unfortunately both data sets overlap.<BR>&gt;<BR>&gt; This is the code I use for testing:<BR>&gt;<BR>&gt;<BR>&gt; &nbsp;vtkSphereSource *sphere = vtkSphereSource::New();<BR>&gt; &nbsp;&nbsp;sphere-&gt;SetRadius(4);<BR>&gt; &nbsp;&nbsp;sphere-&gt;SetThetaResolution(50);<BR>&gt; &nbsp;&nbsp;sphere-&gt;SetPhiResolution(50);<BR>&gt; &nbsp;&nbsp;sphere-&gt;Update();<BR>&gt; &nbsp;vtkSimpleElevationFilter *elevation = vtkSimpleElevationFilter::New();<BR>&gt; &nbsp;&nbsp;elevation-&gt;SetInput(sphere-&gt;GetOutput());<BR>&gt; &nbsp;&nbsp;elevation-&gt;SetVector(0,1,0);<BR>&gt; &nbsp;&nbsp;elevation-&gt;Update();<BR>&gt;<BR>&gt; &nbsp;vtkImageData *image = vtkImageData::New();<BR>&gt; &nbsp;&nbsp;image-&gt;SetDimensions(100,100,100);<BR>&gt; &nbsp;&nbsp;image-&gt;SetSpacing(0.1,0.1,0.1);<BR>&gt; &nbsp;&nbsp;image-&gt;SetScalarTypeToDouble();<BR>&gt; &nbsp;&nbsp;image-&gt;SetNumberOfScalarComponents(1);<BR>&gt; &nbsp;&nbsp;image-&gt;AllocateScalars();<BR>&gt; &nbsp;&nbsp;image-&gt;Update();<BR>&gt; &nbsp;&nbsp;// Center the image over the sphere<BR>&gt; &nbsp;&nbsp;int dim[3];<BR>&gt; &nbsp;&nbsp;double spacing[3];<BR>&gt; &nbsp;&nbsp;image-&gt;GetDimensions(dim);<BR>&gt; &nbsp;&nbsp;image-&gt;GetSpacing(spacing);<BR>&gt; &nbsp;&nbsp;image-&gt;SetOrigin(-(dim[0]-1)*spacing[0]/2, -(dim[1]-1)*spacing[1]/2,<BR>&gt; -(dim[2]-1)*spacing[2]/2);<BR>&gt; &nbsp;&nbsp;image-&gt;Update();<BR>&gt; &nbsp;&nbsp;// Check if the data overlap<BR>&gt; &nbsp;&nbsp;double boundsInput[6], boundsSource[6];<BR>&gt; &nbsp;&nbsp;image-&gt;GetBounds(boundsInput);<BR>&gt; &nbsp;&nbsp;elevation-&gt;GetOutput()-&gt;GetBounds(boundsSource);<BR>&gt;<BR>&gt; &nbsp;// probe the sphere with the imagedata<BR>&gt; &nbsp;vtkProbeFilter *probe = vtkProbeFilter::New();<BR>&gt; &nbsp;&nbsp;probe-&gt;SetInput(image);<BR>&gt; &nbsp;&nbsp;probe-&gt;SetSource(elevation-&gt;GetOutput());<BR>&gt; &nbsp;&nbsp;probe-&gt;Update();<BR>&gt;<BR>&gt; &nbsp;&nbsp;vtkStructuredPointsWriter *writer = vtkStructuredPointsWriter::New();<BR>&gt; &nbsp;&nbsp;writer-&gt;SetFileName("Sphere_probed.vtk");<BR>&gt; &nbsp;&nbsp;writer-&gt;SetInput(probe-&gt;GetOutput());<BR>&gt; &nbsp;&nbsp;writer-&gt;Write();<BR>&gt;<BR>&gt; Sphere_probed.vtk only contains scalars of 0.0.<BR>&gt;<BR>&gt; Peter.<BR>&gt;<BR>&gt;<BR>&gt;<BR>&gt; ________________________________<BR>&gt; Von: Bill Lorensen [<A href="mailto:bill.lorensen@gmail.com">mailto:bill.lorensen@gmail.com</A>]<BR>&gt; Gesendet: Sa 12.09.2009 17:35<BR>&gt; An: Boettcher, Dr. Peter<BR>&gt; Cc: vtkusers@vtk.org<BR>&gt; Betreff: Re: [vtkusers] vtkPolyData as source of vtkProbeFilter does not<BR>&gt; work<BR>&gt;<BR>&gt; It should work. Are you sure they overlap? Check the bounds for both<BR>&gt; the source and inoput.<BR>&gt;<BR>&gt; On Sat, Sep 12, 2009 at 10:56 AM, Boettcher, Dr. Peter<BR>&gt; &lt;Boettcher@kleintierklinik.uni-leipzig.de&gt; wrote:<BR>&gt;&gt; Dear all<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; I would like to probe a vtkPolyData (e.g. a sphere) with a vtkImageData:<BR>&gt;&gt;<BR>&gt;&gt; Source = vtkPolyData<BR>&gt;&gt;<BR>&gt;&gt; Input =&nbsp;vtkImageData<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; Unfortunately vtkProbeFilter always returns -1 when calling<BR>&gt;&gt; FindCell(x,NULL,-1,tol2,subId,pcoords,weights) and therefore the image is<BR>&gt;&gt; passed through vtkProbeFilter remaining unchanged as no interpolation of<BR>&gt;&gt; scalars is performed at any point of the vtkImageData. Both data overlaps<BR>&gt;&gt; each other completely. Therefore, probing should give valuable results!<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; I think it has something to do with tol2. Any suggestions?<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; Thanks &#8211; Peter.<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; Using vtkGaussianSplatter works well. However no scalars are splatted into<BR>&gt;&gt; the vtkImageData.<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; _______________________________________________<BR>&gt;&gt; Powered by www.kitware.com<BR>&gt;&gt;<BR>&gt;&gt; Visit other Kitware open-source projects at<BR>&gt;&gt; <A href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A><BR>&gt;&gt;<BR>&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<BR>&gt;&gt; <A href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A><BR>&gt;&gt;<BR>&gt;&gt; Follow this link to subscribe/unsubscribe:<BR>&gt;&gt; <A href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A><BR>&gt;&gt;<BR>&gt;&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>&gt; --<BR>&gt; John Biddiscombe,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email:biddisco @ cscs.ch<BR>&gt; <A href="http://www.cscs.ch/">http://www.cscs.ch/</A><BR>&gt; CSCS, Swiss National Supercomputing Centre&nbsp; | Tel:&nbsp; +41 (91) 610.82.07<BR>&gt; Via Cantonale, 6928 Manno, Switzerland&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Fax:&nbsp; +41 (91) 610.82.82<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>