<!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 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear Friends,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am working on vtkVolumeRaycastMIPFunction.I want 
to export ray castmip function o/p into buffer </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>which is created by me.But it is giving runtime 
exception at export function.&nbsp; Please give me </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>suggestion.I have written code as follows. I have 
indicated the line of code raising the </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>exception.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Volume *volMIP(Volume *vol)<BR>{<BR>&nbsp;unsigned 
short *Buffer = NULL;<BR>&nbsp;Buffer = (unsigned short *) 
vol-&gt;Mem;<BR>&nbsp;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;vtkRenderer *renderer 
=vtkRenderer::New();<BR>&nbsp;vtkRenderWindow 
*renWin=vtkRenderWindow::New();<BR>&nbsp;<BR>&nbsp;vtkImageImport *Importer = 
vtkImageImport::New();<BR>&nbsp;Importer-&gt;SetDataExtent(1, vol-&gt;width, 1, 
vol-&gt;height, 1, &nbsp;vol-&gt;depth);<BR>&nbsp;Importer-&gt;SetWholeExtent(1, 
vol-&gt;width, 1, vol-&gt;height, 1, 
vol-&gt;depth);<BR>&nbsp;Importer-&gt;SetDataScalarTypeToUnsignedShort( 
);<BR>&nbsp;Importer-&gt;SetImportVoidPointer(vol-&gt;Mem);&nbsp;&nbsp; // 
Importing the Buffer<BR>&nbsp;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;<BR>&nbsp;vtkVolumeProperty 
*volumeProperty=vtkVolumeProperty::New();<BR>&nbsp;<BR>&nbsp;vtkVolumeRayCastIsosurfaceFunction 
*iso=vtkVolumeRayCastIsosurfaceFunction::New();<BR>&nbsp;vtkVolumeRayCastMapper 
*volumeMapper=vtkVolumeRayCastMapper::New();<BR>&nbsp;<BR>&nbsp;vtkVolumeRayCastCompositeFunction&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>*compositeFunction=vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;<BR>&nbsp;vtkVolumeRayCastMIPFunction 
*mip=vtkVolumeRayCastMIPFunction ::New();<BR>&nbsp;vtkVolume 
*volume1=vtkVolume::New();<BR>&nbsp;&nbsp;<BR>&nbsp;<BR>&nbsp;vtkPiecewiseFunction 
*opacityTransferFunction=vtkPiecewiseFunction::New();<BR>&nbsp;opacityTransferFunction-&gt;AddPoint(20,0.0);<BR>&nbsp;opacityTransferFunction-&gt;AddPoint(255,0.3);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;vtkColorTransferFunction 
*colorTransferFunction=vtkColorTransferFunction::New();<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(0.0,0.0,0.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(64.0, 
1.0,0.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(128.0,0.0,0.0,1.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(192.0,0.0,1.0,0.0);<BR>&nbsp;colorTransferFunction-&gt;AddRGBPoint(255.0,0.0,0.2,0.0);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
<BR>&nbsp;volumeProperty-&gt;SetColor(colorTransferFunction);<BR>&nbsp;volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);<BR>&nbsp;volumeProperty-&gt;SetInterpolationTypeToLinear();<BR>&nbsp;volumeProperty-&gt;ShadeOn();<BR>&nbsp;mip-&gt;SetMaximizeMethodToScalarValue();<BR>&nbsp;mip-&gt;SetMaximizeMethodToOpacity();<BR>&nbsp; 
<BR>&nbsp;<BR>&nbsp;volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction);///for 
Raycast Technique</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>&nbsp;volumeMapper-&gt;SetVolumeRayCastFunction(mip);<BR>&nbsp;<BR>&nbsp;volumeMapper-&gt;SetSampleDistance(0.25);<BR>&nbsp;volumeMapper-&gt;SetInput(Importer-&gt;GetOutput());<BR>&nbsp;<BR>&nbsp;volume1-&gt;SetMapper(volumeMapper);<BR>&nbsp;volume1-&gt;SetProperty(volumeProperty);<BR>&nbsp;<BR>&nbsp;vtkImageImport 
*Importer1 = vtkImageImport::New();<BR>&nbsp;Importer1-&gt;SetDataExtent(1, 
vol-&gt;width, 1, vol-&gt;height, 1, 
vol-&gt;depth);<BR>&nbsp;Importer1-&gt;SetWholeExtent(1, vol-&gt;width, 1, 
vol-&gt;height, 1, 
vol-&gt;depth);<BR>&nbsp;Importer1-&gt;SetDataScalarTypeToUnsignedShort( 
);<BR>&nbsp;Importer1-&gt;SetImportVoidPointer(volume1);</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;vtkImageExport *Exporter = 
vtkImageExport::New();</FONT></DIV>
<DIV><FONT face=Arial 
size=2>&nbsp;Exporter-&gt;SetInput(Importer-&gt;GetOutput());&nbsp; 
<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>*******&nbsp;Exporter-&gt;Export(Buffer); // 
Exporting the buffer exception is coming here<BR>&nbsp;vol-&gt;Mem 
=Buffer;<BR>&nbsp;return vol;<BR>}</FONT></DIV></BODY></HTML>