[vtkusers] Display .vtk files in 3d View

Gururajan gururajan.r at raster.in
Wed Jul 29 10:41:50 EDT 2009


Below i have pasted my code for reading .dcm files and Writing .vtk
files using dicom reader & display in 3d format

below this error my code for reading and writing dicom files as .vtk
format.
am not able to display my created .vtk files.  Other downloaded .vtk
files are display perfectly.

Please can any one help me in this/

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

*Thanks
Guru

Code For Reading series .Dcm File (below Code)*
   vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();
    dicomreader.SetDirectoryName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Single");
    dicomreader.Update();
    System.out.println("File Dimension " + 
dicomreader.GetFileDimensionality());
    
*Code   For  writing .vtk file Format*  (below Code)
   vtkImageWriter writer = new  vtkImageWriter();//vtkImageWriter::New()
   writer.SetInput(dicomreader.GetOutput());
   writer.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Ronald.vtk");
    writer.SetFileDimensionality(3);
    writer.Update();
    writer.Write();

*Code For Display in .3d View of (.vtk files) (below Code) *

    String strfilename = new String();
    strfilename = "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Ronald.vtk";
   
    vtkPolyDataReader polyReader = new vtkPolyDataReader();
    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.Render();
    render.ResetCamera();
    renintec.Start();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090729/e8c73f2b/attachment.htm>


More information about the vtkusers mailing list