<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1170" 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 colud anybody llok into the following code 
and tell me where the error exactly is.</FONT></DIV>
<DIV><FONT face=Arial size=2>I took most of the following code&nbsp; from the 
Python example</FONT></DIV>
<DIV><FONT face=Arial 
size=2>vtk42\Examples\VolumeRendering\Python\SimpleRayCast.py </FONT></DIV>
<DIV><FONT face=Arial size=2>The only change is instead of <FONT 
size=3>vtkStructuredPointsReader i'm using vtkStructuredPoints 
</FONT></FONT><FONT face=Arial size=2></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><FONT color=#0000ff size=2>
<P>void</FONT><FONT size=2> VolumeMapper(</FONT><FONT color=#0000ff 
size=2>void</FONT><FONT size=2>)</FONT></P>
<P><FONT size=2>{</FONT></P>
<P><FONT color=#008000 size=2>// Create the standard renderer, render window and 
interactor</P></FONT><FONT size=2>
<P>vtkRenderer *ren = vtkRenderer::New();</P>
<P>vtkRenderWindow *renWin = vtkRenderWindow::New();</P>
<P>renWin-&gt;AddRenderer(ren);</P>
<P>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</P>
<P>iren-&gt;SetRenderWindow(renWin);</P>
<P>vtkStructuredPoints *sp = vtkStructuredPoints::New();</P>
<P>sp-&gt;SetDimensions(5, 5, 5);</P>
<P>sp-&gt;SetOrigin(0, 0, 0);</P>
<P>sp-&gt;SetSpacing(2, 2, 2);</P>
<P>vtkUnsignedIntArray *scalars = vtkUnsignedIntArray::New();</P>
<P>scalars-&gt;SetNumberOfTuples(1);</P>
<P>scalars-&gt;SetNumberOfValues(64);</P>
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2> (</FONT><FONT 
color=#0000ff size=2>int</FONT><FONT size=2> i=0; i&lt; 64; i++)</P>
<P>{</P>
<P>scalars-&gt;SetValue(i,125);</P>
<P>}</P>
<P>sp-&gt;GetCellData()-&gt;SetScalars(scalars);</P>
<P></P></FONT><FONT color=#008000 size=2>
<P>// Create transfer mapping scalar value to opacity</P></FONT><FONT size=2>
<P>vtkPiecewiseFunction *opacityTransferFunction = 
vtkPiecewiseFunction::New();</P>
<P>opacityTransferFunction-&gt;AddPoint(20, 0.0);</P>
<P>opacityTransferFunction-&gt;AddPoint(255, 0.2);</P></FONT><FONT color=#008000 
size=2>
<P>//# Create transfer mapping scalar value to color</P></FONT><FONT size=2>
<P>vtkColorTransferFunction *colorTransferFunction = 
vtkColorTransferFunction::New();</P>
<P>colorTransferFunction-&gt;AddRGBPoint(0.0, 0.0, 0.0, 0.0);</P>
<P>colorTransferFunction-&gt;AddRGBPoint(64.0, 1.0, 0.0, 0.0);</P>
<P>colorTransferFunction-&gt;AddRGBPoint(128.0, 0.0, 0.0, 1.0);</P>
<P>colorTransferFunction-&gt;AddRGBPoint(192.0, 0.0, 1.0, 0.0);</P>
<P>colorTransferFunction-&gt;AddRGBPoint(255.0, 0.0, 0.2, 0.0);</P></FONT><FONT 
color=#008000 size=2>
<P>// The property describes how the data will look</P></FONT><FONT size=2>
<P>vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();</P>
<P>volumeProperty-&gt;SetColor(colorTransferFunction);</P>
<P>volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);</P>
<P>volumeProperty-&gt;ShadeOn();</P></FONT><FONT color=#008000 size=2>
<P>//volumeProperty-&gt;SetInterpolationTypeToLinear();</P>
<P>// The mapper / ray cast function know how to render the data</P></FONT><FONT 
size=2>
<P>vtkVolumeRayCastCompositeFunction *compositeFunction = 
vtkVolumeRayCastCompositeFunction::New();</P>
<P>vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();</P>
<P>volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction);</P>
<P>volumeMapper-&gt;SetInput(sp);<STRONG>&nbsp; 
-----------------------------------&gt;//</STRONG>here is the change from python 
code </P></FONT><FONT color=#008000 size=2>
<P>// The volume holds the mapper and the property and</P>
<P>// can be used to position/orient the volume</P></FONT><FONT size=2>
<P>vtkVolume *volume = vtkVolume::New();</P>
<P>volume-&gt;SetMapper(volumeMapper);</P>
<P>volume-&gt;SetProperty(volumeProperty);</P>
<P>ren-&gt;AddVolume(volume);</P>
<P>ren-&gt;SetBackground(1, 1, 1);</P></FONT><FONT color=#008000 size=2>
<P>//renWin-&gt;SetSize(600, 600);</P>
<P>//renWin-&gt;Render();</P>
<P>//renWin.AddObserver("AbortCheckEvent", CheckAbort)</P>
<P><FONT color=#000000></FONT>&nbsp;</P>
<P>//vtkActor *actor2 = vtkActor::New();</P>
<P>//actor2-&gt;SetMapper(volumeMapper);</P>
<P>//ren-&gt;AddActor(actor2);</P></FONT><FONT color=#0000ff size=2>
<P>int</FONT><FONT size=2> ipen = renWin-&gt;GetEventPending();</P>
<P>iren-&gt;Initialize();</P>
<P>renWin-&gt;Render();</P>
<P>iren-&gt;Start();</P>
<P>ren-&gt;Delete();</P>
<P>renWin-&gt;Delete();</P>
<P>iren-&gt;Delete();</P>
<P>opacityTransferFunction-&gt;Delete();</P>
<P>colorTransferFunction-&gt;Delete();</P>
<P>volumeProperty-&gt;Delete();</P>
<P>compositeFunction-&gt;Delete();</P>
<P>volumeMapper-&gt;Delete();</P>
<P>volume-&gt;Delete();</P>
<P>sp-&gt;Delete();</P>
<P>scalars-&gt;Delete();</P>
<P>}</P>
<P>&nbsp;</P>
<P>thanks in advance</P>
<P>rgds</P>
<P>krishna</P></FONT></FONT></DIV></BODY></HTML>