[vtkusers] (no subject)

Sebastien Jourdain sebastien.jourdain at kitware.com
Sun Jul 13 10:49:53 EDT 2014


POINT_DATA means that you should call ->GetPointData() instead of
->GetCellData().


On Sun, Jul 13, 2014 at 8:00 AM, 公维学 <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
>
> 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/20140713/20e5ad02/attachment.html>


More information about the vtkusers mailing list