<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> </DIV>
<DIV dir=ltr><FONT face=Arial>Thank you for your help!</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial>Yes, unfortunately both data sets overlap. </FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial>This is the code I use for testing:</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial> <EM>vtkSphereSource *sphere = vtkSphereSource::New();<BR> sphere->SetRadius(4);<BR> sphere->SetThetaResolution(50);<BR> sphere->SetPhiResolution(50);<BR> sphere->Update();</EM></FONT></DIV><FONT face=Arial>
<DIV dir=ltr><BR><EM> vtkSimpleElevationFilter *elevation = vtkSimpleElevationFilter::New();<BR> elevation->SetInput(sphere->GetOutput());<BR> elevation->SetVector(0,1,0);<BR> elevation->Update();<BR> </EM></DIV>
<DIV dir=ltr><EM> vtkImageData *image = vtkImageData::New();<BR> image->SetDimensions(100,100,100);<BR> image->SetSpacing(0.1,0.1,0.1);<BR> image->SetScalarTypeToDouble();<BR> image->SetNumberOfScalarComponents(1);<BR> image->AllocateScalars();<BR> image->Update();</EM></DIV>
<DIV dir=ltr><EM> // Center the image over the sphere<BR> int dim[3];<BR> double spacing[3];<BR> image->GetDimensions(dim);<BR> image->GetSpacing(spacing);<BR> image->SetOrigin(-(dim[0]-1)*spacing[0]/2, -(dim[1]-1)*spacing[1]/2, -(dim[2]-1)*spacing[2]/2);<BR> image->Update();</EM></DIV>
<DIV dir=ltr><BR><EM> // Check if the data overlap<BR> double boundsInput[6], boundsSource[6];<BR> image->GetBounds(boundsInput);<BR> elevation->GetOutput()->GetBounds(boundsSource);</EM></DIV>
<DIV dir=ltr><EM> </EM></DIV>
<DIV dir=ltr><EM> // probe the sphere with the imagedata<BR> vtkProbeFilter *probe = vtkProbeFilter::New();<BR> probe->SetInput(image);<BR> probe->SetSource(elevation->GetOutput());<BR> probe->Update();</EM></DIV>
<DIV dir=ltr><EM></EM> </DIV>
<DIV dir=ltr><EM> vtkStructuredPointsWriter *writer = vtkStructuredPointsWriter::New();<BR> writer->SetFileName("Sphere_probed.vtk");<BR> writer->SetInput(probe->GetOutput());<BR> writer->Write();</EM></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><FONT color=#ff0000>Sphere_probed.vtk only contains scalars of 0.0.</FONT></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>Peter.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT color=#000000 size=3 face=Arial></FONT> </DIV></DIV>
<DIV dir=ltr id=idSignature39463>
<DIV><FONT face=Arial></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 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><Boettcher@kleintierklinik.uni-leipzig.de> wrote:<BR>> Dear all<BR>><BR>><BR>><BR>> I would like to probe a vtkPolyData (e.g. a sphere) with a vtkImageData:<BR>><BR>> Source = vtkPolyData<BR>><BR>> Input = vtkImageData<BR>><BR>><BR>><BR>> Unfortunately vtkProbeFilter always returns -1 when calling<BR>> FindCell(x,NULL,-1,tol2,subId,pcoords,weights) and therefore the image is<BR>> passed through vtkProbeFilter remaining unchanged as no interpolation of<BR>> scalars is performed at any point of the vtkImageData. Both data overlaps<BR>> each other completely. Therefore, probing should give valuable results!<BR>><BR>><BR>><BR>> I think it has something to do with tol2. Any suggestions?<BR>><BR>><BR>><BR>> Thanks – Peter.<BR>><BR>><BR>><BR>> Using vtkGaussianSplatter works well. However no scalars are splatted into<BR>> the vtkImageData.<BR>><BR>><BR>><BR>> _______________________________________________<BR>> Powered by www.kitware.com<BR>><BR>> Visit other Kitware open-source projects at<BR>> <A href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</A><BR>><BR>> Please keep messages on-topic and check the VTK FAQ at:<BR>> <A href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</A><BR>><BR>> Follow this link to subscribe/unsubscribe:<BR>> <A href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</A><BR>><BR>><BR></FONT></P></DIV></BODY></HTML>