<!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.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" size=3>Hi 
everyone<BR><BR>I have a couple of png files (test201.png - test257.png) that 
are slices<BR>from a vein system, the veins being white, the surroundings black. 
I want to<BR>build a volume from these slices, using the following code (put 
together<BR>from various examples):<BR><BR>vtkRenderer ren1 = new 
vtkRenderer();<BR>vtkRenderWindow renWin = new 
vtkRenderWindow();<BR>renWin.AddRenderer(ren1);<BR>vtkRenderWindowInteractor 
iren = new 
vtkRenderWindowInteractor();<BR>iren.SetRenderWindow(renWin);<BR><BR>vtkPNGReader 
pngreader = new 
vtkPNGReader();<BR>pngreader.SetFilePrefix("data/png/test2");<BR>pngreader.SetFilePattern("%s%.2d.png");<BR>pngreader.SetDataExtent(1,256,1,256,0,57);<BR>pngreader.SetFileNameSliceOffset(1);<BR>pngreader.SetDataSpacing(1,1,1);<BR>pngreader.SetDataByteOrderToLittleEndian();<BR>pngreader.UpdateWholeExtent();<BR><BR>vtkPiecewiseFunction 
opacityTransferFunction = new 
vtkPiecewiseFunction();<BR>opacityTransferFunction.AddPoint(0, 
0.0);<BR>opacityTransferFunction.AddPoint(10, 
0.259);<BR>opacityTransferFunction.AddPoint(50, 
1.0);<BR><BR>vtkColorTransferFunction colorTransferFunction = 
new<BR>vtkColorTransferFunction();<BR>colorTransferFunction.AddRGBPoint(0.0, 
0.0, 0.0, 0.0);<BR>colorTransferFunction.AddRGBPoint(10.0, 0.259, 0.259, 
0.3);<BR>colorTransferFunction.AddRGBPoint(255.0, 1.0, 1.0, 
0.3);<BR><BR>vtkVolumeProperty volumeProperty = new 
vtkVolumeProperty();<BR>volumeProperty.SetColor(colorTransferFunction);<BR>volumeProperty.SetScalarOpacity(opacityTransferFunction);<BR>volumeProperty.SetInterpolationTypeToLinear();<BR>volumeProperty.ShadeOff();<BR><BR>vtkVolumeRayCastCompositeFunction 
compositeFunction = 
new<BR>vtkVolumeRayCastCompositeFunction();<BR>vtkVolumeRayCastMapper 
volumeMapper = new 
vtkVolumeRayCastMapper();<BR>volumeMapper.SetVolumeRayCastFunction(compositeFunction);<BR>volumeMapper.SetInput(pngreader.GetOutput());<BR><BR>vtkVolume 
volume = new 
vtkVolume();<BR>volume.SetMapper(volumeMapper);<BR>volume.SetProperty(volumeProperty);<BR>ren1.AddVolume(volume);<BR>ren1.SetBackground(0.1, 
0.2, 0.4);<BR>renWin.Render();<BR>iren.Initialize();<BR><BR>All I get from this 
is a blue window with a few yellow dots. The window<BR>immediately vanishes 
after half a second.<BR>What am I doing wrong?<BR><BR>Thanks in 
advance</FONT><BR></FONT></DIV></BODY></HTML>