[Ves] How to color polydata with Scalars in VES

Bo Yu yubo1983 at gmail.com
Fri Mar 7 03:29:02 EST 2014


Dear Casey, Aashish,
The duplicated vertices works good. I use a vtkShrinkFilter on the polydata
before set scalar of points.
Then re-generate the color table to contain same number of tuples with the
point number of the new polydata.
After that just setScalar as normal. I get a result as colored faces.

That did solved my problem, Thank you all very much.  ; )

Bo Yu


On Tue, Mar 4, 2014 at 1:12 AM, Casey Goodlett
<casey.goodlett at kitware.com>wrote:

> Bo,
>
> Try running vtkShrinkFilter with a scale factor of 1.0 prior to cell data
> to point data.  This should create the necessary duplicate vertices.
>
>
> On Mon, Mar 3, 2014 at 11:01 AM, Bo Yu <yubo1983 at gmail.com> wrote:
>
>> Yes, the colors are blended. Thank you, It sounds reasonable to color
>> duplicate points of the triangles, but is that means I have to regenerate
>> the polydata? I will try it tomorrow (Tokyo time ;)
>>
>> Bo Yu
>>
>> On Tuesday, March 4, 2014, Casey Goodlett <casey.goodlett at kitware.com>
>> wrote:
>>
>>> Is the problem that colors are being blended across the triangles?  If
>>> so, you need to duplicate the vertices such that each triangle is defined
>>> by three unique vertices (its ok to have multiple vertices with the same
>>> XYZ locations).
>>>
>>> Let me know if that makes sense.
>>>
>>> Thanks
>>>
>>>
>>> On Mon, Mar 3, 2014 at 10:48 AM, Bo Yu <yubo1983 at gmail.com> wrote:
>>>
>>>> Thank you for your information, Casey, the color do appear, but
>>>> it seems that was colored "vertex by vertex", not as I expected: "cell by
>>>> cell".
>>>> I am using bitbucket with my colleagures. I'll try to create a new
>>>> repo in github to let you see.
>>>>
>>>> Bo Yu
>>>>
>>>>
>>>> On Tuesday, March 4, 2014, Casey Goodlett <casey.goodlett at kitware.com>
>>>> wrote:
>>>>
>>>>>
>>>>> On Mon, Mar 3, 2014 at 12:42 AM, Bo Yu <yubo1983 at gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> pd->GetPointData()->SetScalars(colorTable);//color works like on each
>>>>>> vertexes and scalar, color table is an vtkUnsignedCharArray which contains
>>>>>> same tuples as vertexes number.
>>>>>> //pd->GetCellData()->SetScalars(colorTable);//no color at all, color
>>>>>> table is an vtkUnsignedCharArray which contains same tuples as cells number.
>>>>>>
>>>>>>
>>>>>
>>>>> Bo,
>>>>>
>>>>> Once you you run the filter you should not overwrite the scalars as
>>>>> done on these lines.
>>>>>
>>>>> If you already built your colorTable for the vertices you dont need to
>>>>> use the CellDataToPointData filter at all just set directly as point data.
>>>>>
>>>>> Is your problem that colors dont appear or they are not as you
>>>>> intended?
>>>>>
>>>>> Can you share how you have constructed your colorTable?  Is your code
>>>>> anywhere public like github that we could look at?
>>>>>
>>>>> Thanks
>>>>>
>>>>> --
>>>>> Casey B. Goodlett, Ph.D.
>>>>> R&D Engineer
>>>>> Kitware, Inc. - North Carolina Office
>>>>> http://www.kitware.com
>>>>> (919) 969-6990 x310
>>>>>
>>>>
>>>
>>>
>>> --
>>> Casey B. Goodlett, Ph.D.
>>> R&D Engineer
>>> Kitware, Inc. - North Carolina Office
>>> http://www.kitware.com
>>> (919) 969-6990 x310
>>>
>>
>
>
> --
> Casey B. Goodlett, Ph.D.
> R&D Engineer
> Kitware, Inc. - North Carolina Office
> http://www.kitware.com
> (919) 969-6990 x310
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20140307/06881dfa/attachment-0003.html>


More information about the Ves mailing list