[vtkusers] vtkUnstructuredGrid--->vtkstructuredData

Jianlong Zhou zhou at isg.cs.uni-magdeburg.de
Tue Oct 16 14:55:39 EDT 2001


hi,vtkusers:
I am writing a volume clipping program. What I want to do is first 
clipping the volume using a implicit function, and then render the 
clipped volume using direct volume rendering. My pipeline is as 
followings. But I have a problem, because the clipped volume is 
unstructured grid, how to convert unstructured grid to structured 
dataset so that I can use direct volume rendering method to render 
it? Any suggestions would be greatly appreciated.
Thank you in advance.

Jianlong.


   vtkClipVolume *volumeClipper=vtkClipVolume::New();
	  volumeClipper->SetInput(reader->GetOutput());
	  volumeClipper->SetClipFunction(lensFunction);
	  volumeClipper->GenerateClippedOutputOn();
	  volumeClipper->GenerateClipScalarsOn();
	  volumeClipper->InsideOutOn();
	  volumeClipper->Update();

   vtkPiecewiseFunction *tfunClipper =vtkPiecewiseFunction::New();
       tfunClipper->AddPoint(1200, .5);
	  tfunClipper->AddPoint(1300, .7);
	  tfunClipper->AddPoint(2000, .7);
	  tfunClipper->AddPoint(4095.0,  1.0);

   vtkColorTransferFunction *ctfunClipper 
=vtkColorTransferFunction::New();
	  ctfunClipper->AddRGBPoint(0.0, 0.2,  0.0,  0.0);
	  ctfunClipper->AddRGBPoint(600.0, 1.0,  0.2,  0.2);
	  ctfunClipper->AddRGBPoint(1280.0, 0.6,  0.2,  0.3);
  vtkVolumeRayCastMIPFunction  
*MIPFunctionClipper=vtkVolumeRayCastMIPFunction::New();
      
   vtkVolumeRayCastMapper *volumeMapperClipper 
=vtkVolumeRayCastMapper::New();
	  volumeMapperClipper->SetInput(volumeClipper->GetOutput()); 
                                         ///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                        ////here has problem of unstructured grid
                                        //to structured dataset
	  volumeMapperClipper->SetVolumeRayCastFunction( 
MIPFunctionClipper);
	  volumeMapperClipper->ScalarVisibilityOff();
	  volumeMapperClipper->ImmediateModeRenderingOn();


   vtkVolumeProperty 
*volumePropertyClipper=vtkVolumeProperty::New();
	  volumePropertyClipper->SetColor( ctfunClipper);
	  volumePropertyClipper->SetScalarOpacity( tfunClipper);
	  volumePropertyClipper->SetInterpolationTypeToLinear();
	  volumePropertyClipper->ShadeOn();

   vtkVolume *clippedVolumeMIP =vtkVolume::New();
	  clippedVolumeMIP->SetMapper( volumeMapperClipper);
	  clippedVolumeMIP->SetProperty( volumePropertyClipper);





More information about the vtkusers mailing list