[vtkusers] not able to view .vtk file in 3D view

Gururajan gururajan.r at raster.in
Fri Jul 31 06:09:07 EDT 2009


Any one plz have a guess to me

The following methods i have tried to write dicom series files into .VTK
format.
*
the problem is *
*    am unable to view the written .VTK file.*

Reading Dicom Series files
  vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();
    dicomreader.SetDirectoryName("/home/gururaj/MANIX/MANIX/CER-CT/ANGIO
CT");
    dicomreader.Update();



the following are the types i have tried to write .VTK format using
dicomreader.
/*vtkPolyDataWriter polyWriter = new vtkPolyDataWriter();
    polyWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Polydata.vtk");
    polyWriter.SetInput(dicomreader.GetOutput());
    polyWriter.SetFileTypeToASCII();
    polyWriter.Write();
    polyWriter.Update();
    */

    /*
    vtkUnstructuredGridWriter unWriter = new vtkUnstructuredGridWriter();
    unWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Undata.vtk");
    unWriter.SetInput(dicomreader.GetOutput());
    unWriter.SetFileTypeToASCII();
    unWriter.Write();
    unWriter.Update();
    */
    /*vtkImageData imgData = dicomreader.GetOutput();
    imgData.SetSpacing(1, 1, 1);
    imgData.SetOrigin(0,0,0);
    vtkImageWriter imgWriter = new vtkImageWriter();
    imgWriter.SetInput(imgData);
    imgWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk");
    imgWriter.SetFileDimensionality(3);
    imgWriter.Update();
    imgWriter.Write();
    */
    
    /*vtkStructuredPointsWriter stWriter = new vtkStructuredPointsWriter();
    stWriter.SetInput(dicomreader.GetOutput());
    stWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk");
    stWriter.SetFileTypeToASCII();
    stWriter.Update();
    stWriter.Write();
    */
    
   /* vtkXMLImageDataWriter xWriter = new vtkXMLImageDataWriter();
    xWriter.SetInput(dicomreader.GetOutput());
    xWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk");
    xWriter.Update();
    xWriter.Write();
    */

the following method i have used to view .VTK file but all are helpless
to me.
 String strfilename = new String();
    strfilename = "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Imgdata.vtk";
   
    //vtkPolyDataReader polyReader = new vtkPolyDataReader();
    vtkPNGReader polyReader = new vtkPNGReader();
   
    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();


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


More information about the vtkusers mailing list