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?<br>
<br>foam.vtk:<br># vtk DataFile Version 3.0<br>vtk output<br>ASCII<br>DATASET STRUCTURED_POINTS<br>DIMENSIONS 101 101 1<br>SPACING 1 1 1<br>ORIGIN 0 0 0<br>POINT_DATA 10201<br>FIELD FieldData 3<br>CellType 1 10201 char<br>
....<br><br>Example script<br><br>reader = vtk.vtkStructuredPointsReader()<br>
reader.SetFileName('foam.vtk')<br><br>polyFilter = vtk.vtkPointDataToCellData()<br>polyFilter.SetInputConnection(reader.GetOutputPort())<br>polyFilter.PassPointDataOn()<br><br>warp = vtk.vtkWarpVector()<br>warp.SetInput(polyFilter.GetStructuredGridOutput())<br>
thresh = vtk.vtkThreshold()<br>thresh.SetInputConnection(warp.GetOutputPort())<br>thresh.ThresholdBetween(8.0, 221.0)<br>thresh.SetInputArrayToProcess(1, 0, 0, 0, "CellId")<br><br>cc = vtk.vtkCellCenters()<br>cc.SetInputConnection(thresh.GetOutputPort())<br>
<br><span style="color:rgb(0,0,0);font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;font-size:20px;font-style:normal;font-variant:normal;font-weight:bold;letter-spacing:normal;line-height:23px;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(249,250,252);display:inline!important;float:none"></span>