<DIV id=RTEContent>dear vtkusers,</DIV> <DIV>I am experiencing problem in volume rendeing using vtkvolumeRayCastMapper and using vtkVolumeRayCastCompositeFunction when I use a Color and opacity funtion to make most of my volume voxels transparent but viewing only some specific scalar range values. I am getting a "VTK RENDERING ERROR" and the execution time is terribly slow for a moderate size voxel (50,50,50).</DIV> <DIV> </DIV> <DIV>I know that, I might be doing something wrong as it is very common to see a floating volume using VTK and also in VolView. </DIV> <DIV> </DIV> <DIV>Please let me know your views. Any help is highly appreciated. Please find below the sample code.</DIV> <DIV> </DIV> <DIV>Many Thanks.</DIV> <DIV>Prasenjit Roy.</DIV> <DIV> </DIV> <DIV>// Image Data 8bit [data8bit is an input]</DIV> <DIV> vtkImageData *image3Ddata =
vtkImageData::NEW;<BR> image3Ddata->SetDimensions(dim[0],dim[1],dim[2]);<BR> image3Ddata->SetOrigin(org[0],org[1],org[2]);<BR> image3Ddata->SetSpacing(sp[0],sp[1],sp[2]);<BR> image3Ddata->SetScalarTypeToUnsignedChar();<BR> image3Ddata->SetNumberOfScalarComponents(1);<BR> image3Ddata->AllocateScalars();<BR> unsigned char *ptr8 = (unsigned char *) image3Ddata->GetScalarPointer();<BR> ubound = (dim[0]*dim[1]*dim[2]);<BR> for (k=0; k<ubound; k++)<BR> {<BR> *ptr8++ = (unsigned char) data8bit[k];<BR> }</DIV> <DIV>// Set Opacity<BR> vtkPiecewiseFunction *opacityFn = vtkPiecewiseFunction::New();<BR> opacityFn->RemoveAllPoints(); <BR> opacityFn->AddPoint(200,0.2); // Scalar value ranges from [0 to 255]-8bit image data<BR> opacityFn->AddPoint(225,1);<BR> opacityFn->AddPoint(255,0.2);</DIV> <DIV>// Set Color<BR>
vtkColorTransferFunction *colorFn = vtkColorTransferFunction::New(); <BR> for(i=0;i<nColors;i++)<BR> {<BR> cgp3d_colorFn->AddRGBPoint(cValue[i],R[i],G[i],B[i]);<BR> }</DIV> <DIV>//Vol Property<BR> vtkVolumeProperty *volProp = vtkVolumeProperty::New(); <BR> volProp->ShadeOn();<BR> volProp->SetInterpolationTypeToLinear();<BR> volProp->SetScalarOpacity(opacityFn);<BR> volProp->SetColor(colorFn);</DIV> <DIV> vtkVolumeRayCastCompositeFunction *raycastFn = vtkVolumeRayCastCompositeFunction::New();<BR> raycastFn->SetCompositeMethodToClassifyFirst();</DIV> <DIV> vtkVolumeRayCastMapper *volMapper =
vtkVolumeRayCastMapper::New();<BR> volMapper->AutoAdjustSampleDistancesOn();<BR> volMapper->SetMinimumImageSampleDistance(1);<BR> volMapper->IntermixIntersectingGeometryOn();<BR> volMapper->SetVolumeRayCastFunction(cgp3d_raycastFn);<BR> volMapper->SetInput(image3Ddata); // image3Ddata is vtkImageData</DIV> <DIV> vtlVolume *volActor = vtkVolume::New(); <BR> volActor->SetMapper(volMapper);<BR> volActor->SetProperty(volProp);</DIV> <DIV><BR> ren1->AddVolume(volActor);<BR> <BR></DIV><BR><BR><DIV>
<DIV>
<P align=left>Prasenjit Roy<BR><STRONG></STRONG></P>
<P align=left><STRONG>Home Address</STRONG>: </P>
<P align=left>1032 E Lindsey St, #H; Norman, OK-73071</P>
<P align=left>Cell: 405-227-7463</P>
<P align=left>Home: 405-366-8216</P>
<P align=left> </P></DIV></DIV>