[vtkusers] (no subject)
weixuegong
weixuegong at gmail.com
Sun Jul 13 22:08:11 EDT 2014
The mapper is vtkDataSetMapper, and I use the default setting.
It is sure that the values of params of setTuple3() is 0~255.
Should I not use the setup of the mapper by default?
I removed "reader->Update()" in case of reloading the data on disk, but
it didn't work.
> Then is the setup of the mapper that is wrong.
> Moreover, do you know if the data array is an unsigned char one?
>
>
>
>
> On Sun, Jul 13, 2014 at 7:19 PM, weixue gong <weixuegong at gmail.com
> <mailto:weixuegong at gmail.com>> wrote:
>
> I got the data of points. Then :
> vtkDataArray* scalars = reader->getOutput()->getPointData()->
> getScalars();
> scalars->setTuple3(i, r, g, b);
> data->setScalars(scalars);
> reader->Update();
>
> but the color didn't changed, is there any step I did wrong?
>
>
>
> 2014-07-13 22:49 GMT+08:00 Sebastien Jourdain
> <sebastien.jourdain at kitware.com
> <mailto:sebastien.jourdain at kitware.com>>:
>
> POINT_DATA means that you should call ->GetPointData() instead
> of ->GetCellData().
>
>
> On Sun, Jul 13, 2014 at 8:00 AM, 公维学 <weixuegong at gmail.com
> <mailto:weixuegong at gmail.com>> wrote:
>
> 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.
>
> The reason is that I want to write the dataset back to
> hard disk with the new color.
> 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.
> this->reader->Update();
> vtkDataSet* ds = reader->GetOutput();
> vtkCellData* cellData = ds->GetCellData();
> vtkDataArray* scalars = cellData->GetScalars();
> int size = scalars->GetSize();//equals to the number
> of cells in dataset?
> //then we can modify scalars...
> I am not sure if it is the right way, and I googled it,
> but found nothing helpful,
> 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:
> POINT_DATA 332
> COLOR_SCALARS VRMLColor 3
> So, could any one give me some tips?
>
>
> Any advice would be appreciated!
>
>
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140714/ee9e75c5/attachment.html>
More information about the vtkusers
mailing list