<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">The mapper is vtkDataSetMapper, and I
use the default setting.<br>
It is sure that the values of params of setTuple3() is 0~255.<br>
Should I not use the setup of the mapper by default?<br>
<br>
I removed "reader->Update()" in case of reloading the data on
disk, but it didn't work.<br>
<br>
<br>
<br>
</div>
<blockquote
cite="mid:CABObKxdHLXA+PPGDhfXgQ5XiYbFeHhHS0iFBUh6NAEV_qW2npg@mail.gmail.com"
type="cite">
<div dir="ltr">Then is the setup of the mapper that is wrong.
<div>Moreover, do you know if the data array is an unsigned char
one?</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
On Sun, Jul 13, 2014 at 7:19 PM, weixue gong <span dir="ltr"><<a
moz-do-not-send="true" 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">I got the data of points. Then :
<div>vtkDataArray* scalars =
reader->getOutput()->getPointData()->
getScalars();</div>
<div>scalars->setTuple3(i, r, g, b);</div>
<div>data->setScalars(scalars);</div>
<div>reader->Update();</div>
<div><br>
</div>
<div>but the color didn't changed, is there any step I did
wrong?</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-07-13 22:49 GMT+08:00
Sebastien Jourdain <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:sebastien.jourdain@kitware.com"
target="_blank">sebastien.jourdain@kitware.com</a>></span>:
<div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<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
moz-do-not-send="true"
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"> </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 moz-do-not-send="true"
href="http://www.kitware.com"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at
<a moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
</div>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>