[vtkusers] vtkPolyData as source of vtkProbeFilter does not work
Boettcher, Dr. Peter
Boettcher at kleintierklinik.uni-leipzig.de
Sat Sep 12 13:48:56 EDT 2009
Thank you both!
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?
In the mean time I found a similar approach in the vtk wiki pages (http://www.vtk.org/Wiki/Demystifying_the_vtkProbeFilter). Collpasing is done before probing. A detail which should allow probing a (flat) polysurface with a (flat) imagedata (= grid)
Thank you very much!!!
Peter.
------------------------------------
Peter Böttcher, Dr med vet, DipECVS
European Veterinary Specialist in Surgery
Fachtierarzt für Kleintierchirurgie
Klinik für Kleintiere
Universität Leipzig
An den Tierkliniken 23
D-04103 Leipzig (Germany)
Tel: +49-341-9738700
Fax: +49-341-9738799
email: boettcher at kleintierklinik.uni-leipzig.de
________________________________
Von: Bill Lorensen [mailto:bill.lorensen at gmail.com]
Gesendet: Sa 12.09.2009 18:50
An: John Biddiscombe
Cc: Boettcher, Dr. Peter; vtkusers at vtk.org
Betreff: Re: [vtkusers] vtkPolyData as source of vtkProbeFilter does not work
Peter,
You can probe a volume with polydata, but you cannot probe a polydata
with a volume as John pointed out.
Peter, you have the source and input reversed. For instance if you
wanted a curvilinear reformatting of a volume, you could create a
ruled surface and probe the volume.
In this 1998 talk:
http://marchingcubes.org/images/4/49/SciToolsLorensen1998.pdf on page
70, I probed a ct volume with a sphere.
But maybe that is not what you want.
>From the documentation:
// 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 = vtkSphereSource::New();
> sphere->SetRadius(4);
> sphere->SetThetaResolution(50);
> sphere->SetPhiResolution(50);
> sphere->Update();
> vtkSimpleElevationFilter *elevation = vtkSimpleElevationFilter::New();
> elevation->SetInput(sphere->GetOutput());
> elevation->SetVector(0,1,0);
> elevation->Update();
>
> vtkImageData *image = 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 = vtkProbeFilter::New();
> probe->SetInput(image);
> probe->SetSource(elevation->GetOutput());
> probe->Update();
>
> vtkStructuredPointsWriter *writer = 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 = vtkPolyData
>>
>> Input = 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090912/d64668d2/attachment.htm>
More information about the vtkusers
mailing list