[Paraview] VTK Code to Paraview
David Doria
daviddoria at gmail.com
Wed Oct 24 13:42:19 EDT 2012
On Tue, Oct 23, 2012 at 3:50 PM, Fabiano Papaiz <fabianopapaiz at gmail.com>wrote:
> Hi Everybody, (sorry my english)
>
> I am new in paraview and have some experience with VTK with python (some
> codes that parse a DICOM Medical images and rendering as
> volume/isosurface).
>
> My basic question is: how can i use the output generated by my VTK code
> and input in a paraview to be render? (Is this possible?)
>
> Below an piece of my python code:
>
> reader = vtk.vtkDICOMImageReader()
> reader.SetDirectoryName(dirDicom)
> reader.Update()
>
> contour = vtk.vtk.vtkMarchingCubes()
> contour.SetInput( reader.GetOutput() )
> contour.ComputeNormalsOn()
> contour.SetValue( 0, 1250 )
>
> mapper = vtk.vtkPolyDataMapper()
> mapper.SetInput( contour.GetOutput() )
> mapper.ScalarVisibilityOff()
>
> actorBone = vtk.vtkLODActor()
> actorBone.SetNumberOfCloudPoints( 1000000 )
> actorBone.SetMapper( mapper )
> actorBone.GetProperty().SetColor( 1, 1, 1 )
> actorBone.GetProperty().SetOpacity( 0.7 )
> ##
> ##>>>> HERE, Instead of use a vtkRenderWindow I want show in paraview.
>
The way you have set those properties at the end (the color/opacity), they
cannot be exported and viewed in Paraview. Since your 'contour' filter
produces a vtkPolyData, you can use vtkXMLPolyDataWriter to write it to a
vtp file which can then be opened with Paraview. I'd suggest you do that,
then setup the properties (color/opacity) in Paraview.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20121024/5ad9a120/attachment.htm>
More information about the ParaView
mailing list