<div dir="ltr">Make sure you call that on the mapper. Moreover, you should make sure that the data array that contains the color if of type <a class="" href="http://www.vtk.org/doc/nightly/html/vtkUnsignedCharArray_8h_source.html" style="color:rgb(70,101,162);font-weight:bold;font-family:monospace;font-size:14px;line-height:22px">vtkUnsignedCharArray</a><div>
<br></div><div><table class="" style="font-weight:bold;font-size:14px;line-height:22px;font-family:Roboto,sans-serif;margin-left:6px;color:rgb(37,53,85);background-color:rgb(226,232,242)"><tbody><tr><td class="" style="margin-left:6px;vertical-align:bottom">
void vtkMapper::SetColorModeToDefault</td><td style="vertical-align:bottom">(</td><td class="" style="color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"></td><td style="vertical-align:bottom">)<br></td></tr></tbody></table>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 13, 2014 at 8:08 PM, weixuegong <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 bgcolor="#FFFFFF" text="#000000">
    <div>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><div><div class="h5">
    <blockquote 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 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 href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span>:
                <div>
                  <div><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 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>
                                  <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>
                    </blockquote>
                  </div>
                </div>
              </div>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>