<div dir="ltr">vtkDelimitedTextReader -> vtkTableToPolyData is a pipeline that should make this much simpler.</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 9, 2018 at 1:14 AM Polly Pui <<a href="mailto:polly_sukting@hotmail.com">polly_sukting@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Is there any clue that i can extract the row and column data from a csv file and read them as points?</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Currently I am using <span style="font-size:16px;background-color:rgb(255,255,255);display:inline!important">
vtkpoints to </span>read points by inserting points manually to my .cpp .</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Is it possible for me to call the csv directly and read the data (eg. column 3-5, row 2-10)?</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I attach my code here.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
......</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span>int main(int, char*[])<br>
</span>
<div>{<br>
</div>
<div><br>
</div>
<div>vtkSmartPointer<vtkPoints> points =<br>
</div>
<div> vtkSmartPointer<vtkPoints>::New();<br>
</div>
<div>points->InsertNextPoint(8.4312, -36.489, -1500.7);<br>
</div>
<div>points->InsertNextPoint(8.8408, -37.726, -1500.4);<br>
</div>
<div>points->InsertNextPoint(11.372, -37.787, -1501.5);<br>
</div>
<div>points->InsertNextPoint(11.263, -36.384, -1501.9);<br>
</div>
<div>points->InsertNextPoint(9.3914, -40.819, -1500.8);<br>
</div>
<div>points->InsertNextPoint(11.685, -42.482, -1502.7);<br>
</div>
<div>points->InsertNextPoint(14.235, -38.096, -1503.5);<br>
</div>
<div>points->InsertNextPoint(13.972, -43.051, -1504.2);<br>
</div>
<span>points->InsertNextPoint(9.22, -43.904, -1504);</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span><span>vtkSmartPointer<vtkTable> inputData =<br>
</span><span> vtkSmartPointer<vtkTable>::New();</span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span><span><span>for (int c = 0; c < 3; ++c)<br>
</span>
<div>{<br>
</div>
<div> std::stringstream colName;<br>
</div>
<div> colName << "coord " << c;<br>
</div>
<div> vtkSmartPointer<vtkDoubleArray> doubleArray =<br>
</div>
<div> vtkSmartPointer<vtkDoubleArray>::New();<br>
</div>
<div> doubleArray->SetNumberOfComponents(1);<br>
</div>
<div> doubleArray->SetName(colName.str().c_str());<br>
</div>
<div> doubleArray->SetNumberOfTuples(points->GetNumberOfPoints());<br>
</div>
<div><br>
</div>
<div> for (int r = 0; r < points->GetNumberOfPoints(); ++r)<br>
</div>
<div> {<br>
</div>
<div> double p[3];<br>
</div>
<div> points->GetPoint(r, p);<br>
</div>
<div> doubleArray->SetValue(r, p[c]);<br>
</div>
<div> }<br>
</div>
<div> inputData->AddColumn(doubleArray);<br>
</div>
<span>}</span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thank you very much.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Polly</div>
</div>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>