No subject


Mon Aug 10 18:29:21 EDT 2009


// vtkProbeFilter is a filter that computes point attributes (e.g., =
scalars,
// vectors, etc.) at specified point positions. The filter has two =
inputs:
// the Input and Source. The Input geometric structure is passed through =
the
// filter. The point attributes are computed at the Input point =
positions
// by interpolating into the source data. For example, we can compute =
data
// values on a plane (plane specified as Input) from a volume (Source).
// The cell data of the source data is copied to the output based on in
// which source cell each input point is. If an array of the same name =
exists
// both in source's point and cell data, only the one from the point =
data is
// probed.

On Sat, Sep 12, 2009 at 12:24 PM, John Biddiscombe <biddisco at cscs.ch> =
wrote:
> 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?)
>
> JB
>
> Bill
>
> Thank you for your help!
>
> Yes, unfortunately both data sets overlap.
>
> This is the code I use for testing:
>
>
>  vtkSphereSource *sphere =3D vtkSphereSource::New();
>   sphere->SetRadius(4);
>   sphere->SetThetaResolution(50);
>   sphere->SetPhiResolution(50);
>   sphere->Update();
>  vtkSimpleElevationFilter *elevation =3D =
vtkSimpleElevationFilter::New();
>   elevation->SetInput(sphere->GetOutput());
>   elevation->SetVector(0,1,0);
>   elevation->Update();
>
>  vtkImageData *image =3D vtkImageData::New();
>   image->SetDimensions(100,100,100);
>   image->SetSpacing(0.1,0.1,0.1);
>   image->SetScalarTypeToDouble();
>   image->SetNumberOfScalarComponents(1);
>   image->AllocateScalars();
>   image->Update();
>   // Center the image over the sphere
>   int dim[3];
>   double spacing[3];
>   image->GetDimensions(dim);
>   image->GetSpacing(spacing);
>   image->SetOrigin(-(dim[0]-1)*spacing[0]/2, -(dim[1]-1)*spacing[1]/2,
> -(dim[2]-1)*spacing[2]/2);
>   image->Update();
>   // Check if the data overlap
>   double boundsInput[6], boundsSource[6];
>   image->GetBounds(boundsInput);
>   elevation->GetOutput()->GetBounds(boundsSource);
>
>  // probe the sphere with the imagedata
>  vtkProbeFilter *probe =3D vtkProbeFilter::New();
>   probe->SetInput(image);
>   probe->SetSource(elevation->GetOutput());
>   probe->Update();
>
>   vtkStructuredPointsWriter *writer =3D =
vtkStructuredPointsWriter::New();
>   writer->SetFileName("Sphere_probed.vtk");
>   writer->SetInput(probe->GetOutput());
>   writer->Write();
>
> Sphere_probed.vtk only contains scalars of 0.0.
>
> Peter.
>
>
>
> ________________________________
> Von: Bill Lorensen [mailto:bill.lorensen at gmail.com]
> Gesendet: Sa 12.09.2009 17:35
> An: Boettcher, Dr. Peter
> Cc: vtkusers at vtk.org
> Betreff: Re: [vtkusers] vtkPolyData as source of vtkProbeFilter does =
not
> work
>
> It should work. Are you sure they overlap? Check the bounds for both
> the source and inoput.
>
> On Sat, Sep 12, 2009 at 10:56 AM, Boettcher, Dr. Peter
> <Boettcher at kleintierklinik.uni-leipzig.de> wrote:
>> Dear all
>>
>>
>>
>> I would like to probe a vtkPolyData (e.g. a sphere) with a =
vtkImageData:
>>
>> Source =3D vtkPolyData
>>
>> Input =3D vtkImageData
>>
>>
>>
>> Unfortunately vtkProbeFilter always returns -1 when calling
>> FindCell(x,NULL,-1,tol2,subId,pcoords,weights) and therefore the =
image is
>> passed through vtkProbeFilter remaining unchanged as no interpolation =
of
>> scalars is performed at any point of the vtkImageData. Both data =
overlaps
>> each other completely. Therefore, probing should give valuable =
results!
>>
>>
>>
>> I think it has something to do with tol2. Any suggestions?
>>
>>
>>
>> Thanks - Peter.
>>
>>
>>
>> Using vtkGaussianSplatter works well. However no scalars are splatted =
into
>> the vtkImageData.
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
> ________________________________
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> --
> John Biddiscombe,                            email:biddisco @ cscs.ch
> http://www.cscs.ch/
> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



------_=_NextPart_001_01CA33D1.4CC93EA1
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<HTML dir=3Dltr><HEAD><TITLE>Re: [vtkusers] vtkPolyData as source of =
vtkProbeFilter does not work</TITLE>=0A=
<META content=3D"text/html; charset=3Dunicode" http-equiv=3DContent-Type>=0A=
<META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18812"></HEAD>=0A=
<BODY>=0A=
<DIV dir=3Dltr id=3DidOWAReplyText6598>=0A=
<DIV dir=3Dltr><FONT color=3D#000000 size=3D3 face=3DArial>Thank you =
both!</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial>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>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial>In the mean time I found a similar =
approach in the vtk wiki pages (<A =
href=3D"http://www.vtk.org/Wiki/Demystifying_the_vtkProbeFilter">http://w=
ww.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 (=3D grid)</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial>Thank you very much!!!</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial>Peter.</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT color=3D#000000 size=3D3 =
face=3DArial></FONT>&nbsp;</DIV></DIV>=0A=
<DIV dir=3Dltr id=3DidSignature76962>=0A=
<DIV><FONT color=3D#000000 size=3D2 =
face=3DArial>------------------------------------</FONT></DIV>=0A=
<DIV><FONT color=3D#000000 size=3D2 face=3DArial>Peter B=F6ttcher, Dr =
med vet, DipECVS</FONT></DIV>=0A=
<DIV><FONT color=3D#000000 size=3D2 face=3DArial><FONT size=3D2 =
face=3DArial><SPAN style=3D"FONT-FAMILY: Arial; FONT-SIZE: =
10pt">European Veterinary Specialist in =
Surgery</SPAN></FONT></FONT></DIV>=0A=
<DIV><FONT color=3D#000000 size=3D2 face=3DArial><FONT size=3D2 =
face=3DArial><SPAN style=3D"FONT-FAMILY: Arial; FONT-SIZE: =
10pt">Fachtierarzt f=FCr Kleintierchirurgie</SPAN></FONT></FONT></DIV>=0A=
<DIV><FONT color=3D#000000 size=3D2 face=3DArial><FONT size=3D2 =
face=3DArial><SPAN style=3D"FONT-FAMILY: Arial; FONT-SIZE: =
10pt"></SPAN></FONT></FONT><FONT face=3DArial><FONT size=3D2>Klinik =
f=FCr Kleintiere</FONT> <BR><FONT size=3D2>Universit=E4t Leipzig</FONT> =
<BR><FONT size=3D2>An den Tierkliniken 23</FONT> <BR><FONT =
size=3D2>D-04103 Leipzig (Germany)</FONT></FONT></DIV>=0A=
<DIV><FONT face=3DArial><FONT size=3D2>Tel: +49-341-9738700</FONT> =
<BR><FONT size=3D2>Fax: +49-341-9738799</FONT></FONT></DIV>=0A=
<DIV><FONT face=3DArial><FONT size=3D2>email: <A =
href=3D"mailto:boettcher at kleintierklinik.uni-leipzig.de">boettcher at kleint=
ierklinik.uni-leipzig.de</A></FONT><BR></FONT></DIV></DIV>=0A=
<DIV dir=3Dltr><BR>=0A=
<HR tabIndex=3D-1>=0A=
<FONT size=3D2 face=3DTahoma><B>Von:</B> Bill Lorensen =
[mailto:bill.lorensen at 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 at vtk.org<BR><B>Betreff:</B> Re: [vtkusers] vtkPolyData as source =
of vtkProbeFilter does not work<BR></FONT><BR></DIV>=0A=
<DIV>=0A=
<P><FONT size=3D2>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=3D"http://marchingcubes.org/images/4/49/SciToolsLorensen1998.pdf">ht=
tp://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 at 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 =3D =
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 =3D 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 =3D 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 =3D 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 =3D =
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=3D"mailto:bill.lorensen at gmail.com">mailto:bill.lorensen at gmail.com</A=
>]<BR>&gt; Gesendet: Sa 12.09.2009 17:35<BR>&gt; An: Boettcher, Dr. =
Peter<BR>&gt; Cc: vtkusers at 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 at 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 =3D =
vtkPolyData<BR>&gt;&gt;<BR>&gt;&gt; Input =
=3D&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=3D"http://www.kitware.com/opensource/opensource.html">http://www.kit=
ware.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=3D"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=3D"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=3D"http://www.kitware.com/opensource/opensource.html">http://www.kit=
ware.com/opensource/opensource.html</A><BR>&gt;<BR>&gt; Please keep =
messages on-topic and check the VTK FAQ at:<BR>&gt; <A =
href=3D"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=3D"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;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; email:biddisco @ cscs.ch<BR>&gt; <A =
href=3D"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=3D"http://www.kitware.com/opensource/opensource.html">http://www.kit=
ware.com/opensource/opensource.html</A><BR>&gt;<BR>&gt; Please keep =
messages on-topic and check the VTK FAQ at:<BR>&gt; <A =
href=3D"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=3D"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>
------_=_NextPart_001_01CA33D1.4CC93EA1--


More information about the vtkusers mailing list