[vtkusers] How to color a line

R K Shyam Prakash ramakrishna.prakash at quest-global.com
Thu Jul 29 12:38:25 EDT 2004


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