[vtkusers] colormapping by varying saturations of red & blue

Terry Hastings lost_bits1110 at hotmail.com
Mon Feb 23 00:18:27 EST 2004


hello vtk pros..

i have a vtkPolyData (called SetOfQuadCells), and have associated each of 
these cells with a particular scalar value using:

     MyFloatArray->SetTuple( index, velocity );

I do this for every cell.
There is 1 component and "#cells" number of tuples (so a tuple for every 
cell), in MyFloatArray:

     MyFloatArray->SetNumberOfTuples(NumCells);
     MyFloatArray->SetNumberOfComponents(1);

Now for all positive values of velocity, and say I am approximating a 
positive velocity range of 0-30 (though it does go beyond this)  I would 
like to map these positive values to a single hue (red) but have it vary in 
saturation

Then for negative values of velocity, (I am assuming a range of 0 to -30 and 
again this is just approximate and I think it rarely reaches -30) I would 
like to map these negative values to a single hue - this time blue - and 
again have it vary in saturation..

How can i combine these 2?  If I use SetHueRange(0,0.667), so red to blue, 
then I will get some greens in between which i dont want

Also, I tried just having ALL (pos/neg) velocity values map to only blue but 
range in saturation by doing the following:
(but it doesnt work :(  everything is the same damn shade of blue! except i 
see very slight fluctuations here and there, but for the most part its all 
the same blue!  what am i missing!)

                VelocityLookupTable->SetAlphaRange(0,1);
	VelocityLookupTable->SetHueRange(.667, .667);
	VelocityLookupTable->SetNumberOfColors(256);
	VelocityLookupTable->SetSaturationRange(0, 1);
	VelocityLookupTable->SetValueRange(1, 1);
	VelocityLookupTable->SetTableRange(-30,30);
	VelocityLookupTable->Build();

	ColorBlockMapper->SetInput(ColorBlock->GetOutput());
	ColorBlockMapper->SetLookupTable(VelocityLookupTable);
	ColorBlockMapper->SetScalarModeToUseCellData();

thanks for your hlep in advance! i really need to get this! =s

_________________________________________________________________
Say “good-bye” to spam, viruses and pop-ups with MSN Premium -- free trial 
offer! http://click.atdmt.com/AVE/go/onm00200359ave/direct/01/




More information about the vtkusers mailing list