[vtkusers] How to color a line

Patrick (Peng) Cheng peng-cheng at uiowa.edu
Thu Jul 29 13:41:23 EDT 2004


hi,
Sorry I didn't say it clearly. 
I mean I want to color the line with different colors.
These colors will be determined by the scalar values at each point.
I don't know how to add the scalar values into the polydata as in my code.
I know the polydatamapper have method like : ScalarVisibilityOn() and SetLookupTable()
once I have put the scalar value into the polydata, I think it will work. right?
---------------------------
Patrick (Peng) Cheng
Biomedical Engineering
University of Iowa
Tel:(319) 400-7442
Email: peng-cheng at uiowa.edu

===========2004-07-29 11:08:25 You wrote in your letter:==============

>Patrick,
>		Look at the example /Examples/Medical/Cxx/Medical3.cxx.
>You can use SetTableValue to specify the color.
>
>--Shyam
>
>> -----Original Message-----
>> From: vtkusers-bounces at vtk.org 
>> [mailto:vtkusers-bounces at vtk.org] On Behalf Of Patrick (Peng) Cheng
>> Sent: Thursday, July 29, 2004 10:50 PM
>> To: vtkusers
>> Subject: [vtkusers] How to color a line
>> 
>> 
>> Hi,
>> I have the following code to draw a tube in the scene.
>> The tube is of the same color. Now I have some scalar values 
>> at each point How do I use something like lookup table to 
>> color the line according to the scalar values. Thanks a lot
>> 
>> 	vtkPolyData *data = vtkPolyData::New();
>> 	data->SetPoints(points); // points is vtkPoints
>> 	data->SetLines(line);	 // line is vtkCellArray
>> 	
>> 	vtkCleanPolyData *clean = vtkCleanPolyData::New();
>> 	clean->SetInput(data);
>> 	
>> 	vtkTubeFilter *tube = vtkTubeFilter::New();
>> 	tube->SetInput(clean->GetOutput());
>> 	tube->SetRadius(0.6);
>> 	tube->SetNumberOfSides(6);
>> 	tube->SetVaryRadiusToVaryRadiusOff();
>> 	
>> 	vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
>> 	mapper->SetInput(tube->GetOutput());
>> 	
>> 	vtkProperty *pro = vtkProperty::New();
>> 	pro->SetColor(1,0,0);
>> 	
>> 	vtkActor *actor = vtkActor::New();
>> 	actor->SetMapper(mapper);
>> 	actor->SetProperty(pro);
>> ---------------------------
>> Patrick (Peng) Cheng
>> Biomedical Engineering
>> University of Iowa
>> Tel:(319) 400-7442
>> Email: peng-cheng at uiowa.edu
>> 
>> 
>> 
>> 
>> _______________________________________________
>> This is the private VTK discussion list. 
>> Please keep messages on-topic. Check the FAQ at: 
>> <http://public.kitware.com/cgi-bin/vtkfaq>
>> Follow this link 
>> to subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers
>> 
>.
================================================================






More information about the vtkusers mailing list