<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->SetDataSpacing(1,1,1);</font>
<br><font size=2 face="sans-serif">maybe something like</font>
<br><font size=2 face="Courier New">Reader->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->SetOpacity(oTFun);</font>
<br>
<br><font size=2 face="sans-serif">try</font>
<br>
<br><font size=2 face="Courier New">volProperty->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: </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 <yass@uscx.net></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"> </font>
<br><font size=1 face="sans-serif"> To: vtk users <vtkusers@public.kitware.com></font>
<br><font size=1 face="sans-serif"> cc: (bcc: John Anast-JM/PGI)</font>
<br><font size=1 face="sans-serif"> Subject: [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 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>
vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer(aRenderer);<br>
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
<br>
<br>
vtkTIFFReader *Reader = vtkTIFFReader::New();<br>
Reader->SetFilePrefix ("D:/tiff/TIFF/MRI"); //Location of slices<br>
Reader->SetFilePattern("%s%.4d.tif");<br>
Reader->SetDataExtent (0,255,0,255,1,15); //No.of slices<br>
Reader->SetDataSpacing(1,1,1);<br>
Reader->Update();<br>
<br>
vtkPiecewiseFunction *oTFun =vtkPiecewiseFunction::New();<br>
oTFun->AddSegment(80,0.0,255,1.0);<br>
vtkPiecewiseFunction *gTFun =vtkPiecewiseFunction::New();<br>
gTFun->AddSegment(0,1.0,255,1.0);<br>
vtkVolumeProperty *volProperty = vtkVolumeProperty::New();<br>
volProperty->SetColor(gTFun);<br>
<br>
//volProperty->SetOpacity(oTFun);<br>
volProperty->SetInterpolationTypeToLinear();<br>
volProperty->ShadeOn();<br>
<br>
vtkVolumeRayCastCompositeFunction *compositeFunction= vtkVolumeRayCastCompositeFunction::New();<br>
vtkVolumeRayCastMapper *volMapper = vtkVolumeRayCastMapper::New();<br>
volMapper->SetInput(Reader->GetOutput()); <br>
volMapper->SetVolumeRayCastFunction(compositeFunction);<br>
<br>
vtkVolume *vol=vtkVolume::New();<br>
vol->SetMapper(volMapper); <br>
vol->SetProperty(volProperty); <br>
aRenderer->AddVolume(vol);<br>
aRenderer->SetBackground(1,1,1);<br>
<br>
vtkCamera *aCamera = vtkCamera::New();<br>
aCamera->SetViewUp (0, 0, -1);<br>
aCamera->SetPosition (0, 1, 0);<br>
aCamera->SetFocalPoint (0, 0, 0);<br>
aCamera->ComputeViewPlaneNormal();<br>
aRenderer->SetActiveCamera(aCamera);<br>
aRenderer->ResetCamera ();<br>
aCamera->Dolly(1.5);<br>
<br>
renWin->SetSize(640, 480);<br>
iren->SetDesiredUpdateRate(3.0);<br>
iren->Initialize();<br>
iren->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 & 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: <http://public.kitware.com/cgi-bin/vtkfaq><br>
Follow this link to subscribe/unsubscribe:<br>
http://public.kitware.com/mailman/listinfo/vtkusers<br>
</font>
<br>
<br>