<div dir="ltr">Hi, <div> I have some unstructured data, no triangles, just points and normals.</div><div><br></div><div>I am trying to write those to a file in the vtp format using the python bindings and then load the data in paraview and apply a glyph filter to view the vectors. but the glyph filter doesn't appear to work eventhough the data looks alright in the vtp file, what am I missing?</div><div><br></div><div>here is the code snippet.</div><div><br></div><div><div> #write normals</div><div> points = vtk.vtkPoints()</div><div> verts = vtk.vtkCellArray()</div><div> polydata_pts = vtk.vtkPolyData()</div><div> </div><div> pointNormalsArray = vtk.vtkDoubleArray()</div><div> pointNormalsArray.SetNumberOfComponents(3)</div><div><br></div><div> for i in range(clipSeedIds.GetNumberOfIds()):</div><div><br></div><div> seedId = clipSeedIds.GetId(i)</div><div><br></div><div> locator = vtk.vtkPointLocator()</div><div> locator.SetDataSet(clippedSurface)</div><div> locator.BuildLocator()</div><div><br></div><div> seedPoint = self.Surface.GetPoint(seedId)</div><div> seedPointId = locator.FindClosestPoint(seedPoint)</div><div><br></div><div> planeEstimator = vtkvmtk.vtkvmtkPolyDataNormalPlaneEstimator()</div><div> planeEstimator.SetInputData(clippedSurface)</div><div> planeEstimator.SetOriginPointId(seedPointId)</div><div> planeEstimator.Update()</div><div><br></div><div> plane = vtk.vtkPlane()</div><div> plane.SetOrigin(planeEstimator.GetOrigin())</div><div> plane.SetNormal(planeEstimator.GetNormal())</div><div><br></div><div> #testing the normal vector</div><div> </div><div> origin_pt = planeEstimator.GetOrigin()</div><div> normal_pt = planeEstimator.GetNormal()</div><div> </div><div> id = points.InsertNextPoint(origin_pt)</div><div> verts.InsertNextCell(1) </div><div> verts.InsertCellPoint(id)</div><div> pointNormalsArray.InsertNextTuple(normal_pt)</div><div> </div><div><br></div><div><br></div><div> #Add the points to the polydata container</div><div> polydata_pts.SetPoints(points)</div><div> polydata_pts.SetVerts(verts)</div><div> </div><div> # Add the normals to the points in the polydata</div><div> #polydata_pts.GetCellData().SetNormals(pointNormalsArray)</div><div> polydata_pts.GetPointData().SetNormals(pointNormalsArray)</div><div> polydata_pts.Modified()</div><div> </div><div> </div><div> writer = vtk.vtkXMLPolyDataWriter()</div><div> writer.SetDataModeToAscii()</div><div> writer.SetFileName(os.path.join(</div><div> "/Users/sansomk/caseFiles/ultrasound/cases/DSI003LER/other", </div><div> "pts_out.vtp"))</div><div> writer.SetInputData(polydata_pts)</div><div> writer.Write()</div><div><br></div><div><br></div><div>~Kurt</div><div><div><br></div>-- <br><div class="gmail_signature">Kurt Sansom<br></div>
</div></div></div>