[vtkusers] Read and Writer Dicom Series

Gururajan gururajan.r at raster.in
Sat Aug 1 02:41:37 EDT 2009


Hi
with the reference of the below link. i have got some idea, even now am
not able to view my written .vtk file after reading dicom series. the
bug says there is no data to smooth.

Please any one can help. be low i pasted my code.
Since am trying this in java
    http://www.vtk.org/pipermail/vtkusers/2006-December/088806.html


         vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();
       
 //dicomreader.SetFileName("/home/gururaj/MANIX/MANIX/CER-CT/ANGIO
CT/IM-0001-0001.dcm");
       
 dicomreader.SetDirectoryName("/home/gururaj/MANIX/MANIX/CER-CT/AVEC I.V.");
         dicomreader.Update();
         System.out.println("Image Writer wrting file");
         
       
         vtkImageReader imgreader = new vtkImageReader();
         //imgreader.SetFilePattern("%s-%04d.dcm");
         imgreader.SetInput(dicomreader.GetOutput());
         imgreader.SetDataByteOrderToBigEndian();
         imgreader.Update();
       
       
         
         vtkImageWriter writer = new vtkImageWriter();
         writer.SetInput(imgreader.GetOutput());
         System.out.println("Image reader Output " + imgreader.GetOutput());
         writer.SetFilePattern("%s.0%3d");
         writer.Write();
       
         vtkVolume16Reader v16 = new vtkVolume16Reader();
         v16.SetDataDimensions(256, 256);
         v16.SetDataByteOrderToLittleEndian();
         v16.SetInput(imgreader.GetOutput());
         v16.SetImageRange(1,93);
         v16.SetDataSpacing(1.0,1.0, 2);
         
         
         vtkImageGaussianSmooth GauSmooth = new vtkImageGaussianSmooth();
         GauSmooth.SetInput(v16.GetOutput());
         System.out.println("Volume 16 Reader output : " + v16.GetOutput());
         GauSmooth.SetDimensionality(3);
         GauSmooth.SetStandardDeviation(0.0, 4.0);
         
         vtkContourFilter skinExtractor = new vtkContourFilter();
         skinExtractor.SetInput(GauSmooth.GetOutput());
         System.out.println("Gaussian Smooth output : " +
GauSmooth.GetOutput());
         skinExtractor.SetValue(0,500);
         skinExtractor.Update();
         
         vtkSmoothPolyDataFilter smoother = new vtkSmoothPolyDataFilter();
         smoother.SetInput(skinExtractor.GetOutput());
         System.out.println("Skin Extractor  output : " +
skinExtractor.GetOutput());
         smoother.SetNumberOfIterations(78);
         
         vtkPolyDataNormals polyNormal = new vtkPolyDataNormals();
         polyNormal.SetInput(smoother.GetOutput());
         System.out.println("Smoother   output : " + smoother.GetOutput());
         polyNormal.SetFeatureAngle(60.0);
         
         vtkPolyDataWriter polyWriter = new vtkPolyDataWriter();
         polyWriter.SetInput(polyNormal.GetOutput());
         System.out.println("Normals  output : " + smoother.GetOutput());
         polyWriter.SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Dicom.vtk");
         polyWriter.Write();
         
        
Thanks
Guru



More information about the vtkusers mailing list