<br><font size=2 face="sans-serif">Yasser,</font>
<br>
<br><font size=2 face="sans-serif">I think your data spacing needs to be corrected to the actual spacing of the MRI data. I doubt that with 15 slices that the x=y=z spacing. I suspect z is 5-10 times larger</font>
<br><font size=2 face="Courier New">Reader-&gt;SetDataSpacing(1,1,1);</font>
<br><font size=2 face="sans-serif">maybe something like</font>
<br><font size=2 face="Courier New">Reader-&gt;SetDataSpacing(0.8,0.8,4.0);</font><font size=2 face="sans-serif"> </font>
<br>
<br><font size=2 face="sans-serif">Also where you commented out</font>
<br><font size=2 face="Courier New">//volProperty-&gt;SetOpacity(oTFun);</font>
<br>
<br><font size=2 face="sans-serif">try</font>
<br>
<br><font size=2 face="Courier New">volProperty-&gt;SetScalarOpacity(oTFun);</font>
<br>
<br><font size=2 face="Courier New">Finally, I've not seen piecewisefunction used to create the color transfer function....you might want to try something like this from the examples (VTK/Examples/VolumeRendering/Python/SimpleRayCast.py in Python but its easily transfered to C++)</font>
<br>
<br><font size=3 face="Courier New"># Create transfer mapping scalar value to color<br>
colorTransferFunction = vtk.vtkColorTransferFunction()<br>
colorTransferFunction.AddRGBPoint(0.0, 0.0, 0.0, 0.0)<br>
colorTransferFunction.AddRGBPoint(64.0, 1.0, 0.0, 0.0)<br>
colorTransferFunction.AddRGBPoint(128.0, 0.0, 0.0, 1.0)<br>
colorTransferFunction.AddRGBPoint(192.0, 0.0, 1.0, 0.0)<br>
colorTransferFunction.AddRGBPoint(255.0, 0.0, 0.2, 0.0)<br>
</font>
<br>
<br><font size=2 face="sans-serif">...john</font>
<br>
<br>
<br>
<table>
<tr valign=top>
<td><font size=6 color=red face="Times New Roman"><b>Internet Mail Message</b></font>
<br><font size=2 color=red face="sans-serif">Received from host: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=2 face="sans-serif"><b>public.kitware.com [24.97.130.19]</b></font>
<td></table>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>yasser salman &lt;yass@uscx.net&gt;</b></font>
<br><font size=1 face="sans-serif">Sent by: vtkusers-admin@public.kitware.com</font>
<p><font size=1 face="sans-serif">04/17/2003 07:52 AM</font>
<br><font size=1 face="sans-serif">Please respond to yass</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;vtk users &lt;vtkusers@public.kitware.com&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;(bcc: John Anast-JM/PGI)</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;[vtkusers] 3D MRI Volume.</font></table>
<br>
<br>
<br><font size=2 face="Courier New">hi all..,<br>
 there is my code to render a 3D Volume of MRI slice., <br>
it works good but &nbsp;it displayed in a worng way (contrast is too bad and also it seems not fit in the slice it self like the data was overlaped each other)<br>
i think the problem in reading the files(or may be in Opacity..).<br>
here is my code:..( i changed the opacity,color but no effect..).. can any one help me to find <br>
where is the problem here?<br>
<br>
<br>
<br>
vtkRenderer *aRenderer = vtkRenderer::New();<br>
 &nbsp;vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
 &nbsp; &nbsp;renWin-&gt;AddRenderer(aRenderer);<br>
 &nbsp;vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
 &nbsp; &nbsp;iren-&gt;SetRenderWindow(renWin);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkTIFFReader *Reader = vtkTIFFReader::New();<br>
 &nbsp; &nbsp;Reader-&gt;SetFilePrefix (&quot;D:/tiff/TIFF/MRI&quot;); //Location of slices<br>
 &nbsp; &nbsp;Reader-&gt;SetFilePattern(&quot;%s%.4d.tif&quot;);<br>
 &nbsp; &nbsp;Reader-&gt;SetDataExtent (0,255,0,255,1,15); //No.of slices<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Reader-&gt;SetDataSpacing(1,1,1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Reader-&gt;Update();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkPiecewiseFunction *oTFun =vtkPiecewiseFunction::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; oTFun-&gt;AddSegment(80,0.0,255,1.0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkPiecewiseFunction *gTFun =vtkPiecewiseFunction::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gTFun-&gt;AddSegment(0,1.0,255,1.0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkVolumeProperty *volProperty = vtkVolumeProperty::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; volProperty-&gt;SetColor(gTFun);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //volProperty-&gt;SetOpacity(oTFun);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; volProperty-&gt;SetInterpolationTypeToLinear();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; volProperty-&gt;ShadeOn();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkVolumeRayCastCompositeFunction *compositeFunction= vtkVolumeRayCastCompositeFunction::New();<br>
vtkVolumeRayCastMapper *volMapper = vtkVolumeRayCastMapper::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; volMapper-&gt;SetInput(Reader-&gt;GetOutput()); <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; volMapper-&gt;SetVolumeRayCastFunction(compositeFunction);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkVolume *vol=vtkVolume::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vol-&gt;SetMapper(volMapper); &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vol-&gt;SetProperty(volProperty); <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aRenderer-&gt;AddVolume(vol);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aRenderer-&gt;SetBackground(1,1,1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkCamera *aCamera = vtkCamera::New();<br>
 &nbsp; &nbsp;aCamera-&gt;SetViewUp (0, 0, -1);<br>
 &nbsp; &nbsp;aCamera-&gt;SetPosition (0, 1, 0);<br>
 &nbsp; &nbsp;aCamera-&gt;SetFocalPoint (0, 0, 0);<br>
 &nbsp; &nbsp;aCamera-&gt;ComputeViewPlaneNormal();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aRenderer-&gt;SetActiveCamera(aCamera);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aRenderer-&gt;ResetCamera ();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aCamera-&gt;Dolly(1.5);<br>
 &nbsp; &nbsp;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;renWin-&gt;SetSize(640, 480);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iren-&gt;SetDesiredUpdateRate(3.0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iren-&gt;Initialize();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; iren-&gt;Start(); <br>
<br>
thanx.. yasser<br>
<br>
_____________________________________________________________<br>
Your own email, free website, free software and services at <br>
<br>
http://www.uscomputer.net/portal.htm <br>
- courtesy of U.S. Computer Corporation -<br>
<br>
_____________________________________________________________<br>
Select your own custom email address for FREE! Get you@yourchoice.com w/No Ads, 6MB, POP &amp; more! http://www.everyone.net/selectmail?campaign=tag<br>
_______________________________________________<br>
This is the private VTK discussion list. <br>
Please keep messages on-topic. Check the FAQ at: &lt;http://public.kitware.com/cgi-bin/vtkfaq&gt;<br>
Follow this link to subscribe/unsubscribe:<br>
http://public.kitware.com/mailman/listinfo/vtkusers<br>
</font>
<br>
<br>