[vtkusers] Please help me in viewing vtk

Gururajan gururajan.r at raster.in
Wed Jul 29 13:40:23 EDT 2009


The following i used for reading dicom series and creating .vtk files.
But am not able to view that created .vtk file.

Please any one can help me.
the following error am getting

*ERROR: In /home/juju/VTK5.0/VTK/IO/vtkDataReader.cxx, line 432
vtkPolyDataReader (0x8cdda7e8): Unrecognized file type: ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
for file: /home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Gods.vtk
*

Thanks
Guru


vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();
dicomreader.SetDirectoryName("/home/gururaj/MANIX/MANIX/CER-CT/ANGIO CT");
dicomreader.Update();
System.out.println("File Dimension " + dicomreader.GetFileDimensionality());

vtkImageWriter writer = new vtkImageWriter();//vtkImageWriter::New()
writer.SetInput(dicomreader.GetOutput());

writer.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Gods.vtk");
writer.SetFileDimensionality(3);

writer.Update();
writer.Write();




//3d Construction
String strfilename = new String();
strfilename = "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Gods.vtk";

vtkPolyDataReader polyReader = new vtkPolyDataReader();
//vtkStructuredGridReader polyReader = new vtkStructuredGridReader();
polyReader.SetFileName(strfilename);
polyReader.Update();

vtkPolyData polyData = new vtkPolyData();
polyData.DeepCopy(polyReader.GetOutput());

vtkPolyDataMapper polyMapper = new vtkPolyDataMapper();
polyMapper.SetInput(polyData);
polyMapper.Update();

vtkActor actor = new vtkActor();
actor.SetMapper(polyMapper);
actor.VisibilityOn();

vtkRenderer render = new vtkRenderer();
vtkRenderWindow renwindow = new vtkRenderWindow();
renwindow.AddRenderer(render);

vtkRenderWindowInteractor renintec = new vtkRenderWindowInteractor();
renintec.SetRenderWindow(renwindow);

render.AddActor(actor);
render.SetBackground(0.2,0.3,0);
renwindow.BordersOff();
renwindow.SetSize(500, 500);
renwindow.Render();
render.ResetCamera();
renintec.Start();



More information about the vtkusers mailing list