<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Hello all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm using VTK in my project to make&nbsp;a 3D reconstruction from a stack of medical images ( CT, and MRI).</DIV>
<DIV>the problem I'm facing doesn't concern the reconstruction itself, because it's done well, but the problem is when I want to manipulate the rendered Volume (rotate, zoom..) using the mouse, it take allaways 100% af CPU charge and somteimes it stopps reacting to the mouse events and the CPU charge still at 100%.</DIV>
<DIV>I followed the example given in the book Visual Toolkit (4th edition).</DIV>
<DIV>I'm developping using Vtk&nbsp; 5.0.2 , VC++ 2008 under WinXP.</DIV>
<DIV>this is the code I'm using :</DIV>
<DIV>&nbsp;</DIV>
<DIV>//acreation of the volume</DIV>
<DIV>
<P>data2=vtkStructuredPoints::New();</P></DIV>
<DIV>
<P>data2-&gt;SetDimensions(WdthVlm,HghtVlm,DpthVlm); </P>
<P>data2-&gt;SetScalarType(VTK_UNSIGNED_SHORT);</P>
<P>data2-&gt;AllocateScalars();</P>
<P>.....</P>
<P>&nbsp;</P></DIV>
<DIV>
<P>//rendering</P>
<P>&nbsp;</P>
<P>vtkRenderer *aRender3D = vtkRenderer::New(); </P>
<P>&nbsp;</P></DIV>
<DIV><FONT color=#008000 size=2>
<P><FONT color=#000000 size=3>vtkRenderWindow * renWin = vtkRenderWindow::New();</FONT></P>
<P><FONT color=#000000 size=3>renWin-&gt;AddRenderer(aRender3D);</FONT></P>
<P><FONT color=#000000 size=3>renWin-&gt;SetSize(800,600);</FONT></P>
<P><FONT color=#000000 size=3></FONT>&nbsp;</P>
<P><FONT color=#000000 size=3>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</FONT></P>
<P><FONT color=#000000 size=3>iren-&gt;SetInteractorStyle(vtkInteractorStyleTrackballCamera::New());</FONT></P>
<P><FONT color=#000000 size=3>iren-&gt;SetRenderWindow(renWin);</FONT></P>
<P><FONT color=#000000 size=3></FONT>&nbsp;</P><FONT color=#000000 size=2>
<P><FONT size=3>vtkPiecewiseFunction *tPcWs = vtkPiecewiseFunction::New();</FONT></P><FONT size=2><FONT size=2>
<P><FONT size=3>tPcWs -&gt;AddPoint(0, 0.0);</FONT></P>
<P><FONT size=3>tPcWs -&gt;AddPoint(600.0, 0);</FONT></P>
<P><FONT size=3>tPcWs -&gt;AddPoint(1195.0, 0);</FONT></P>
<P><FONT size=3>tPcWs -&gt;AddPoint(1200, .2);</FONT></P>
<P><FONT size=3>tPcWs -&gt;AddPoint(1300, .3);</FONT></P>
<P><FONT size=3>tPcWs -&gt;AddPoint(4095, 1);</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>vtkColorTransferFunction *ctfun = vtkColorTransferFunction::New();</FONT></P>
<P><FONT size=3>ctfun-&gt;AddRGBPoint(0.0, 0.6, 0.2, 0.3);</FONT></P>
<P><FONT size=3>ctfun-&gt;AddRGBPoint(600.0, 1.0, 0.2, 0.3);</FONT></P>
<P><FONT size=3>ctfun-&gt;AddRGBPoint(1280.0, 0.9, 0.5, 0.7);</FONT></P>
<P><FONT size=3>ctfun-&gt;AddRGBPoint(1960.0, 0.81, 0.3, 0.3);</FONT></P>
<P><FONT size=3>ctfun-&gt;AddRGBPoint(4095.0, 0.5, 0.5, 0.5);</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>vtkVolumeRayCastCompositeFunction* compositeFunction = vtkVolumeRayCastCompositeFunction::New();</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();</FONT></P>
<P><FONT size=3>volumeMapper-&gt;SetInput(data2);</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction);</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetAmbient(0.2);</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetDiffuse(0.8);</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetSpecular(0.5);</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetSpecularPower(10);</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetColor(ctfun);</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetScalarOpacity(tfun);</FONT></P>
<P><FONT size=3>volumeProperty-&gt;SetInterpolationTypeToLinear();</FONT></P>
<P><FONT size=3>volumeProperty-&gt;ShadeOn();</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>vtkVolume *newvol = vtkVolume::New();</FONT></P>
<P><FONT size=3>newvol-&gt;SetMapper(volumeMapper);</FONT></P>
<P><FONT size=3>newvol-&gt;SetProperty(volumeProperty);</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>aCamera=vtkCamera::New();</FONT></P>
<P><FONT size=3>aCamera-&gt;SetViewUp(0,1,0);</FONT></P>
<P><FONT size=3>aCamera-&gt;SetPosition(0.0,0.0,1);</FONT></P>
<P><FONT size=3>aCamera-&gt;SetFocalPoint(0,0,0);</FONT></P>
<P><FONT size=3>aCamera-&gt;SetRoll(180);</FONT></P>
<P><FONT size=3>aCamera-&gt;SetParallelProjection(<FONT color=#0000ff>true</FONT>);</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P>
<P><FONT size=3>aRender3D-&gt;AddVolume(newvol);</FONT></P>
<P><FONT size=3>aRender3D-&gt;SetActiveCamera(aCamera);</FONT></P>
<P><FONT size=3>aRender3D-&gt;ResetCamera();</FONT></P>
<P><FONT size=3></FONT>&nbsp;</P><FONT color=#008000 size=2>
<P><FONT color=#000000 size=3>iren-&gt;Initialize(); </FONT></P>
<P><FONT color=#000000 size=3>renWin-&gt;Render();</FONT></P>
<P><FONT color=#000000 size=3>iren-&gt;Start();</FONT></P>
<P><FONT color=#000000 size=3>...</FONT></P>
<P><FONT color=#000000>}</FONT></P>
<P><FONT color=#000000></FONT>&nbsp;</P>
<P><FONT color=#000000 size=3>what's wrong with this code , is it usefull only whith low Volume capacity or is there somthing to do to make the interaction easier and faster.</FONT></P>
<P><FONT color=#000000 size=3>I've seen Osirix making the same but faster.</FONT></P>
<P><FONT color=#000000 size=3></FONT>&nbsp;</P>
<P><FONT color=#000000 size=3>thank you for your help.</FONT></P></FONT></FONT></FONT></FONT></FONT></DIV></div><br>



      <hr size="1"> 
Ne gardez plus qu'une seule adresse mail ! <a href="http://fr.rd.yahoo.com/mail/mail_taglines/trueswitch/SIG=11gshn0bu/**http%3A%2F%2Fwww.trueswitch.com%2Fyahoo-fr%2F">Copiez vos mails</a> vers Yahoo! Mail </body></html>