[vtkusers] Help with the RGB voxel visualization
Patrick (Peng) Cheng
peng-cheng at uiowa.edu
Tue Jul 13 18:17:50 EDT 2004
Hi
I want to use a vtkImagePlaneWidget to make a slice view of a volume data (Voxel type is RGB)
It seems that it can't display it correctly, it only maps the first component of the voxel.
When I use a cutter and a polydatamapper, it can get the right color image, but I want the nice interaction feature of the vtkImagePlaneWidget.
I also tried to convert the three RGB values into a single scalar value by the following equation:
unsigned long ScalarValue = r*65536+g*256+b; (r,g,b are unsigned char)
and then built up a lookup table as follows:
vtkLookupTable *lut = vtkLookupTable::New();
lut->SetNumberOfColors(256*256*256);
lut->Build();
for(int r=0;r<256;r++){
for(int g=0;g<256;g++){
for(int b=0;b<256;b++){
lut->SetTableValue(r*65536+g*256+b,r/255,g/255,b/255,1);
}
}
}
It takes a long time to do this, still the result is not right. the whole image looks white.
How can I get the image displayed correctly?
Thanks a lot!
Patrick
---------------------------
Peng (Patrick) Cheng
Biomedical Engineering
University of Iowa
Tel:(319) 400-7442
Email: peng-cheng at uiowa.edu
More information about the vtkusers
mailing list