[vtkusers] How to change colour mapping of a vtkImageData? (used as a plane's texture)
    Sean McBride 
    sean at rogue-research.com
       
    Mon Jun 27 17:39:34 EDT 2005
    
    
  
Hi all,
I have a vtkImageData which I use as a texture on a plane.  It works
great, but displays with what I am assuming is some kind of default
colour table (it is full spectrum, like a rainbow).  I am trying to make
it display in greyscale instead, but I don't know how.  I've found
vtkMapper::SetLookupTable() but using it seems to have no effect (even
if I pass NULL!).  Is it the wrong approach?
My pseudo-code snippit is:
vtkImageReslice* resliceY = vtkImageReslice::New();
 ...
planeYSource = vtkPlaneSource::New();
	planeYSource->SetOrigin (...);
	planeYSource->SetPoint1 (...);
	planeYSource->SetPoint2 (...);
vtkColorTransferFunction*	colourTransfer = vtkColorTransferFunction::New();
	colourTransfer->AddRGBPoint (0, 0, 0, 0);
	colourTransfer->AddRGBPoint (255, 1, 1, 1);
vtkPolyDataMapper*	planeYMapper = vtkPolyDataMapper::New();
	planeYMapper->SetInput(planeYSource->GetOutput());
	planeYMapper->SetLookupTable(colourTransfer); // ******
vtkTexture*	planeYTexture = vtkTexture::New();
	planeYTexture->SetInput(resliceY->GetOutput());
vtkActor*	planeYActor = vtkActor::New();
	planeYActor->SetMapper(planeYMapper);
	planeYActor->SetTexture(planeYTexture);
myRenderer->AddActor(planeYActor);
Thanks!
-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada
    
    
More information about the vtkusers
mailing list