[vtkusers] VTK and Numpy

Eric E. Monson emonson at cs.duke.edu
Tue May 12 15:15:52 EDT 2009


Hey Peter,

Say pd is a vtkPolyData() object, then you can get the point  
coordinates with:

vtk_to_numpy(pd.GetPoints().GetData())

-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On May 12, 2009, at 12:12 PM, Peter Halverson wrote:

> I'm attempting to export VTK data into numpy using vtk_to_numpy.   
> The program reads in a set of DICOM files using vtkDICOMImageReader.  
> Filters the image using vtkContourFilter, and some other stuff and  
> then displays the rendered solid. I would then like to export the  
> data to Numpy so i do the following  
> scalars=skin.GetMapper().GetInput().GetPointData().GetScalars()
>
> Which gives me the scalars that I am looking for.  My question is  
> how do get the [x,y,z] data to go with the scalars into numpy?
>
> skin.GetMapper().GetInput().GetWholeExtent() gives me the correct  
> dimensions (0, 511, 0, 511, 0, 56) but I have exported less scalars  
> than this...
> _______________________________________________
> 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