<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Hello,</span></div><div><span>&nbsp;&nbsp; Thank you very much for the reply. Could you tell me what is the problem with the following vtk file, why it shows error reading cell data?</span></div><div><span></span>&nbsp;</div><div><span>/**************************************************/</span></div><span><span lang="EN"><div># vtk DataFile Version 1.0</div><div>
</div><div>track data of XX well</div><div>
</div><div>ASCII</div><div>
</div><div>DATASET POLYDATA</div><div>
</div><div>POINTS 10 float</div><div>
</div><div>             0.00         0.00         0.00</div><div>
</div><div>             0.00         0.00      1400.00</div><div>
</div><div>             0.00         0.48      1466.00</div><div>
</div><div>             0.50         2.34      1600.00</div><div>
</div><div>             2.68         4.17      1800.00</div><div>
</div><div>             5.53         4.68      2000.00</div><div>
</div><div>             9.15         4.36      2200.00</div><div>
</div><div>            12.02         1.95      2400.00</div><div>
</div><div>             8.68        -0.86      2599.96</div><div>
</div><div>            -1.14         4.81      2799.95</div><div>
</div><div>           </div><div>
</div><div>VERTICES 10 10</div><div>
</div><div>0&nbsp;&nbsp;&nbsp;0.00         0.00         0.00</div><div>
</div><div>1&nbsp;&nbsp;&nbsp;0.00         0.00      1400.00</div><div>
</div><div>2&nbsp;           0.00         0.48      1466.00</div><div>
</div><div>3          &nbsp; 0.50         2.34      1600.00</div><div>
</div><div>4          &nbsp; 2.68         4.17      1800.00</div><div>
</div><div>5          &nbsp; 5.53         4.68      2000.00</div><div>
</div><div>6          &nbsp; 9.15         4.36      2200.00</div><div>
</div><div>7&nbsp;&nbsp;12.02         1.95      2400.00</div><div>
</div><div>8&nbsp;           8.68        -0.86      2599.96</div><div>
</div><div>9 &nbsp;          -1.14         4.81      2799.95</div><div>

</div><div> </div><div>
</div><div>CELLS 10 10</div><div>
</div><div>1 &nbsp;          0.00         0.00         0.00</div><div>
</div><div>1 &nbsp;          0.00         0.00      1400.00</div><div>
</div><div>1&nbsp;&nbsp;           0.00         0.48      1466.00</div><div>
</div><div>1&nbsp;&nbsp;           0.50         2.34      1600.00</div><div>
</div><div>1&nbsp;&nbsp;           2.68         4.17      1800.00</div><div>
</div><div>1 &nbsp;          5.53         4.68      2000.00</div><div>
</div><div>1          &nbsp; 9.15         4.36      2200.00</div><div>
</div><div>1          &nbsp; 12.02         1.95      2400.00</div><div>
</div><div>1 &nbsp;          8.68        -0.86      2599.96</div><div>
</div><div>1&nbsp;&nbsp;&nbsp;&nbsp;-1.14         4.81      2799.95</div><div>

</div><div>CELL_TYPES 10</div></span></span><div><span></span>&nbsp;</div><div><span></span>&nbsp;</div><div><span></span>&nbsp;</div><div><span>/***************************************************/</span></div><div>Thanks,</div><div>Hayden<var id="yui-ie-cursor"></var><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <div style="margin: 5px 0px; padding: 0px; border: 1px solid rgb(204, 204, 204); height: 0px; line-height: 0; font-size: 0px;" class="hr" contentEditable="false" readonly="true"></div>  <font size="2" face="Arial"> <b><span style="font-weight: bold;">From:</span></b> Hal Canary &lt;hal@cs.unc.edu&gt;<br> <b><span style="font-weight: bold;">To:</span></b> vtkusers@vtk.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, April 25, 2013 9:21 PM<br> <b><span style="font-weight:
 bold;">Subject:</span></b> Re: [vtkusers] Can a VTK file consists of Points only<br> </font> </div> <div class="y_msg_container"><br>
On 04/25/2013 10:08 PM, Hal Canary wrote:<br>&gt; On 04/25/2013 10:04 PM, Hayden Smith wrote:<br>&gt;&gt;&nbsp; &nbsp; &nbsp;  I have a set of points which I would like to use to make a VTK<br>&gt;&gt; file. As there are several formals, which formats will be suitable. I<br>&gt;&gt; used Poydata type only with points. But I can't display the points.<br>&gt;&gt; Please provide me suggestions.<br>&gt; <br>&gt; Add a cell array for the vertices. vtkMaskPoints can do that.<br><br>Here's an example:<br><br>#!/usr/bin/env python<br>import vtk<br>fileName = '/tmp/in.csv'<br>outFileName = '/tmp/out.vtp'<br>with open(fileName,'r') as f:<br>&nbsp; &nbsp; columns = f.readline().strip().split(',')<br>reader = vtk.vtkDelimitedTextReader()<br>reader.SetFileName(fileName)<br>reader.SetFieldDelimiterCharacters(",")<br>reader.DetectNumericColumnsOn()<br>reader.SetHaveHeaders(True)<br>reader.Update()<br>numberOfRows =
 reader.GetOutput().GetNumberOfRows()<br>tableToPolyData = vtk.vtkTableToPolyData()<br>tableToPolyData.SetInputConnection(reader.GetOutputPort())<br>tableToPolyData.SetXColumn(columns[0])<br>tableToPolyData.SetYColumn(columns[1])<br>tableToPolyData.SetZColumn(columns[2])<br>try:<br>&nbsp; &nbsp; tableToPolyData.PreserveCoordinateColumnsAsDataArraysOn();<br>except:<br>&nbsp; &nbsp; pass # introduced in 5.10?<br>maskPoints = vtk.vtkMaskPoints()<br>maskPoints.SetInputConnection(tableToPolyData.GetOutputPort())<br>maskPoints.SetOnRatio(1)<br>maskPoints.RandomModeOff()<br>maskPoints.SetMaximumNumberOfPoints(numberOfRows)<br>maskPoints.GenerateVerticesOn()<br>maskPoints.SingleVertexPerCellOn()<br>writer =
 vtk.vtkXMLPolyDataWriter()<br>writer.SetInputConnection(maskPoints.GetOutputPort())<br>writer.SetFileName(outFileName)<br>writer.Write()<br>###############<br>x,y,z,v<br>0,0,0,2<br>0,0,1,3<br>0,1,0,4<br>0,1,1,5<br>1,0,0,6<br>1,0,1,7<br>1,1,0,8<br>1,1,1,9<br><br><br><br>_______________________________________________<br>Powered by <a href="http://www.kitware.com/" target="_blank">http://www.kitware.com/</a><br><br>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br><br>Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.vtk.org/mailman/listinfo/vtkusers<br><br><br></div> </div> </div>  </div></body></html>