[vtkusers] vtkPolyData as source of vtkProbeFilter does not work
Boettcher, Dr. Peter
Boettcher at kleintierklinik.uni-leipzig.de
Sat Sep 12 12:00:39 EDT 2009
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090912/9db966b4/attachment.htm>
More information about the vtkusers
mailing list