[vtkusers] convert polydata to volume
David Gobbi
david.gobbi at gmail.com
Sat Dec 19 12:25:56 EST 2009
Hi Karl,
The vtkCutter can generate contours directly from your surface mesh.
It takes a vtkPlane to describe the cut plane for the contours. I
believe that there is an ImplicitPlane widget that you can use to
control the plane.
If the contour lines look too thin, you can use vtkTubeFilter to
thicken them before feeding them into the mapper.
David
On Sat, Dec 19, 2009 at 10:04 AM, Karl <bulkmailaddress at gmail.com> wrote:
> 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
>>
>
> _______________________________________________
> 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