<div dir="ltr"><font color="#0000ff" face="新宋体"><span style="font-size:12px">POINT_DATA means that you should call ->GetPointData() instead of ->GetCellData().</span></font><br></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Sun, Jul 13, 2014 at 8:00 AM, 公维学 <span dir="ltr"><<a href="mailto:weixuegong@gmail.com" target="_blank">weixuegong@gmail.com</a>></span> wrote:<br><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:新宋体;font-size:12px">Now I have an vtkDataSet object from a reader.I had tried to change the color of the output of vtkDataSetReader(not set the color of actor), but had no idea.</div>
<div style="font-family:新宋体;font-size:12px"><br></div><div style="font-family:新宋体;font-size:12px">The reason is that I want to write the dataset back to hard disk with the new color.</div><div style="font-family:新宋体;font-size:12px">
</div><div style="font-family:新宋体;font-size:12px">I could get the number of cells in this dataset, and when I tried to get the scalars and modify the scalars(it holds the color, am I right), it crushed.</div><div style="font-family:新宋体;font-size:12px">
<font color="#0000ff"> this->reader->Update();<br> vtkDataSet* ds = reader->GetOutput();<br> vtkCellData* cellData = ds->GetCellData();<br> vtkDataArray* scalars = cellData->GetScalars();</font></div>
<div style="font-family:新宋体;font-size:12px"><font color="#0000ff"> int size = scalars->GetSize();//equals to the number of cells in dataset?</font></div><div style="font-family:新宋体;font-size:12px"><font color="#0000ff"> //then we can modify scalars...</font></div>
<div style="font-family:新宋体;font-size:12px"> </div><div style="font-family:新宋体;font-size:12px"> </div><div style="font-family:新宋体;font-size:12px">I am not sure if it is the right way, and I googled it, but found nothing helpful,</div>
<div style="font-family:新宋体;font-size:12px"> </div><div style="font-family:新宋体;font-size:12px">The vtk file was converted from vrml.and it has about 332 points, 110 lines, 102 polygons,and I found in this file there were:</div>
<div style="font-family:新宋体;font-size:12px"><font color="#0000ff">POINT_DATA 332<br>COLOR_SCALARS VRMLColor 3</font></div><div style="font-family:新宋体;font-size:12px"><font color="#0000ff"></font> </div><div style="font-family:新宋体;font-size:12px">
<font color="#000000">So, could any one give me some tips?</font></div><div style="font-family:新宋体;font-size:12px"><h2 style="border:0px;padding:0px;margin:25px 25px 10px 0px;outline:invert none 0px;font-size:16px;line-height:18px;font-family:Arial,华文细黑,'STHeiti Light',微软雅黑体,'Microsoft Yahei',新宋体,NSimSun,宋体,SimSun;color:rgb(0,0,0);vertical-align:baseline;overflow:hidden">
<font face="微软雅黑">Any advice would be appreciated!</font></h2></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>