[vtkusers] Setting specific colors to vtkPolyData

Miri Trope miritrope at gmail.com
Sun Jan 8 14:15:08 EST 2012


Hi Again,

In addition,
I'd like to ask about vtkPolyDataWriter:
I set scalars on vtkPolyData and would like to save both the vtkPolyData
with his scalars (it means that I'd like to save the colored surface).

How should I do this?

On Sat, Jan 7, 2012 at 7:29 PM, Miri Trope <miritrope at gmail.com> wrote:

> Hi All,
>
> I'm new to vtk and would like to represent some specific colors on my
> vtkPolyData by vtkFloatArray.
> Until now, I managed to do that in the following way but more colors have
> been represented than I wanted (actually, four colors).
>
> //calculating my vtkFloatArray
>   myVtkFloatArray->
> SetNumberOfComponents(1);
>   myVtkFloatArray->SetNumberOfValues(numPoints);
>   myVtkFloatArray->SetValue(ind, someVal);
>
> //setting this array on mySurface scalars
> mySurface->GetPointData()->SetScalars(myVtkFloatArray);
>
> In that way I visualize the colored surface on the 3d window (of Mitk)
> without the need to use the vtkRendererWindow.
> Now, I'd like to set a specific color for each range of values from
> myVtkFloatArray and represent less colors then are being represented now
> (remove one color from the middle so it will be represented just three
> colors, not four).
>
> I searched in web and found out that look up table can satisfy my needs,
> but I haven't found a method without the use of vtkRendererWindow (which I
> don't need, I already have a window, as I mentioned above).
>
> How should I do that?
>
> Any help would be very appreciated.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120108/6ffe8b30/attachment.htm>


More information about the vtkusers mailing list