<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1250">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi all,</FONT></DIV>
<DIV><FONT face=Arial size=2>please could you help me with this simple 
problem?</FONT></DIV>
<DIV><FONT face=Arial size=2>I want to render the sphere with the 
vtkVolumeRayCastMapper. So I create sphere, mapper, volume properties and 
finally vtkVolume and I render it with vtkRenderWindowInteractor. But the 
program crash when I call iren-&gt;Render(). Bellow is the short C++ 
code.&nbsp;Are there some mistakes?</FONT></DIV>
<DIV><FONT face=Arial size=2>I'm using VTK 4.0 and Borland C++ 6</FONT></DIV>
<DIV><FONT face=Arial size=2>Thanks a lot.</FONT></DIV>
<DIV><FONT face=Arial size=2>Radim</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>//---------------------------------------------------------------------------<BR>#include 
"vtkSphereSource.h"<BR>#include "vtkVolumeRayCastMapper.h"<BR>#include 
"vtkActor.h"<BR>#include "vtkRenderer.h"<BR>#include 
"vtkRenderWindowInteractor.h"<BR>#include "vtkRenderWindow.h"<BR>#include 
"vtkVolumeRayCastMIPFunction.h"<BR>#include "vtkImageData.h"<BR>#include 
"vtkVolumeProperty.h"<BR>#include "vtkPiecewiseFunction.h"</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>#include &lt;vcl.h&gt;<BR>#pragma 
hdrstop</FONT></DIV>
<DIV><FONT face=Arial 
size=2>//---------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>#pragma argsused<BR>int main(int argc, char* 
argv[])<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkSphereSource 
*sphere;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sphere = 
vtkSphereSource::New();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vtkVolumeRayCastMIPFunction *RayCastMethod = 
vtkVolumeRayCastMIPFunction::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vtkVolumeRayCastMapper *mapper = vtkVolumeRayCastMapper::New();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper-&gt;SetVolumeRayCastFunction( RayCastMethod );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vtkImageData *vol;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vol = 
vtkImageData::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vol-&gt;SetSource( sphere );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper-&gt;SetInput( vol );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;vtkColorTransferFunction *colorF = 
vtkColorTransferFunction::New();<BR>&nbsp;&nbsp;&nbsp; colorF-&gt;AddRGBSegment( 
0, 0.0, 0.0, 0.0, 255, 0.5, 0.1, 1.0 );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;//-------- 
Mapping from scalar -&gt; opacity ------------<BR>&nbsp;vtkPiecewiseFunction 
*opacityF = vtkPiecewiseFunction::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
opacityF-&gt;AddPoint( 10, 0.1 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opacityF-&gt;AddPoint( 200, 0.9 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opacityF-&gt;ClampingOff();</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>vtkVolumeProperty *volumeP = 
vtkVolumeProperty::New();<BR>&nbsp;&nbsp;&nbsp; volumeP-&gt;SetColor( colorF 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp; volumeP-&gt;SetScalarOpacity( opacityF 
);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;vtkVolume *volume = 
vtkVolume::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp; volume-&gt;SetMapper( mapper 
);<BR>&nbsp;&nbsp;&nbsp;&nbsp; volume-&gt;SetProperty( volumeP );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR>vtkRenderer *ren1;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ren1 = 
vtkRenderer::New();<BR>&nbsp;&nbsp;&nbsp; ren1-&gt;AddProp( volume );</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkRenderWindow *renWin; renWin = 
vtkRenderWindow::New();<BR>&nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer( ren1 
);</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkRenderWindowInteractor *iren; iren = 
vtkRenderWindowInteractor::New();<BR>&nbsp;&nbsp;&nbsp; 
iren-&gt;SetRenderWindow( renWin );</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
iren-&gt;Render();&nbsp;&nbsp;&nbsp;&nbsp; //here it 
crash<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iren-&gt;Start();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
iren-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
renWin-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ren1-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
RayCastMethod-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
volume-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
vol-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
mapper-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
sphere-&gt;Delete();</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
0;<BR>}<BR>//---------------------------------------------------------------------------<BR></FONT></DIV></BODY></HTML>