<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.26.3">
</HEAD>
<BODY>
hi everybody, im new to the list (and to vtk programming), so please be patient with my questions :-)<BR>
<BR>
I am trying to write down a script for converting a csv-like file into a vtk readable file.<BR>
<BR>
<I>Some example rows of the original file:</I><BR>
<BR>
<FONT SIZE="2">9.045410 9.358978 2772.13 15 0x01</FONT><BR>
<FONT SIZE="2">9.051514 9.358978 2771.82 21 0x01</FONT><BR>
<FONT SIZE="2">9.061432 9.361267 2771.79 16 0x01</FONT><BR>
<FONT SIZE="2">9.069061 9.358215 2771.79 16 0x01</FONT><BR>
<BR>
<I>This is part of the script i wrote for reading this type of csv-like file:</I><BR>
<BR>
<FONT SIZE="2">reader =&nbsp; csv.reader(infile, delimiter=' ')</FONT><BR>
<FONT SIZE="2">newPoints = vtk.vtkPoints()</FONT><BR>
<FONT SIZE="2">newline = []</FONT><BR>
<FONT SIZE="2">ID = 0</FONT><BR>
<BR>
<FONT SIZE="2">for line in reader:</FONT><BR>
<FONT SIZE="2">&nbsp;&nbsp;&nbsp; newline.append(cos(float(line[1])*2*pi/180)*sin(float(line[0])*2*pi/180)*float(line[2])) #X</FONT><BR>
<FONT SIZE="2">&nbsp;&nbsp;&nbsp; newline.append(cos(float(line[1])*2*pi/180)*cos(float(line[0])*2*pi/180)*float(line[2])) #Y</FONT><BR>
<FONT SIZE="2">&nbsp;&nbsp;&nbsp; newline.append(sin(float(line[1])*2*pi/180)*float(line[2]))&nbsp; #Z</FONT><BR>
<FONT SIZE="2">&nbsp;&nbsp;&nbsp; newline.append(float(line[3])) #Intensity</FONT><BR>
<FONT SIZE="2">&nbsp;&nbsp;&nbsp; newPoints.InsertPoint(ID, newline[0], newline[1], newline[2])</FONT><BR>
<FONT SIZE="2">&nbsp;&nbsp;&nbsp; ID = ID+1</FONT><BR>
<FONT SIZE="2">infile.close()</FONT><BR>
<BR>
After reading the file with csv.reader, i do some arithmetics on the coordinates and then i put my points in a vtkPoints object..<BR>
<BR>
Now i dont know how to set up a vtk writer for writing out that object in a vtk-compatible file format (after that i would like to open that file in Paraview)..<BR>
Anybody can help me??<BR>
<BR>
I would like to preserve the 4th column attributes for every point, couse is the data i am interested in... <BR>
<BR>
<BR>
Thousand Thanks!!<BR>
<BR>
<BR>
<BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
---------------------------
Luca Penasa
Student at Geosciences Dpt.
University of Padua (IT)
<A HREF="mailto:luca.penasa@email.it">luca.penasa@email.it</A>
---------------------------
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>