<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
PolyData consists of flat 2D elements in 3D space. If you try to find
the point inside the cell, it needs to be 'infinitessimally' accurate
for it to actually lie inside a cell. Each point of the image is tested
against the polygons, but oinly very rarely will one lie exactly inside
a polygon. What you want to do would work with UnstructuredGrid 3D
cells, but not with Polydata. You should reevaluate wht it is you're
trying to do and think of another way. (are you sure you don't want to
probe the other way around?)<br>
<br>
JB<br>
<blockquote
cite="mid:83FB51056FB3664CB2A09728F5E9187754E1D2@email.ktk.uni-leipzig.de"
type="cite">
<meta content="text/html; charset=unicode" http-equiv="Content-Type">
<meta name="GENERATOR" content="MSHTML 8.00.6001.18812">
<div dir="ltr" id="idOWAReplyText79066">
<div dir="ltr"><font color="#000000" face="Arial" size="3">Bill</font></div>
<div dir="ltr"> </div>
<div dir="ltr"><font face="Arial">Thank you for your help!</font></div>
<div dir="ltr"> </div>
<div dir="ltr"><font face="Arial">Yes, unfortunately both data sets
overlap. </font></div>
<div dir="ltr"> </div>
<div dir="ltr"><font face="Arial">This is the code I use for testing:</font></div>
<div dir="ltr"> </div>
<div dir="ltr"> </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"></font>
<div dir="ltr"><font face="Arial"><br>
<em> vtkSimpleElevationFilter *elevation =
vtkSimpleElevationFilter::New();<br>
elevation->SetInput(sphere->GetOutput());<br>
elevation->SetVector(0,1,0);<br>
elevation->Update();<br>
</em></font></div>
<div dir="ltr"><font face="Arial"><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></font></div>
<div dir="ltr"><font face="Arial"><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></font></div>
<div dir="ltr"><font face="Arial"><br>
<em> // Check if the data overlap<br>
double boundsInput[6], boundsSource[6];<br>
image->GetBounds(boundsInput);<br>
elevation->GetOutput()->GetBounds(boundsSource);</em></font></div>
<div dir="ltr"><font face="Arial"><em> </em></font></div>
<div dir="ltr"><font face="Arial"><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></font></div>
<div dir="ltr"><font face="Arial"><em></em> </font></div>
<div dir="ltr"><font face="Arial"><em> vtkStructuredPointsWriter
*writer = vtkStructuredPointsWriter::New();<br>
writer->SetFileName("Sphere_probed.vtk");<br>
writer->SetInput(probe->GetOutput());<br>
writer->Write();</em></font></div>
<div dir="ltr"><font face="Arial"> </font></div>
<div dir="ltr"><font face="Arial"><font color="#ff0000">Sphere_probed.vtk
only contains scalars of 0.0.</font></font></div>
<div dir="ltr"><font face="Arial"> </font></div>
<div dir="ltr"><font face="Arial">Peter.</font></div>
<div dir="ltr"> </div>
<div dir="ltr"> </div>
</div>
<div dir="ltr" id="idSignature39463">
<div> </div>
</div>
<div dir="ltr"><br>
<hr tabindex="-1">
<font face="Tahoma" size="2"><b>Von:</b> Bill Lorensen
[<a class="moz-txt-link-freetext" href="mailto:bill.lorensen@gmail.com">mailto:bill.lorensen@gmail.com</a>]<br>
<b>Gesendet:</b> Sa 12.09.2009 17:35<br>
<b>An:</b> Boettcher, Dr. Peter<br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><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>
<a class="moz-txt-link-rfc2396E" href="mailto:Boettcher@kleintierklinik.uni-leipzig.de"><Boettcher@kleintierklinik.uni-leipzig.de></a> 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 <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a moz-do-not-send="true"
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 moz-do-not-send="true" 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 moz-do-not-send="true"
href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</font></p>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="78">--
John Biddiscombe, email:biddisco @ cscs.ch
<a class="moz-txt-link-freetext" href="http://www.cscs.ch/">http://www.cscs.ch/</a>
CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82</pre>
</body>
</html>