Hi Yixun and Sharwari,<br><br>I am trying to solve exactly similar problem but using DICOM images rather than bmp. But I am getting errors and I can't figure out why. My code is based on your previous conversation so far. The error that I get is:
<br>(1)error LNK2019: unresolved external symbol &quot;public: static class vtkVolumeRayCastCompositeFunction * __cdecl vtkVolumeRayCastCompositeFunction::New(void)&quot; (?New@vtkVolumeRayCastCompositeFunction@@SAPAV1@XZ
) referenced in function _main<br>&nbsp;(2)error LNK2019: unresolved external symbol &quot;public: static class vtkVolumeRayCastMapper * __cdecl vtkVolumeRayCastMapper::New(void)&quot; (?New@vtkVolumeRayCastMapper@@SAPAV1@XZ) referenced in function _main
<br>(3)fatal error LNK1120: 2 unresolved externals<br><br>Can you please help me figure out what's going wrong here?<br><br>My code is as follows:<br>-----<br>#include &quot;vtkConeSource.h&quot;<br>#include &quot;vtkPolyDataMapper.h
&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkActor.h&quot;<br>#include &quot;vtkImageActor.h&quot;<br>#include &quot;vtkOutlineFilter.h&quot;<br>#include &quot;
vtkProperty.h&quot;<br>#include &quot;vtkPolyDataNormals.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkDataSetMapper.h&quot;<br>#include &quot;vtkImageMapper.h&quot;<br>#include &quot;vtkPiecewiseFunction.h
&quot;<br>#include &quot;vtkVolumeProperty.h&quot;<br>#include &quot;vtkRenderer.h&quot;<br>#include &quot;conio.h&quot;<br>#include &quot;vtkDICOMImageReader.h&quot;<br>#include &quot;vtkImageViewer2.h&quot;<br>#include &quot;
vtkJPEGReader.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkVolumeMapper.h&quot;<br>#include &quot;vtkActor2D.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>#include &quot;vtkVolumeRayCastCompositeFunction.h
&quot;<br>#include &quot;vtkVolumeRayCastMapper.h&quot;<br><br>void main()<br>{<br>&nbsp; <br>&nbsp; vtkRenderer *arenderer = vtkRenderer::New();<br>&nbsp; vtkRenderWindow *renwin = vtkRenderWindow::New();<br>&nbsp; vtkDICOMImageReader *img1=vtkDICOMImageReader::New();
<br><br>&nbsp; img1-&gt;SetFilePrefix(&quot;D:\\testimages\\dicomset\\IM&quot;);<br>&nbsp; img1-&gt;SetFilePattern(&quot;%s%d.dcm&quot;);<br>&nbsp; img1-&gt;SetFileNameSliceOffset(1);<br>&nbsp; img1-&gt;SetFileNameSliceSpacing(1);<br>&nbsp; img1-&gt;SetDataExtent(0,511,0,511,1,10);//512x512 images and 10 slices
<br>&nbsp; img1-&gt;SetDataSpacing(360.0/512,360.0/512,1.0); //my image is 36cm x 36cm and 512x512<br>&nbsp; img1-&gt;SetDataOrigin(0.0,0.0,0.0);<br>&nbsp; img1-&gt;Update();<br><br>&nbsp; vtkVolume *vol=vtkVolume::New();<br>&nbsp; vtkVolumeRayCastMapper *volumemapper = vtkVolumeRayCastMapper::New();
<br>&nbsp; vtkVolumeRayCastCompositeFunction *rcf=vtkVolumeRayCastCompositeFunction::New();<br>&nbsp; volumemapper-&gt;SetVolumeRayCastFunction(rcf);<br>&nbsp; volumemapper-&gt;SetInput(img1-&gt;GetOutput());<br>&nbsp; vol-&gt;SetMapper(volumemapper);
<br><br>&nbsp; vtkCamera *cam=vtkCamera::New();<br>&nbsp; cam-&gt;SetViewUp(0,0,-1);<br>&nbsp; cam-&gt;SetPosition(0,1,0);<br>&nbsp; cam-&gt;SetFocalPoint(0,0,0);<br>&nbsp; cam-&gt;ComputeViewPlaneNormal();<br><br>&nbsp; arenderer-&gt;AddActor(vol);<br>
&nbsp; arenderer-&gt;SetActiveCamera(cam);<br>&nbsp; arenderer-&gt;ResetCamera();<br>&nbsp; arenderer-&gt;SetBackground(1,1,1);<br>&nbsp; <br>&nbsp; renwin-&gt;AddRenderer(arenderer);<br>&nbsp; vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();
<br>&nbsp; iren-&gt;SetRenderWindow(renwin);<br>&nbsp; renwin-&gt;Render();<br>&nbsp; iren-&gt;Initialize();<br>&nbsp; iren-&gt;Start();<br><br>&nbsp; img1-&gt;Delete();<br>&nbsp; iren-&gt;Delete();<br>}<br>--------<br>I would really appreciate if anyone can help me.
<br><br>Regards,<br>Ashish<br><br><div><span class="gmail_quote">On 9/7/06, <b class="gmail_sendername">Sharwari Mavalankar</b> &lt;<a href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

sharwari@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div>hi Yixun,</div>
<div>I'll try and look into why the volume appears darker.</div>
<div>&nbsp;</div>
<div>However I'll there are many lines that are appearing on the volume (they look like striations).</div>
<div>Do you know what the reason for that could be?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>Also if I have to visualize color bmp slices (24 bit )&nbsp;I need <font face="Bookman Old Style">vtkFixedPointVolumeRayCastMapper right?</font></div>
<div><font face="Bookman Old Style">Thanks </font></div></div><div><span>
<div><font face="Bookman Old Style">Sharwari</font><br><br>&nbsp;</div></span></div><div><span>
<div><span class="gmail_quote">On 9/6/06, <b class="gmail_sendername">Yixun Liu</b> &lt;<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn</a>&gt; wrote:
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">You are right and alwayse taking mm as the unit.</font></div>
<div><font face="Bookman Old Style">SpacingX = 5.12*10/256;</font></div>
<div><font face="Bookman Old Style">SpacingY = 5.12*10/256;</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Many reason can make the volume look darker.</font></div>
<div><font face="Bookman Old Style">You can&nbsp;change the opacity and color interpolation function to adjust the appearance of the volume. If you use shade you can also&nbsp;change ambient or diffusion coefficient to make the volume look&nbsp;more lighter. Another method is to change the 
<a>vtkLight</a> in the renderer. <a>vtkLight</a> is a virtual light for 3D rendering. It provides methods to locate and point the light, turn it on and off, and set its brightness and color. </font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Cheers,</font></div></div>
<div><span>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Yixun Liu</font></div></span></div>
<div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"></blockquote></div>
<div><span>
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b> <a title="sharwari@gmail.com" href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Sharwari Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Yixun Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">VTK</a> </div></span></div>
<div><span>
<div><b>Sent:</b> Thursday, September 07, 2006 1:43 AM</div>
<div><b>Subject:</b> Re: Re: Re: Creating a Volume from 2D BMP files.</div>
<div><font face="Bookman Old Style"></font><br>&nbsp;</div>
<div>hi Yixun,</div>
<div>Thank you very much for your email.</div>
<div>What exactly do you mean by the physical size of the image?</div>
<div>Does it mean the size of the image in cm or mm?</div>
<div>&nbsp;</div>
<div>For example if my original images are 5.12 cm * 5.12 cm and are 256 * 256 images.</div>
<div>What will the data spacing be?</div>
<div>&nbsp;</div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div>Also can you tell me the reason why the 3D volume seems darker than the original images?&nbsp;</div>
<div>Is there any way I can scale the intensity of the images?</div>
<div>Thanks again,</div>
<div>Sharwari<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 9/3/06, <b class="gmail_sendername">Yixun Liu</b> &lt;<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn</a>&gt; wrote:
</span> 
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">If you read color bmp files you should update vtk to 5.0 version and use vtkFixedPointVolumeRayCastMapper(see last mail). Otherwise, you should not call</font></div>
<div><font face="Bookman Old Style">br-&gt;SetNumberOfScalarComponents(3);</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">1. You can decide the physical spacing accroding to the image extent(pixel unit) and its physical size(mm): spacing = size/(extent-1); If no physical size you have to give a estimation for the spacing. 
</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">2.The point1 and point2 will define a linear opacity function, which can be interpolated from the two points. For example, define two points (intensity1, opacity1)and (intensity2, opacity2) you can get the opacity3 at intensity3 by opacity3 = (intensity3-intensity1)/(intensity2-intensity1)*(opacity2-opacity1) + opacity1 
</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Hope it help.</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Cheers,</font></div></div>
<div><span>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span> Liu</font></div>
<div><font face="Bookman Old Style"><br></font></div></span></div>
<div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"></blockquote></div>
<div><span>
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b> <a title="sharwari@gmail.com" href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Sharwari Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"><span name="st">Yixun</span> Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">VTK</a> </div></span></div>
<div><span>
<div><b>Sent:</b> Monday, September 04, 2006 6:50 AM</div>
<div><b>Subject:</b> Re: Re: Creating a Volume from 2D BMP files.</div>
<div><br>&nbsp;</div>
<div>hi Yixun,</div>
<div>I implemented the suggestions that you had made.</div>
<div>Now I am getting a 3D volume but it doesnt look anything like the original 2D slices.</div>
<div>It is much darker in appearance and it's got lines all over it ( it looks as though it's some kind of aliasing).</div>
<div>&nbsp;</div>
<div>I have the following questions to ask you </div>
<div>1.While using the function SetDataSpacing(x,y,z) how do I decide the values of the parameters x,y and z.</div>
<div>&nbsp;</div>
<div>2.While using the Addpoint() &nbsp;function of class vtkPiecewiseFunction what do the two parameters in the Addpoint function mean?</div>
<div>How do they affect the output?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>This is code I have used. Do let me know if you can make any more sugestions.</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>
<p>//This program reads a single BMP file and plots it as an image.<br>//The same program will be extended to read multiple images and create a 3D volume out of 2D slices.</p>
<p><br>#include &quot;vtkRenderer.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkBMPReader.h&quot;<br>#include &quot;vtkPolyDataMapper.h&quot;<br>


#include &quot;vtkActor.h&quot;<br>#include &quot;vtkActor2D.h&quot;<br>#include &quot;vtkImageActor.h&quot;<br>#include &quot;vtkOutlineFilter.h&quot;<br>#include &quot;vtkCamera.h&quot;<br>#include &quot;vtkProperty.h&quot; 
<br>#include &quot;vtkPolyDataNormals.h&quot;<br>#include &quot;vtkContourFilter.h&quot;<br>#include &quot;vtkDataSetMapper.h&quot;<br>#include &quot;vtkImageMapper.h&quot;<br>#include &quot;vtkVolumeMapper.h&quot;<br>#include &quot; 
vtkVolumeRayCastMapper.h&quot;<br>#include &quot;vtkVolumeRayCastCompositeFunction.h&quot;<br>#include &quot;vtkPiecewiseFunction.h&quot;<br>#include &quot;vtkVolumeProperty.h&quot;</p>
<p><br>void main (void)<br>{<br>&nbsp;<br>&nbsp;vtkRenderer *aRenderer = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow *renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;renWin-&gt;AddRenderer(aRenderer);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); 
<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);</p>
<p><br>&nbsp;//create an instance of the class vtkBMPReader<br>&nbsp;vtkBMPReader *br = vtkBMPReader::New();<br>&nbsp;<br>&nbsp;br-&gt;SetFilePrefix(&quot;C:\\Images\\conductivities\\slice&quot;); <br>&nbsp;br-&gt;SetFilePattern(&quot;%s%d.bmp&quot;); 
<br>&nbsp;br-&gt;SetFileNameSliceOffset(1);<br>&nbsp;br-&gt;SetFileNameSliceSpacing(1);<br>&nbsp;br-&gt;SetNumberOfScalarComponents(3);<br>&nbsp;br-&gt;SetDataSpacing(0.4,0.4,10);<br>&nbsp;br-&gt;SetDataOrigin(0,0,0);<br>&nbsp;br-&gt;SetDataExtent(0,255,0,255,0,7); 
<br>&nbsp;br-&gt;Update();<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();<br>&nbsp;opacityTransferFunction-&gt;AddPoint(20,0.2);<br>&nbsp;opacityTransferFunction-&gt;AddPoint(255,1.0);</p>
<p>&nbsp;vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();<br>&nbsp;volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);<br>&nbsp;</p>
<p><br>&nbsp;<br>&nbsp;vtkVolumeRayCastMapper *VolumeMapper = vtkVolumeRayCastMapper::New();<br>&nbsp;&nbsp;&nbsp; vtkVolumeRayCastCompositeFunction *RayCastFunction = vtkVolumeRayCastCompositeFunction::New();<br>&nbsp;&nbsp;&nbsp; VolumeMapper-&gt;SetVolumeRayCastFunction(RayCastFunction); 
<br>&nbsp;&nbsp;&nbsp; VolumeMapper-&gt;SetInput(br-&gt;GetOutput());</p>
<p>&nbsp;&nbsp;&nbsp; <br>&nbsp;vtkVolume *volume = vtkVolume::New();<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp; VolumeMapper-&gt;SetInput(br-&gt;GetOutput());<br>&nbsp;&nbsp; volume-&gt;SetMapper(VolumeMapper);</p>
<p>&nbsp;&nbsp;&nbsp; vtkCamera *aCamera = vtkCamera::New();<br>&nbsp;&nbsp;&nbsp; aCamera-&gt;SetViewUp (0, 0,-1);<br>&nbsp;&nbsp;&nbsp; aCamera-&gt;SetPosition (0, 1, 0);<br>&nbsp;&nbsp;&nbsp; aCamera-&gt;SetFocalPoint (0, 0, 0);<br>&nbsp;&nbsp;&nbsp; aCamera-&gt;ComputeViewPlaneNormal();</p>



<p><br>&nbsp;&nbsp;aRenderer-&gt;AddActor(volume);<br>&nbsp;aRenderer-&gt;SetActiveCamera(aCamera);<br>&nbsp;&nbsp;&nbsp; aRenderer-&gt;ResetCamera ();<br>&nbsp;aRenderer-&gt;SetBackground(1,1,1);<br>&nbsp;renWin-&gt;Render();<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; iren-&gt;Initialize(); 
<br>&nbsp;&nbsp;&nbsp; iren-&gt;Start(); <br>&nbsp;<br>}</p></div>
<div>&nbsp;</div>
<div>Thanks again for all your help.</div>
<div>Sharwari<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 8/31/06, <b class="gmail_sendername">Yixun Liu</b> &lt;<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn</a>&gt; wrote: 
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Bookman Old Style">Hi,</font></div>
<div><font face="Bookman Old Style">Assuming image is 256x256x100. The first file name is image1 and the last file name is image100. So, SetDataExtent(0, 255, 0, 255, 1, 100); The access violation may be caused by wrong extent setting. 
</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">If you use vtkVolume, use vtkVolumeRayCastMapper(vtk4.2.2) or&nbsp;use vtkFixedPointVolumeRayCastMapper(vtk5.0). Note that if you use vtkFixedPointVolumeRayCastMapper you no need to call SetVolumeRayCastFunction(); 
</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Hope it help.</font></div></div>
<div><span>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span> Liu</font></div></span></div>
<div><span>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><b>From:</b> <a title="sharwari@gmail.com" href="mailto:sharwari@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Sharwari Mavalankar</a> </div>
<div><b>To:</b> <a title="yxliu@fudan.edu.cn" href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Yixun Liu</a> </div>
<div><b>Cc:</b> <a title="vtkusers@vtk.org" href="mailto:vtkusers@vtk.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">VTK</a> </div>
<div><b>Sent:</b> Thursday, August 31, 2006 6:37 PM</div>
<div><b>Subject:</b> Re: Creating a Volume from 2D BMP files.</div>
<div><br>&nbsp;</div>
<div>hi Yixun,</div>
<div>Thanks for your email.I had a couple of more questions though.</div>
<div>1.I do not want to visualize colour slices.They are grey level images.</div>
<div>&nbsp;</div>
<div>2.Also if I put SetDataExtent() before the Update() then I am getting an access violation error.What does the Update function do exactly?</div>
<div>Also can you tell me what the five parameters in SetDataExtent() mean?</div>
<div>&nbsp;</div>
<div>3.If I use vtkVolume what mapper should I use to visualize the slices?</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>Thanks again for all your help.</div>
<div>Sharwari</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">On 8/23/06, <b class="gmail_sendername">Yixun Liu</b> &lt;<a href="mailto:yxliu@fudan.edu.cn" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">yxliu@fudan.edu.cn</a>&gt; wrote: 
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div>
<div 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">If you want to visualize color slices, you need to </font></div>
<div><font face="Bookman Old Style">1. read these slices. You need to put the SetDataExtent(0, 111, 0, 127, 1, 300);<br>before Update();</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">&nbsp;vtkTIFFReader *v16 = vtkTIFFReader::New();<br></font><font face="Bookman Old Style">&nbsp;v16-&gt;SetFilePrefix(&quot;D:\\MyVC\\VTKtest\\Raycasting\\Data\\BrainColor\\brain&quot;);<br>&nbsp;v16-&gt;SetFilePattern(&quot;%s%d.TIF&quot;); 
<br>&nbsp;v16-&gt;SetDataExtent(0, 111, 0, 127, 1, 300);<br>&nbsp;v16-&gt;SetDataSpacing(1.2,1.2,0.5);<br>&nbsp;v16-&gt;SetDataOrigin(0.0, 0.0, 0.0);</font></div>
<div><font face="Bookman Old Style">&nbsp;v16-&gt;SetNumberOfScalarComponents(3);<br></font><font face="Bookman Old Style">&nbsp;v16-&gt;Update();</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">2. Add the 4th component. The first three components are color and the 4th is used to map to opacity. I compute the luminancy according to the firft three components and take it as the 4th component. 
</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">3. Opacity map using vtkPiecewiseFunction</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">4. no need color map function</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">5. you need vtk5.0</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style">Regads,</font></div>
<div><font face="Bookman Old Style"></font>&nbsp;</div>
<div><font face="Bookman Old Style"><span name="st">Yixun</span> Liu</font></div>
<div><br>&nbsp;</div>
<div><font face="Bookman Old Style"></font>&nbsp;</div></div></div></blockquote></div><br></blockquote></span></div>
<div></div></div></blockquote></div><br></span></div>
<div>
<blockquote></blockquote></div></div></blockquote></div><br></span></div>
<div>
<blockquote></blockquote></div></div></blockquote></div><br>

</span></div><br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br><br></blockquote></div><br>