<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Bookman Old Style">Hi,</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">I have 256x256x200 color tiff image. I want
to render it using raycasting. I did it as below,</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">Firstly, compute 4th component
(averageIntensity) based on the R,G and B components.</FONT></DIV>
<DIV><FONT face="Bookman Old Style">averageIntensity = R*0.30 + G*0.59 +
B]*0.11;</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">Then generate a vtkImageData
(finalImg), which includes 4 components: R, G, B and averageIntensity. The
first three will directly represent RGB (no lookup table). The fourth component
will be passed through the first scalar opacity transfer function for
opacity.</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style"></FONT><FONT
face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">//mapper</FONT></DIV>
<DIV><FONT face="Bookman Old Style"> vtkVolumeRayCastCompositeFunction
*compositeFunction =
vtkVolumeRayCastCompositeFunction::New();<BR> vtkVolumeRayCastMapper
*volumeMapper =
vtkVolumeRayCastMapper::New();<BR> volumeMapper->SetInput(finalImg);<BR> volumeMapper->SetVolumeRayCastFunction(compositeFunction);<BR> volumeMapper->IndependentComponentsOff();</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">//opacity intepolation function</FONT></DIV>
<DIV><FONT face="Bookman Old Style"> vtkPiecewiseFunction *tfun =
vtkPiecewiseFunction::New();<BR></FONT><FONT
face="Bookman Old Style"> tfun->AddPoint(0.0,
0.0);<BR> tfun->AddPoint(128.0, 0.1);<BR> tfun->AddPoint(255.0,
0.0);</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">//property</FONT></DIV>
<DIV><FONT face="Bookman Old Style"> vtkVolumeProperty *volumeProperty =
vtkVolumeProperty::New();<BR></FONT><FONT
face="Bookman Old Style"> volumeProperty->SetScalarOpacity(3,
tfun);<BR></DIV>
<DIV></FONT><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">//volume</FONT></DIV>
<DIV><FONT face="Bookman Old Style"> vtkVolume *newvol =
vtkVolume::New();<BR> newvol->SetMapper(volumeMapper);<BR> newvol->SetProperty(volumeProperty);</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">However, I cannot get a color
volume.</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">Hope your help!</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">Regards,</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT> </DIV>
<DIV><FONT face="Bookman Old Style">Yixun Liu</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV></FONT></BODY></HTML>