[vtkusers] convert polydata to volume
Karl
bulkmailaddress at gmail.com
Sat Dec 19 12:04:47 EST 2009
Bill,
Thanks for the response. I have a VRML file with a single object (triangle
mesh, normal, colors). I need to implement something that behaves like the
vtkImagePlaneWidget where GetResliceOutput can be used to create an image
with the (colored) contours from a slice through the polydata. My thought
was to sample the polydata into a volume and then directly use the
vtkImagePlaneWidget. Any ideas?
Thanks,
KB
-----Original Message-----
From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
Sent: Saturday, December 19, 2009 10:41 AM
To: bulkmailaddress at gmail.com
Cc: vtkusers
Subject: Re: [vtkusers] convert polydata to volume
Karl,
The ProbeFIlter takes each point in its input and samples the source
the point attributes by interpolating the point position in the
source.
It cannot convert a polydata into a volume.
Can you explain what your end goal is? What is the ultimate problem
you are trying to solve? What is contained in the polydata?
Bill
On Sat, Dec 19, 2009 at 2:18 AM, Karl <bulkmailaddress at gmail.com> wrote:
> Hi,
> I am attempting to use vtkProbeFilter convert a polydata into a volume
data
> set that will have colored lines corresponding to the contours of the
> polydata. So far the produced image is always empty. Can anyone see
> anything wrong with the following code? Any help would be appreciated?
>
> // polydata to be converted
> vtkPolyData* polyData = ...
> double bounds[6];
> polyData->GetBounds(bounds);
>
> // identify sampling locations
> int samples = 30;
> vtkImageData* samplingArray = vtkImageData::New();
> samplingArray->SetNumberOfScalarComponents(3);
> samplingArray->SetScalarTypeToUnsignedChar();
>
samplingArray->SetSpacing((bounds[1]-bounds[0])/samples,(bounds[3]-bounds[2]
> )/samples,(bounds[5]-bounds[4])/samples);
> samplingArray->SetDimensions(samples, samples, samples);
> samplingArray->SetOrigin( bounds[0], bounds[2], bounds[3] );
> samplingArray->Update();
>
> // sample polydata
> vtkProbeFilter *probe = vtkProbeFilter::New();
> probe->SetInput(samplingArray);
> probe->SetSource(poly);
>
> // save results
> vtkTIFFWriter* tiff = vtkTIFFWriter::New();
> tiff->SetInputConnection(probe->GetOutputPort());
> tiff->SetFilePrefix("sampled");
> tiff->Write();
>
>
> Thanks,
> KB
>
> _______________________________________________
> 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