[vtkusers] vtkPolyData as source of vtkProbeFilter does not work

Bill Lorensen bill.lorensen at gmail.com
Sat Sep 12 12:50:09 EDT 2009


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
>
>



More information about the vtkusers mailing list