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> </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> </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) imagedata (=3D grid)</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT> </DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial>Thank you very much!!!</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT> </DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial>Peter.</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT> </DIV>=0A=
<DIV dir=3Dltr><FONT face=3DArial></FONT> </DIV>=0A=
<DIV dir=3Dltr><FONT color=3D#000000 size=3D3 =
face=3DArial></FONT> </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 <biddisco at cscs.ch> wrote:<BR>> PolyData =
consists of flat 2D elements in 3D space. If you try to find the<BR>> =
point inside the cell, it needs to be 'infinitessimally' accurate for it =
to<BR>> actually lie inside a cell. Each point of the image is tested =
against the<BR>> polygons, but oinly very rarely will one lie exactly =
inside a polygon. What<BR>> you want to do would work with =
UnstructuredGrid 3D cells, but not with<BR>> Polydata. You should =
reevaluate wht it is you're trying to do and think of<BR>> another =
way. (are you sure you don't want to probe the other way =
around?)<BR>><BR>> JB<BR>><BR>> Bill<BR>><BR>> Thank =
you for your help!<BR>><BR>> Yes, unfortunately both data sets =
overlap.<BR>><BR>> This is the code I use for =
testing:<BR>><BR>><BR>> vtkSphereSource *sphere =3D =
vtkSphereSource::New();<BR>> =
sphere->SetRadius(4);<BR>> =
sphere->SetThetaResolution(50);<BR>> =
sphere->SetPhiResolution(50);<BR>> =
sphere->Update();<BR>> vtkSimpleElevationFilter =
*elevation =3D vtkSimpleElevationFilter::New();<BR>> =
elevation->SetInput(sphere->GetOutput());<BR>> =
elevation->SetVector(0,1,0);<BR>> =
elevation->Update();<BR>><BR>> vtkImageData =
*image =3D 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();<BR>> // 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,<BR>> -(dim[2]-1)*spacing[2]/2);<BR>> =
image->Update();<BR>> // Check if the data =
overlap<BR>> double boundsInput[6], =
boundsSource[6];<BR>> =
image->GetBounds(boundsInput);<BR>> =
elevation->GetOutput()->GetBounds(boundsSource);<BR>>=
;<BR>> // probe the sphere with the imagedata<BR>> =
vtkProbeFilter *probe =3D vtkProbeFilter::New();<BR>> =
probe->SetInput(image);<BR>> =
probe->SetSource(elevation->GetOutput());<BR>> =
probe->Update();<BR>><BR>> =
vtkStructuredPointsWriter *writer =3D =
vtkStructuredPointsWriter::New();<BR>> =
writer->SetFileName("Sphere_probed.vtk");<BR>> =
writer->SetInput(probe->GetOutput());<BR>> =
writer->Write();<BR>><BR>> Sphere_probed.vtk only =
contains scalars of 0.0.<BR>><BR>> =
Peter.<BR>><BR>><BR>><BR>> =
________________________________<BR>> Von: Bill Lorensen [<A =
href=3D"mailto:bill.lorensen at gmail.com">mailto:bill.lorensen at gmail.com</A=
>]<BR>> Gesendet: Sa 12.09.2009 17:35<BR>> An: Boettcher, Dr. =
Peter<BR>> Cc: vtkusers at vtk.org<BR>> Betreff: Re: [vtkusers] =
vtkPolyData as source of vtkProbeFilter does not<BR>> =
work<BR>><BR>> 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 at 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 =3D =
vtkPolyData<BR>>><BR>>> Input =
=3D 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=3D"http://www.kitware.com/opensource/opensource.html">http://www.kit=
ware.com/opensource/opensource.html</A><BR>>><BR>>> Please =
keep messages on-topic and check the VTK FAQ at:<BR>>> <A =
href=3D"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=3D"http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/=
mailman/listinfo/vtkusers</A><BR>>><BR>>><BR>><BR>> =
________________________________<BR>> =
_______________________________________________<BR>> Powered by =
www.kitware.com<BR>><BR>> Visit other Kitware open-source projects =
at<BR>> <A =
href=3D"http://www.kitware.com/opensource/opensource.html">http://www.kit=
ware.com/opensource/opensource.html</A><BR>><BR>> Please keep =
messages on-topic and check the VTK FAQ at:<BR>> <A =
href=3D"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=3D"http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/=
mailman/listinfo/vtkusers</A><BR>><BR>><BR>> --<BR>> John =
Biddiscombe, &=
nbsp; &n=
bsp; email:biddisco @ cscs.ch<BR>> <A =
href=3D"http://www.cscs.ch/">http://www.cscs.ch/</A><BR>> CSCS, Swiss =
National Supercomputing Centre | Tel: +41 (91) =
610.82.07<BR>> Via Cantonale, 6928 Manno, =
Switzerland | Fax: +41 (91) =
610.82.82<BR>><BR>> =
_______________________________________________<BR>> Powered by =
www.kitware.com<BR>><BR>> Visit other Kitware open-source projects =
at<BR>> <A =
href=3D"http://www.kitware.com/opensource/opensource.html">http://www.kit=
ware.com/opensource/opensource.html</A><BR>><BR>> Please keep =
messages on-topic and check the VTK FAQ at:<BR>> <A =
href=3D"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=3D"http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/=
mailman/listinfo/vtkusers</A><BR>><BR>><BR></FONT></P></DIV></BODY>=
</HTML>
------_=_NextPart_001_01CA33D1.4CC93EA1--
More information about the vtkusers
mailing list