<!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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">Then&nbsp;generate a&nbsp;vtkImageData 
(finalImg), which includes 4 components: R, G, B and&nbsp; 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>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style"></FONT><FONT 
face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">//mapper</FONT></DIV>
<DIV><FONT face="Bookman Old Style">&nbsp;vtkVolumeRayCastCompositeFunction 
*compositeFunction = 
vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;vtkVolumeRayCastMapper 
*volumeMapper = 
vtkVolumeRayCastMapper::New();<BR>&nbsp;volumeMapper-&gt;SetInput(finalImg);<BR>&nbsp;volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction);<BR>&nbsp;volumeMapper-&gt;IndependentComponentsOff();</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">//opacity intepolation function</FONT></DIV>
<DIV><FONT face="Bookman Old Style">&nbsp;vtkPiecewiseFunction *tfun = 
vtkPiecewiseFunction::New();<BR></FONT><FONT 
face="Bookman Old Style">&nbsp;tfun-&gt;AddPoint(0.0, 
0.0);<BR>&nbsp;tfun-&gt;AddPoint(128.0, 0.1);<BR>&nbsp;tfun-&gt;AddPoint(255.0, 
0.0);</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">//property</FONT></DIV>
<DIV><FONT face="Bookman Old Style">&nbsp;vtkVolumeProperty *volumeProperty = 
vtkVolumeProperty::New();<BR></FONT><FONT 
face="Bookman Old Style">&nbsp;volumeProperty-&gt;SetScalarOpacity(3, 
tfun);<BR></DIV>
<DIV></FONT><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">//volume</FONT></DIV>
<DIV><FONT face="Bookman Old Style">&nbsp;vtkVolume *newvol = 
vtkVolume::New();<BR>&nbsp;newvol-&gt;SetMapper(volumeMapper);<BR>&nbsp;newvol-&gt;SetProperty(volumeProperty);</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">However, I cannot get a color 
volume.</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">Hope your help!</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">Regards,</FONT></DIV>
<DIV><FONT face="Bookman Old Style"></FONT>&nbsp;</DIV>
<DIV><FONT face="Bookman Old Style">Yixun Liu</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV></FONT></BODY></HTML>