[vtkusers] vtkColorTransferFunction
Vishal Shah
vishalshah2282 at yahoo.com
Tue Mar 7 13:52:32 EST 2006
hi . i have just started some development using vtk. i have to display an slc file, and provide 'user editable' transfer functions.
background:
----------------
i am using the following, and it works fine:
colTransFunc->AddRGBPoint ( 0.0, 0.0, 0.0, 0.0);
colTransFunc->AddRGBPoint ( 64.0, 1.0, 0.0, 0.0);
colTransFunc->AddRGBPoint ( 128.0, 0.0, 0.0, 1.0);
colTransFunc->AddRGBPoint ( 192.0, 0.0, 1.0, 0.0);
colTransFunc->AddRGBPoint ( 255.0, 0.0, 0.2, 0.0);
opacTransFunc->AddPoint( 20, 0.0);
opacTransFunc->AddPoint( 255, 0.2);
this obviousy maps (0 to 255) to (0 to 1). my understanding is that the 0 to 255 represents in xyz plane, distance of a point from the origin. so if i have a point at say 23, and its corresponding RGB is (1,0,0), that means i am telling the vtk renderer to color all 'innermost' points as red.
my questions:
--------------------
1) is my understanding correct?
2)isnt it wrong to hardcode 255? shudn't i be getting a 'range' for the given slc file?
i tried:
poly->ShallowCopy(reader->GetOutput());
reader->Update();
poly->GetScalarRange(Range);
where poly = vtkPolyData and reader = vtkSLCReader, but then i always get the range as (0 to 1). so then i will be mapping (0 to 1) to (0 to 1). that obviously does not give me correct results.
3) after i figure out the correct mapping, how do i change the transfer functions? say i have sliders for red , green and blue each, when the user changes the slider, what should happen ? can you give an example of how the above mentioned functions should change ?
4) do the solutions to the above questions also apply to the changing of opacity using vtkPiecewiseFunction?
thanks for your patience in reading the long list . hope to get some guidance soon. thanks again.
-vishal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060307/9ad91ecc/attachment.htm>
More information about the vtkusers
mailing list