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 th=
e
// 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 exis=
ts
// both in source's point and cell data, only the one from the point data i=
s
// 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. Wh=
at
> 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 o=
f
> 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:
>
>
> =A0vtkSphereSource *sphere =3D vtkSphereSource::New();
> =A0=A0sphere->SetRadius(4);
> =A0=A0sphere->SetThetaResolution(50);
> =A0=A0sphere->SetPhiResolution(50);
> =A0=A0sphere->Update();
> =A0vtkSimpleElevationFilter *elevation =3D vtkSimpleElevationFilter::New(=
);
> =A0=A0elevation->SetInput(sphere->GetOutput());
> =A0=A0elevation->SetVector(0,1,0);
> =A0=A0elevation->Update();
>
> =A0vtkImageData *image =3D vtkImageData::New();
> =A0=A0image->SetDimensions(100,100,100);
> =A0=A0image->SetSpacing(0.1,0.1,0.1);
> =A0=A0image->SetScalarTypeToDouble();
> =A0=A0image->SetNumberOfScalarComponents(1);
> =A0=A0image->AllocateScalars();
> =A0=A0image->Update();
> =A0=A0// Center the image over the sphere
> =A0=A0int dim[3];
> =A0=A0double spacing[3];
> =A0=A0image->GetDimensions(dim);
> =A0=A0image->GetSpacing(spacing);
> =A0=A0image->SetOrigin(-(dim[0]-1)*spacing[0]/2, -(dim[1]-1)*spacing[1]/2=
,
> -(dim[2]-1)*spacing[2]/2);
> =A0=A0image->Update();
> =A0=A0// Check if the data overlap
> =A0=A0double boundsInput[6], boundsSource[6];
> =A0=A0image->GetBounds(boundsInput);
> =A0=A0elevation->GetOutput()->GetBounds(boundsSource);
>
> =A0// probe the sphere with the imagedata
> =A0vtkProbeFilter *probe =3D vtkProbeFilter::New();
> =A0=A0probe->SetInput(image);
> =A0=A0probe->SetSource(elevation->GetOutput());
> =A0=A0probe->Update();
>
> =A0=A0vtkStructuredPointsWriter *writer =3D vtkStructuredPointsWriter::Ne=
w();
> =A0=A0writer->SetFileName("Sphere_probed.vtk");
> =A0=A0writer->SetInput(probe->GetOutput());
> =A0=A0writer->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=A0vtkImageData
>>
>>
>>
>> Unfortunately vtkProbeFilter always returns -1 when calling
>> FindCell(x,NULL,-1,tol2,subId,pcoords,weights) and therefore the image i=
s
>> passed through vtkProbeFilter remaining unchanged as no interpolation of
>> scalars is performed at any point of the vtkImageData. Both data overlap=
s
>> each other completely. Therefore, probing should give valuable results!
>>
>>
>>
>> I think it has something to do with tol2. Any suggestions?
>>
>>
>>
>> Thanks =96 Peter.
>>
>>
>>
>> Using vtkGaussianSplatter works well. However no scalars are splatted in=
to
>> 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