<!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> </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> </DIV>
<DIV><FONT face=Arial size=2>which is created by me.But it is giving runtime
exception at export function. Please give me </FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=Arial size=2>exception.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Volume *volMIP(Volume *vol)<BR>{<BR> unsigned
short *Buffer = NULL;<BR> Buffer = (unsigned short *)
vol->Mem;<BR> </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> vtkRenderer *renderer
=vtkRenderer::New();<BR> vtkRenderWindow
*renWin=vtkRenderWindow::New();<BR> <BR> vtkImageImport *Importer =
vtkImageImport::New();<BR> Importer->SetDataExtent(1, vol->width, 1,
vol->height, 1, vol->depth);<BR> Importer->SetWholeExtent(1,
vol->width, 1, vol->height, 1,
vol->depth);<BR> Importer->SetDataScalarTypeToUnsignedShort(
);<BR> Importer->SetImportVoidPointer(vol->Mem); //
Importing the Buffer<BR> </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> <BR> vtkVolumeProperty
*volumeProperty=vtkVolumeProperty::New();<BR> <BR> vtkVolumeRayCastIsosurfaceFunction
*iso=vtkVolumeRayCastIsosurfaceFunction::New();<BR> vtkVolumeRayCastMapper
*volumeMapper=vtkVolumeRayCastMapper::New();<BR> <BR> vtkVolumeRayCastCompositeFunction </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>*compositeFunction=vtkVolumeRayCastCompositeFunction::New();<BR> <BR> vtkVolumeRayCastMIPFunction
*mip=vtkVolumeRayCastMIPFunction ::New();<BR> vtkVolume
*volume1=vtkVolume::New();<BR> <BR> <BR> vtkPiecewiseFunction
*opacityTransferFunction=vtkPiecewiseFunction::New();<BR> opacityTransferFunction->AddPoint(20,0.0);<BR> opacityTransferFunction->AddPoint(255,0.3);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> vtkColorTransferFunction
*colorTransferFunction=vtkColorTransferFunction::New();<BR> colorTransferFunction->AddRGBPoint(0.0,0.0,0.0,0.0);<BR> colorTransferFunction->AddRGBPoint(64.0,
1.0,0.0,0.0);<BR> colorTransferFunction->AddRGBPoint(128.0,0.0,0.0,1.0);<BR> colorTransferFunction->AddRGBPoint(192.0,0.0,1.0,0.0);<BR> colorTransferFunction->AddRGBPoint(255.0,0.0,0.2,0.0);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
<BR> volumeProperty->SetColor(colorTransferFunction);<BR> volumeProperty->SetScalarOpacity(opacityTransferFunction);<BR> volumeProperty->SetInterpolationTypeToLinear();<BR> volumeProperty->ShadeOn();<BR> mip->SetMaximizeMethodToScalarValue();<BR> mip->SetMaximizeMethodToOpacity();<BR>
<BR> <BR> volumeMapper->SetVolumeRayCastFunction(compositeFunction);///for
Raycast Technique</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2> volumeMapper->SetVolumeRayCastFunction(mip);<BR> <BR> volumeMapper->SetSampleDistance(0.25);<BR> volumeMapper->SetInput(Importer->GetOutput());<BR> <BR> volume1->SetMapper(volumeMapper);<BR> volume1->SetProperty(volumeProperty);<BR> <BR> vtkImageImport
*Importer1 = vtkImageImport::New();<BR> Importer1->SetDataExtent(1,
vol->width, 1, vol->height, 1,
vol->depth);<BR> Importer1->SetWholeExtent(1, vol->width, 1,
vol->height, 1,
vol->depth);<BR> Importer1->SetDataScalarTypeToUnsignedShort(
);<BR> Importer1->SetImportVoidPointer(volume1);</FONT></DIV>
<DIV><FONT face=Arial size=2> vtkImageExport *Exporter =
vtkImageExport::New();</FONT></DIV>
<DIV><FONT face=Arial
size=2> Exporter->SetInput(Importer->GetOutput());
<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>******* Exporter->Export(Buffer); //
Exporting the buffer exception is coming here<BR> vol->Mem
=Buffer;<BR> return vol;<BR>}</FONT></DIV></BODY></HTML>