[vtkusers] vtkX3DExporter

Emptystack wulihouxiaoshuai at 163.com
Mon Dec 9 03:34:14 EST 2013


Hello,everyone! I want to export the MIP volume rendering to a X3D file,but
something unexpected happened.The bug is "vtkX3DExporter (05C64BA0): no
actors found for writing X3D file." But from the 
following code,we can see that I attach the volume to the render. I don't
know where I am wrong, 
could anyone give me some help?

Many thanks!



int main( int argc, char *argv[] )
{   
	vtkRenderer *renderer = vtkRenderer::New();


	vtkRenderWindow *renWin = vtkRenderWindow::New();
	renWin->AddRenderer(renderer);

	vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
	iren->SetRenderWindow(renWin);

	vtkDICOMImageReader*reader=vtkDICOMImageReader::New();
	reader->SetDirectoryName("D:/image/CT");
	reader->Update();

	vtkColorTransferFunction*
colorTransforFunction=vtkColorTransferFunction::New();
	colorTransforFunction->AddRGBSegment(0,1,1,1,255,1,1,1);

	vtkPiecewiseFunction* opacityFun=vtkPiecewiseFunction::New();
	opacityFun->AddSegment(-3024,0,1694,1);

	vtkVolumeProperty* volumeProperty=vtkVolumeProperty::New();
	volumeProperty->SetColor(colorTransforFunction);
	volumeProperty->SetScalarOpacity(opacityFun);
	volumeProperty->SetInterpolationTypeToLinear();

	vtkGPUVolumeRayCastMapper* mapper=vtkGPUVolumeRayCastMapper::New();
	mapper->SetInput(reader->GetOutput());
	mapper->SetBlendModeToMaximumIntensity();
	mapper->Update();

	vtkVolume* volume=vtkVolume::New();
	volume->SetMapper(mapper);
	volume->SetProperty(volumeProperty);

     renderer->AddVolume(volume);



  renWin->Render();
  

  vtkX3DExporter *exporter = vtkX3DExporter::New();
  exporter->SetInput(renWin);
  exporter->SetFileName("testX3DExporter.x3d");
  exporter->Update();
  exporter->Write();

  iren->Start();
}



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkX3DExporter-tp5724920.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list