[vtkusers] vtkStructuredPoints

list user quasilister at gmail.com
Tue Feb 28 16:18:51 EST 2012


Is it possible to get cell information from vtkStructedPoints/vtkImageData
so that I can use vtkCellCenters and locate the centers of cells?  I tried
using vtkPointDataToCellData but couldn't get anything working.  Any ideas?

foam.vtk:
# vtk DataFile Version 3.0
vtk output
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 101 101 1
SPACING 1 1 1
ORIGIN 0 0 0
POINT_DATA 10201
FIELD FieldData 3
CellType 1 10201 char
....

Example script

reader = vtk.vtkStructuredPointsReader()
reader.SetFileName('foam.vtk')

polyFilter = vtk.vtkPointDataToCellData()
polyFilter.SetInputConnection(reader.GetOutputPort())
polyFilter.PassPointDataOn()

warp = vtk.vtkWarpVector()
warp.SetInput(polyFilter.GetStructuredGridOutput())
thresh = vtk.vtkThreshold()
thresh.SetInputConnection(warp.GetOutputPort())
thresh.ThresholdBetween(8.0, 221.0)
thresh.SetInputArrayToProcess(1, 0, 0, 0, "CellId")

cc = vtk.vtkCellCenters()
cc.SetInputConnection(thresh.GetOutputPort())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120228/6399b664/attachment.htm>


More information about the vtkusers mailing list